Commit Graph

36 Commits

Author SHA1 Message Date
Zbigniew Bodek
15c5eea4ca zephyr-flash-pyocd.bbclass: Fix problems with flashing particular boards
By default, pyocd uses generic target type called "cortex_m" which
should be able to connect and debug but not flash the memory.
Normally pyocd would warn us of using default target instead
of proper one but this message wasn't displayed.

Despite not providing target type, flashing process succeeded
but results were undefined. On Nitrogen, sometimes it worked
(especially for small images) and sometimes the programmed
device crashed miserably.

Fix flashing operation by providing pyocd target type acquired from
the conditional PYOCD_TARGET variable declared for each machine
(chip family).

Signed-off-by: Zbigniew Bodek <zbigniew.bodek@huawei.com>
Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
2021-04-15 08:05:02 +08:00
Andrei Gherzan
8d54c98cc2 zephyr-flash-pyocd.bbclass: Implement configurable probe IDs to program
Implement logic to configure what probes to program based on the
PYOCD_FLASH_IDS variable:
1. by default program all attached probes
2. change default behaviour by listing the probe IDs to flash

CONNECT_TIMEOUT_SECONDS was also renamed to maintain consistency with
the PYOCD_FLASH_IDS variable.

One can query the IDs using `pyocd list`.

The value of PYOCD_FLASH_IDS can also be injected into the datastore
using BB_ENV_EXTRAWHITE.

Signed-off-by: Andrei Gherzan <andrei.gherzan@huawei.com>
Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
2021-02-17 11:51:02 +08:00
Andrei Gherzan
7dcb47371b zephyr-flash-pyocd.bbclass: Handle import error for pyocd modules
Signed-off-by: Andrei Gherzan <andrei.gherzan@huawei.com>
Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
2021-02-17 11:51:02 +08:00
Andrei Gherzan
bdbe1a04c1 zephyr-flash-pyocd.bbclass: Flash the first probe found with a timeout
Currently the code flashes the firmware in a blocking way. If the host
is not configured accordingly (for example in terms of permissions),
this would hang undefinitely. This can easily confuse users and in order
to avoid this, the patch changes to unblocking session creation and
opening call, wrapping the tries in some relevant logging. The timeout
can be defined with `CONNECT_TIMEOUT_SECONDS` which defaults to 30
seconds.

Also, by default, when multiple probes are attached, the session call
will return a selection choice. This would obviously break under bitbake
with an exception:
    Exception: EOFError: EOF when reading a line
Avoid this by selecting the first found probe.

Signed-off-by: Andrei Gherzan <andrei.gherzan@huawei.com>
Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
2021-02-17 11:51:02 +08:00
Andrei Gherzan
d81e72c050 zephyr-kernel-src: Restructure recipe
* Restructure recipe to use include files as opposed to a bbclass. The
  latter is unnatural when defining versions, sources etc.
* Make the zephyr-kernel-src follow the version as defined by
  PREFERRED_VERSION_zephyr-kernel.
* Make the setup of the zephyr-kernel-src.inc extensible for multiple
  versions.

Signed-off-by: Andrei Gherzan <andrei.gherzan@huawei.com>
Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
2021-02-17 11:51:01 +08:00
Andrei Gherzan
1ebcb8a34b Cleanup superflous new lines
Signed-off-by: Andrei Gherzan <andrei.gherzan@huawei.com>
Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
2021-02-17 11:51:01 +08:00
Andrei Gherzan
08a40a7de7 zephyr-flash-pyocd.bbclass: Add missing do_flash_usb dependency on do_deploy
Signed-off-by: Andrei Gherzan <andrei.gherzan@huawei.com>
Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
2021-02-17 11:51:01 +08:00
Andrei Gherzan
6dbedd2083 zephyr-flash-dfu.bbclass: Add missing do_flash_usb dependency on do_deploy
Signed-off-by: Andrei Gherzan <andrei.gherzan@huawei.com>
Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
2021-02-17 11:51:01 +08:00
Wojciech Zmuda
fe509167cb zephyr-kernel: clone Tinycrypt
Tinycrypt is a library used in some sample applications,
i.e. in zephyr-peripheral-esp. Add it to kernel bbclass,
so it can be referenced in applications recipes that
use it.

Signed-off-by: Wojciech Zmuda <wojciech.zmuda@huawei.com>
Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
2021-02-05 16:14:26 +08:00
Wojciech Zmuda
86fcab0456 zephyr-kernel: clone OpenAMP
OpenAMP is a framework providing software components enabling
development of software applications for AMP systems.
It is downloaded by default by west from two Zephyr Project
repositories based on original OpenAMP repositories:

 - open-amp - IPC layer that implements rpmsg communication
              between cores,
 - libmetal - HAL abstraction layer used by open-amp.

Clone the repositories so they can be used for building images
for boards with multicore chips.

Signed-off-by: Wojciech Zmuda <wojciech.zmuda@huawei.com>
Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
2020-12-16 09:07:43 +08:00
Wojciech Zmuda
a181f90bf8 zephyr-kernel: clone STM32 HAL
HAL for STM32 chipsets is one of Zephyr subprojects. It is downloaded
by default by west. Clone the HAL repository so it can be used for
building images for boards with STM32 chips.

