<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.yoctoproject.org/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=RzR</id>
	<title>Yocto Project - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.yoctoproject.org/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=RzR"/>
	<link rel="alternate" type="text/html" href="https://wiki.yoctoproject.org/wiki/Special:Contributions/RzR"/>
	<updated>2026-04-12T00:16:26Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.5</generator>
	<entry>
		<id>https://wiki.yoctoproject.org/wiki/index.php?title=TipsAndTricks/BuildingZephyrImages&amp;diff=85475</id>
		<title>TipsAndTricks/BuildingZephyrImages</title>
		<link rel="alternate" type="text/html" href="https://wiki.yoctoproject.org/wiki/index.php?title=TipsAndTricks/BuildingZephyrImages&amp;diff=85475"/>
		<updated>2022-09-25T10:51:19Z</updated>

		<summary type="html">&lt;p&gt;RzR: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Back to [[TipsAndTricks]]&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Yocto offers an alternative way of building [https://www.zephyrproject.org/ Zephyr Project] images by using the [http://git.yoctoproject.org/cgit/cgit.cgi/meta-zephyr meta-zephyr] layer. &lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
You&#039;ll need to install the following additional package &amp;lt;tt&amp;gt;python3-pexpect&amp;lt;/tt&amp;gt;. If you&#039;re going to using the Arduino 101 board, you&#039;ll also need to configure &amp;lt;tt&amp;gt;dfu-util&amp;lt;/tt&amp;gt; as follows:&lt;br /&gt;
&lt;br /&gt;
=== Using DFU ===&lt;br /&gt;
Device Firmware Update (DFU) allows you to flash A101 images over USB without the need for a JTAG adaptor. First you&#039;ll need to install the package &amp;lt;tt&amp;gt;dfu-util&amp;lt;/tt&amp;gt; on your Linux distro. By default dfu-util needs root privileges to run. You work around this with the following udev rules&lt;br /&gt;
* If on Fedora, you need to create the system group plugdev&lt;br /&gt;
 $ sudo groupadd -r plugdev&lt;br /&gt;
* Add user to plugdev group&lt;br /&gt;
 $ sudo usermod -a -G plugdev $USER&lt;br /&gt;
* Create file &amp;lt;tt&amp;gt;etc/udev/rules.d/50-arduino101.rules&amp;lt;/tt&amp;gt; and add the following linr&lt;br /&gt;
 SUBSYSTEMS==&amp;quot;usb&amp;quot;, ATTRS{idVendor}==&amp;quot;8087&amp;quot;, ATTRS{idProduct}==&amp;quot;0aba&amp;quot;, GROUP=&amp;quot;plugdev&amp;quot;, MODE=&amp;quot;0666&amp;quot;&lt;br /&gt;
* Reload udev rules&lt;br /&gt;
 $ sudo udevadm control --reload-rules&lt;br /&gt;
&lt;br /&gt;
=== Zephyr Layer ===&lt;br /&gt;
meta-zephyr layer can be found at git://git.yoctoproject.org/meta-zephyr. The layer supports dunfell and master branches and is dependent on the equivalent poky branch.&lt;br /&gt;
&lt;br /&gt;
== Boards and Machines ==&lt;br /&gt;
Zephyr BOARDS typically map to bitbake MACHINES, but underscores become dashes. e.g. BOARD=arduino_101_sss maps to MACHINE = &amp;quot;arduino-101-sss&amp;quot;&lt;br /&gt;
&lt;br /&gt;
== Building Zephyr samples ==&lt;br /&gt;
The following instructions build the philosophers sample.&lt;br /&gt;
=== Recipe ===&lt;br /&gt;
The recipe is pretty simple, see below.&lt;br /&gt;
* Think of the require statements as the zephyr base class (could/should be &amp;lt;tt&amp;gt;inhert zephyr-in-tree-build&amp;lt;/tt&amp;gt; instead ?&lt;br /&gt;
* &amp;lt;tt&amp;gt;inhert deploy&amp;lt;/tt&amp;gt; adds a deploy task (it&#039;s a standard poky base class)&lt;br /&gt;
* ZEPHYR_SRC_DIR sets location of application&lt;br /&gt;
* do_deploy puts image in a known location&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
require zephyr-kernel.inc&lt;br /&gt;
require zephyr-kernel-common.inc&lt;br /&gt;
inherit deploy&lt;br /&gt;
&lt;br /&gt;
ZEPHYR_SRC_DIR = &amp;quot;${S}/samples/philosophers&amp;quot;&lt;br /&gt;
ZEPHYR_BASE = &amp;quot;${S}&amp;quot;&lt;br /&gt;
OECMAKE_SOURCEPATH = &amp;quot;${ZEPHYR_SRC_DIR}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
do_deploy () {&lt;br /&gt;
    install -D ${B}/zephyr/${ZEPHYR_MAKE_OUTPUT} ${DEPLOYDIR}/${PN}.elf&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
addtask deploy after do_compile&lt;br /&gt;
do_install[noexec] = &amp;quot;1&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Targeting QEMU ===&lt;br /&gt;
Here are the steps. We&#039;ll use the kirkstone (LTS) branch for stability.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export MACHINE=qemu-x86&lt;br /&gt;
export DISTRO=&amp;quot;zephyr&amp;quot;&lt;br /&gt;
branch=kirkstone&lt;br /&gt;
&lt;br /&gt;
git clone -b ${branch} --recursive --depth 1 git://git.yoctoproject.org/meta-zephyr/&lt;br /&gt;
git clone -b ${branch} --recursive --depth 1 git://git.yoctoproject.org/poky&lt;br /&gt;
git clone -b ${branch} --recursive --depth 1 git://git.openembedded.org/meta-openembedded&lt;br /&gt;
source poky/oe-init-build-env&lt;br /&gt;
bitbake-layers add-layer ../meta-openembedded/meta-oe&lt;br /&gt;
bitbake-layers add-layer ../meta-openembedded/meta-python&lt;br /&gt;
bitbake-layers add-layer ../meta-zephyr/meta-zephyr-core&lt;br /&gt;
bitbake-layers add-layer ../meta-zephyr/meta-zephyr-bsp&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now build a Qemu image of the canonical Zephyr sample&lt;br /&gt;
&lt;br /&gt;
 bitbake zephyr-philosophers&lt;br /&gt;
Running zephyr qemu image&lt;br /&gt;
 runqemu qemu-x86&lt;br /&gt;
And will produce output like this &lt;br /&gt;
:[[File:Zehpyr-philosophers-screen-shot.png]]&lt;br /&gt;
&lt;br /&gt;
=== Arduino 101 ===&lt;br /&gt;
Let&#039;s build the philosophers sample for Arduino 101 x86 core. Set up as for [[TipsAndTricks/BuildingZephyrImages#QEMU|QEMU]] but set machine as follows&lt;br /&gt;
 MACHINE = &amp;quot;arduino-101&amp;quot;&lt;br /&gt;
Then run &lt;br /&gt;
 bitbake zephyr-philosophers&lt;br /&gt;
Note that there will be significant rebuild, as although both qemu-x86 and arduino-101 are 386 class devices, arduino-101 uses the subtly different IAMCU toolchain.&lt;br /&gt;
&lt;br /&gt;
After build complete, use the flash_usb task to flash the target via DFU&lt;br /&gt;
 bitbake zephyr-philosophers  -c flash_usb&lt;br /&gt;
Sample text output will appear on serial port.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Arduino 101 and Multiconfig ==&lt;br /&gt;
Inter Processor Mailbox (IPM) is a Zephyr driver that allows communications between processors. The IPM sample shows communication between the x86 and ARC cores and is good way to exercise multi-config.&lt;br /&gt;
=== Configuration ===&lt;br /&gt;
Add the following to &amp;lt;tt&amp;gt;local.conf&amp;lt;/tt&amp;gt;&lt;br /&gt;
 DISTRO = &amp;quot;zephyr&amp;quot;&lt;br /&gt;
 MACHINE ?= &amp;quot;arduino-101&amp;quot;&lt;br /&gt;
 BBMULTICONFIG ?= &amp;quot;arduino-101 arduino-101-sss&amp;quot;&lt;br /&gt;
Create folder &amp;lt;tt&amp;gt;multiconfig&amp;lt;/tt&amp;gt; under &amp;lt;tt&amp;gt;conf&amp;lt;/tt&amp;gt; with a file &amp;lt;tt&amp;gt;arduino-101-sss.conf&amp;lt;/tt&amp;gt;&lt;br /&gt;
 + conf&lt;br /&gt;
    + multiconfig&lt;br /&gt;
         arduino-101.conf&lt;br /&gt;
         arduino-101-sss.conf&lt;br /&gt;
The file &amp;lt;tt&amp;gt;conf/multiconfig/arduino-101.conf&amp;lt;/tt&amp;gt; should contain:&lt;br /&gt;
 MACHINE=&amp;quot;arduino-101&amp;quot;&lt;br /&gt;
 TMPDIR=&amp;quot;${TOPDIR}/tmp-arduino-101&amp;quot;&lt;br /&gt;
The file &amp;lt;tt&amp;gt;conf/multiconfig/arduino-101-sss.conf&amp;lt;/tt&amp;gt; should contain:&lt;br /&gt;
 MACHINE=&amp;quot;arduino-101-sss&amp;quot;&lt;br /&gt;
 TMPDIR=&amp;quot;${TOPDIR}/tmp-arduino-101-sss&amp;quot;&lt;br /&gt;
The TMPDIR settings are a workaround a multiconfig bug exposed by the meta-zephyr.&lt;br /&gt;
&lt;br /&gt;
=== Building ===&lt;br /&gt;
Build both images:&lt;br /&gt;
 $ bitbake multiconfig:arduino-101:zephyr-ipm multiconfig:arduino-101-sss:zephyr-ipm&lt;br /&gt;
&lt;br /&gt;
=== Flashing ===&lt;br /&gt;
Once the build is finished (both images are built), flash:&lt;br /&gt;
 $ bitbake multiconfig:*:zephyr-ipm -cflash_usb&lt;br /&gt;
&lt;br /&gt;
=== Running ===&lt;br /&gt;
Press reset, serial output should look like this&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
===== app started ========&lt;br /&gt;
Hello from application processor (x86)! (0) Sensor Subsystem (ARC) is sleeping, mailbox status: 00000000 mask fffff0ef&lt;br /&gt;
sending messages for IPM device 0xa80064e4&lt;br /&gt;
sending messages for IPM device 0xa80064d8&lt;br /&gt;
sending messages for IPM device 0xa80064cc&lt;br /&gt;
Hello from application processor (x86)! (1) Sensor Subsystem (ARC) is sleeping, mailbox status: 00000000 mask fffff0ef&lt;br /&gt;
pinging sensor subsystem (ARC) for counter status&lt;br /&gt;
ipm_console0: &#039;counters: 148 6 7&#039;&lt;br /&gt;
ipm_console0: &#039;Hello from ARC!&#039;&lt;br /&gt;
Hello from application processor (x86)! (2) Sensor Subsystem (ARC) is sleeping, mailbox status: 00000000 mask fffff0ef&lt;br /&gt;
pinging sensor subsystem (ARC) for counter status&lt;br /&gt;
ipm_console0: &#039;counters: 69 50 35&#039;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>RzR</name></author>
	</entry>
</feed>