Bug 10894

Summary: Zephyr BOARD value in local.conf is ignored
Product: [Build System, Metadata & Runtime] Other YP Layers Reporter: Henry Bruce <henry.bruce>
Component: meta-zephyrAssignee: Juro Bystricky <juro.bystricky>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Medium+    
Version: 2.3   
Target Milestone: 2.3 M2   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: Don't know

Description Henry Bruce 2017-01-07 00:24:32 UTC
Steps to Repeat
================
$ git clone git://git.yoctoproject.org/poky
$ git clone git://git.yoctoproject.org/meta-zephyr
$ source poky/oe-init-build-env
$ bitbake-layers add-layer ../meta-zephyr
$ echo DISTRO = \"zephyr\" > conf/local.conf
$ echo BOARD = \"arduino_101\" > conf/local.conf
$ bitbake zephyr-philosophers

Observed Behavior
=================
BOARD remains at default value of qemu_x86
See tmp/work/i586-yocto-elf/zephyr-philosophers/1.6.0-r0/temp/run.do_compile
In task do_compile, make command is
make -j V=1 BOARD=qemu_x86 CROSS_COMPILE=/path/to/build/tmp/sysroots/x86_64-linux/usr/bin/i586-yocto-elf/i586-yocto-elf- -C samples/philosophers

Expected Behavior
=================
BOARD is set to same value as in local.conf
In task do_compile, make command should be
make -j V=1 BOARD=arduino_101 CROSS_COMPILE=/path/to/build/tmp/sysroots/x86_64-linux/usr/bin/i586-yocto-elf/i586-yocto-elf- -C samples/philosophers
Comment 1 Juro Bystricky 2017-01-09 18:15:24 UTC
After pondering this somewhat, I believe the best way to fix this is deprecate the variable BOARD altogether and replace it with MACHINE. The meaning of BOARD in Zephyr environment is pretty much equivalent to MACHINE in yocto environment. So the envisioned solution would look something like:

$ MACHINE=arduino_101 bitbake zephyr-philosophers

or 

$ MACHINE=qemu_cortex_m3 bitbake zephyr-philosophers

etc.

where, of course, MACHINE can be set in local.conf as well.
Comment 2 Juro Bystricky 2017-01-10 23:01:36 UTC
I created support for these new MACHINES:

MACHINE=arduino-101
MACHINE=arduino-101-sss
MACHINE=qemu-cortx-m3

(with more to follow)

These correspond to Zephyr boards:

BOARD=arduino_101
BOARD=arduino_101_sss
BOARD=qemu_cortx_m3

Specifying MACHINE will implicitly determine cross-compiler toolchain as well.
(There is 1:1 correspondence between Zephyr BOARD and Yocto MACHINE so a lookup table BOARD:MACHINE may be needed in the future, presently all that is required is to convert "-" to "_")