How to use BOARD_ROOT to define out-of-tree boards?

Li, Jun R <>


I’m trying to use the new feature implemented by PR #6150 to define my private boards. I just copied samples/hello_word to an out-of-tree directory and copied boards/arm/stm32f4_disco to the directory hello_world to have a try.

So, my directory structure is like this:


├── boards

   └── arm

       └── stm32f4_disco

           ├── board.cmake

           ├── board.h

           ├── CMakeLists.txt

           ├── doc

              ├── img

                 └── en.stm32f4_discovery.jpg

              └── stm32f4_disco.rst

           ├── Kconfig.board

           ├── Kconfig.defconfig

           ├── pinmux.c

           ├── stm32f4_disco_defconfig

           ├── stm32f4_disco.dts

           ├── stm32f4_disco.yaml

           └── support

               └── openocd.cfg

├── build

   ├── CMakeCache.txt

   └── CMakeFiles

       └── cmake.check_cache

├── CMakeLists.txt

├── prj.conf

├── prj_single.conf

├── README.rst

├── sample.yaml

└── src

    └── main.c


However, I couldn't make cmake to find the board I defined by either of the following two ways:

1.     Directly specify the BOARD_ROOT by the command: “cmake -DBOARD=stm32f4_disco -DBOARD_ROOT=./ ..


2.     Specify the BOARD_ROOT in my CMakefile:

include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE)



set(BOARD_ROOT ./)

target_sources(app PRIVATE src/main.c)


For the first way, I got an error:

            -- Selected BOARD stm32f4_disoc

No board named 'stm32f4_disoc' found


For the second way, it can compile and find the board, but the used board directory is still the original one in Zephyr:

-- Found PythonInterp: /usr/bin/python3 (found suitable version "3.5.2", minimum required is "3.4")

-- Selected BOARD stm32f4_disco

Zephyr version: 1.11.99

Parsing Kconfig tree in /home /projects/my_base_1.11/zephyr/Kconfig

Using /home/projects/my_base_1.11/zephyr/boards/arm/stm32f4_disco/stm32f4_disco_defconfig as base



I’m wondering what’s wrong on my usage of BOARD_ROOT? Thanks for help!



Jun Li | NTG | Intel Corporation


Join to automatically receive all group messages.