Signed-off-by: Wojciech Zmuda <wojciech.zmuda@huawei.com>
Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
2020-12-16 09:07:43 +08:00
Wojciech Zmuda
4814135be3 classes: build zephyr-kernel-test-all for non-qemu boards
Machines not inheriting zephyr-qemuboot did not have
IMGDEPLOYDIR variable set, which is required for building
zephyr-kernel-test-all. The build was fine for qemu-xxx machines,
but for physical boards it failed somewhere inside python code
when .join() got an empty argument incoming from IMGDEPLOYDIR.
Move IMGDEPLOYDIR to zephyr class, so it's defined for
qemu and non-qemu machines.

Signed-off-by: Wojciech Zmuda <wojciech.zmuda@huawei.com>
Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
2020-12-14 08:16:12 +08:00
Wojciech Zmuda
b74dee01fc zephyr-flash-pyocd.bbclass: support for flashing via pyocd
Implement do_flash_usb for boards supported by pyocd:

    MACHINE=xxx bitbake yyy -c flash_usb

Pyocd support abundance of boards, however for now this
meta-layer supports only one board that can be flashed
using pyocd, that is 96Boards Nitrogen.

Describe the feature in README.

Signed-off-by: Wojciech Zmuda <wojciech.zmuda@huawei.com>
Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
2020-12-14 08:16:12 +08:00
Wojciech Zmuda
33fde6e6bc zephyr-kernel: clone Nordic HAL
HAL for Nordic chipsets is one of Zephyr subprojects. It is downloaded
by default by west. Clone the HAL repository so it can be used for
building images for boards with Nordic chips.

Signed-off-by: Wojciech Zmuda <wojciech.zmuda@huawei.com>
Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
2020-12-14 08:16:12 +08:00
Jon Mason
ecfdc7c69e zephyr-kernel: add Zephyr RTOS version 2.4.0 support
Update Zephyr to the latest version.  Tested via zephyr-philosophers on
qemu-cortex-m3.

Signed-off-by: Jon Mason <jon.mason@arm.com>
Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
2020-10-30 12:52:22 +08:00
Jon Mason
0f75e5e827 zephyr.bbclass: Add ability to set board
Currently, there is no ability to set the board used by Zephyr.  This
limits the ability to set the board to something other than the machine
name.  By setting up an intermediate variable, ZEPHYR_BOARD, this can be
set by those that know better (with the default to use the machine name
as before).

Signed-off-by: Jon Mason <jon.mason@arm.com>
2020-09-29 15:46:42 +08:00
Mah, Yock Gen
6bfb2769b4 zephyr-kernel: add Zephyr RTOS version 2.3.0 support
Signed-off-by: Mah, Yock Gen <yock.gen.mah@intel.com>
Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
2020-09-23 09:03:21 +08:00
Naveen Saini
5d3bbae52d zephyr-kernel: add Zephyr RTOS version 2.2.0 support
Release notes:
https://github.com/zephyrproject-rtos/zephyr/releases/tag/zephyr-v2.2.0

Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
2020-04-02 08:16:40 +08:00
Naveen Saini
6ce72628e4 zephy-kernel-test: update the testcase list for x86
Updated the test recipes to build against Zephyr v2.0
Code clean up

Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
2019-12-17 15:25:24 +08:00
Naveen Saini
b5d4f0fb63 zephyr-kernel: add Zephyr RTOS version 2.0.0 support
Release notes:
https://github.com/zephyrproject-rtos/zephyr/releases/tag/zephyr-v2.0.0

Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
2019-12-09 13:08:38 +08:00
Naveen Saini
7eb056d1ee zephyr-kernel: drop v1.7
Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
2019-12-09 13:08:38 +08:00
Naveen Saini
6d426f08d5 zephyr-kernel-src: updated SRC_URI to point to github
Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
2019-12-09 13:08:38 +08:00
Juro Bystricky
bd4e0ee3e6 siteinfo-zephyr.bbclass: refactor siteinfo
Move all SITEINFO_EXTRA_DATAFUNCS and PACKAGEQA_EXTRA_MACHDEFFUNCS
from various tune files (tune-arc.inc, tune-iamcu.inc, tune-nios2.inc)
into a a new siteinfo-zephyr.bbclass file. Although the original code did
not result in any obvious errors, in fact it did cause some multiconfig
problems.

[YOCTO#11166]

Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
2017-04-10 15:11:05 -07:00
Juro Bystricky
58f40114cc zephyr-flash-dfu.bbclass: modified PATH handling
Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
2017-04-03 08:57:44 -07:00
Juro Bystricky
38238f8ea7 zephyr-kernel.inc: also support Zephyr 1.7.0
Build kernel tests suite and kernel samples based on
PREFERRED_VERSION_zephyr-kernel

Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
2017-03-17 09:30:25 -07:00
Juro Bystricky
6fb096ca45 zephyr-qemuboot.bbclass: no rootfs
Explicitly state we don't have rootfs, otherwise default
rootfs QEMU settings may be forced by runqemu.

Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
2017-03-08 10:11:25 -08:00
Juro Bystricky
1a611eda3a arduino-101: Support for flashing via USB
Implement a class allowing flashing Arduino-101 using dfu-util.
User needs to have dfu-utils installed on the host machine.
All three cores supported (x86, ARM, ARC).

Sample usage:
    $ MACHINE=arduino-101 bitbake xxx
    $ MACHINE=arduino-101 bitbake xxx -c flash_usb

Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
2017-03-06 09:47:09 -08:00
Juro Bystricky
c42423e291 zephyr-qemuboot.bbclass: disable QEMU network
Setting QB_NET = "none" bypasses network configuration in runqemu.

Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
2017-02-05 20:19:02 -08:00
Juro Bystricky
59c5fb9c27 zephyrtest.bbclass: refactor
Only keep code/variables related to individual test/package names.
Moved ZEPHYR_TEST_SRCDIR into zephyr-kernel.inc as it is
zephyr kernel version specific.
Moved ZEPHYR_MAKE_OUTPUT into zephyr-kernel-common.inc as it is
as it is not zephyr test specific but applicable to all
zephyr images.
Generate additional files expected by testimage.bbclass:
testdata.json and a dummy  manifest file

Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
2017-02-05 20:01:38 -08:00
Juro Bystricky
3ef84e9439 zephyr-qemuboot.bbclass
A bbclass used to generate qemuboot.conf and various symbolic
links needed to properly run "runqemu".

Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
2017-01-30 17:03:00 -08:00
Juro Bystricky
d1cc929d4f zephyr-qemuboot.bbclass
A bbclass used to generate qemuboot.conf and various symbolic
links needed to properly run "runqemu".

Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
2017-01-30 16:28:53 -08:00
Juro Bystricky
052ed539d1 zephyrtest.bbclass: simplify names of test binaries
Drop the prefix "zephyr-kernel-test-".
Additional minor cleanup.

Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
2017-01-30 16:15:58 -08:00
Juro Bystricky
56fbee01e8 zephyr.bbclass: support for image configuration
New class to support commands such as:

$ MACHINE=xxx bitbake yyy -c menuconfig
$ MACHINE=xxx bitbake yyy -c devshell

Kernel options are typically configured via menuconfig.
The file "prj.conf" must be edited manually, hence the need for devshell.
Once in devshell, user can use their favorite editor to edit the file.

For proper operation, these two variables need to be set in
recipes:

ZEPHYR_SRC_DIR : path to the source, typically place with prj.conf
ZEPHYR_BASE: Zephyr kernel tree location

[YOCTO#10657]

Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
2017-01-18 12:24:49 -08:00
Juro Bystricky
3daa59f4da zephyrtest.bbclass: do not prepend 'test_'
Do not prepend 'test' to test programs.
(Don't assume all test programs names begin with 'test_')

Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
2017-01-04 11:10:30 -08:00
Juro Bystricky
97643716c2 meta-zephyr: basic upgrade
Numerous changes to allow building and running various
Zephyr tests using Zephyr release 1.6 and Yocto master distro
(commit 3676601335b4673e3572d5a9987a351f0bb44bcb and later)
Work in progress.

Notable changes:
1. Zephyr 1.6 does not support the concept of nano and micro kernel
   anymore.
2. Location of various tests have changed
3. Changes due to subtle python3/python2 differences
4. Zephyr Makefile changes (including renaming)
5. Improved failed test detection
6. Remove patch files no longer needed

With these changes, it is now possible to run Zephyr test suite and
Zephyr sample programs. Currently only x86 CPUs are supported, with
additional CPU support coming in the near future, in particular
support for ARM Cortex-M3 CPUs

Prerequisites:
Modify local conf by adding:
DISTRO="zephyr"
MACHINE?="qemux86"

Modify bblayers.conf by adding "meta-zephyr" to BBLAYERS

To build all Zephyr tests:
    $ bitbake zephyr-kernel-test-all

To test all built test images:
    $ bitbake zephyr-kernel-test-all -ctestimage

You can also build and test an individual test. This is done by appending
the actual test name to the "zephyr-kernel-test", for example:

    $ bitbake zephyr-kernel-test-test_sleep
    $ bitbake zephyr-kernel-test-test_sleep -ctestimage

It is also possible to build Zephyr sample programs. Included is a sample recipe
that builds the Zephyr "philosophers" sample:

    $ bitbake zephyr-philosophers

Once built, you can run the created "philosophers" image in qemu (at this point
the various paths have to be entered manually):

    $  ./tmp/sysroots/x86_64-linux/usr/bin/qemu-system-i386 \
         -kernel ./tmp/deploy/images/qemux86/philosophers.elf \
         -nographic -machine type=pc-0.14 -display none -clock dynticks \
         -no-acpi -balloon none

Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
2017-01-04 11:10:25 -08:00
Randy Witt
7a8d7eb97e Create the meta-zephyr layer with empty SRC_URI
Initial commit: original work by Randy Witt and Richard Purdie.

Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
2017-01-04 11:09:57 -08:00