PlatformIO provides nice wrappers around building and flashing zephyr projects to boards, but its support for other Zephyr concepts like ztests and qemu are not implemented.
Additionally while Unity works for simple unit tests, it does not meet needs for more involved testing requirements.
To that end, I tried to use Zephyr’s provided twister
tool in a freshly configured PlatformIO framework-zephyr project, but I get the following errors when trying to follow the twister
setup guide:
proxima@DESKTOP-SL4KPAL:/mnt/c/Users/steven/projects/stofl-trailer/zephyr$ ~/zephyr/venv/bin/python ~/zephyrproject/zephyr/scripts/twister -T ./integration/ -vv
ZEPHYR_BASE unset, using "/home/proxima/zephyrproject/zephyr"
INFO - Zephyr version: zephyr-v2.5.0-1121-gad8a89fa65f7
INFO - JOBS: 6
DEBUG - Reading test case configuration files under /mnt/c/Users/steven/projects/stofl-trailer/zephyr/integration...
DEBUG - Found possible test case in /mnt/c/Users/steven/projects/stofl-trailer/zephyr/integration
DEBUG - Reading platform configuration files under /home/proxima/zephyrproject/zephyr/boards...
DEBUG - Reading platform configuration files under /home/proxima/zephyrproject/zephyr/scripts/pylib/twister/boards...
DEBUG - Running cmake script /home/proxima/zephyrproject/zephyr/cmake/verify-toolchain.cmake
DEBUG - Calling cmake with arguments: ['-DFORMAT=json', '-P', PosixPath('/home/proxima/zephyrproject/zephyr/cmake/verify-toolchain.cmake')]
DEBUG - Finished running /home/proxima/zephyrproject/zephyr/cmake/verify-toolchain.cmake
INFO - Using 'zephyr' toolchain.
DEBUG - platform filter: None
DEBUG - arch_filter: None
DEBUG - tag_filter: None
DEBUG - exclude_tag: None
INFO - Selecting default platforms per test case
INFO - Building initial testcase list...
DEBUG - nsim_em testing.ztest SKIPPED: Not in testcase platform allow list
DEBUG - nsim_em7d_v22 testing.ztest SKIPPED: Not in testcase platform allow list
DEBUG - qemu_arc_em testing.ztest SKIPPED: Not in testcase platform allow list
DEBUG - qemu_arc_hs testing.ztest SKIPPED: Not in testcase platform allow list
DEBUG - frdm_k64f testing.ztest SKIPPED: Not in testcase platform allow list
DEBUG - mps2_an385 testing.ztest SKIPPED: Not in testcase platform allow list
DEBUG - mps2_an521 testing.ztest SKIPPED: Not in testcase platform allow list
DEBUG - mps2_an521_nonsecure testing.ztest SKIPPED: Not in testcase platform allow list
DEBUG - qemu_cortex_a53 testing.ztest SKIPPED: Not in testcase platform allow list
DEBUG - qemu_cortex_a53_smp testing.ztest SKIPPED: Not in testcase platform allow list
DEBUG - qemu_cortex_a53_xip testing.ztest SKIPPED: Not in testcase platform allow list
DEBUG - qemu_cortex_m0 testing.ztest SKIPPED: Not in testcase platform allow list
DEBUG - qemu_cortex_r5 testing.ztest SKIPPED: Not in testcase platform allow list
DEBUG - qemu_nios2 testing.ztest SKIPPED: Not in testcase platform allow list
DEBUG - qemu_riscv32 testing.ztest SKIPPED: Not in testcase platform allow list
DEBUG - qemu_riscv64 testing.ztest SKIPPED: Not in testcase platform allow list
DEBUG - qemu_leon3 testing.ztest SKIPPED: Not in testcase platform allow list
DEBUG - qemu_x86 testing.ztest SKIPPED: Not in testcase platform allow list
DEBUG - qemu_x86_64 testing.ztest SKIPPED: Not in testcase platform allow list
DEBUG - qemu_x86_64_nokpti testing.ztest SKIPPED: Not in testcase platform allow list
DEBUG - qemu_x86_coverage testing.ztest SKIPPED: Not in testcase platform allow list
DEBUG - qemu_x86_lakemont testing.ztest SKIPPED: Not in testcase platform allow list
DEBUG - qemu_x86_nokpti testing.ztest SKIPPED: Not in testcase platform allow list
DEBUG - qemu_x86_nommu testing.ztest SKIPPED: Not in testcase platform allow list
DEBUG - qemu_x86_nopae testing.ztest SKIPPED: Not in testcase platform allow list
DEBUG - qemu_x86_tiny testing.ztest SKIPPED: Not in testcase platform allow list
DEBUG - qemu_x86_virt testing.ztest SKIPPED: Not in testcase platform allow list
DEBUG - qemu_x86_xip testing.ztest SKIPPED: Not in testcase platform allow list
DEBUG - qemu_xtensa testing.ztest SKIPPED: Not in testcase platform allow list
DEBUG - xt-sim testing.ztest SKIPPED: Not in testcase platform allow list
INFO - 1 test scenarios (1 configurations) selected, 30 configurations discarded due to filters.
INFO - Adding tasks to the queue...
DEBUG - adding native_posix/testing.ztest
INFO - Added initial list of jobs to queue
DEBUG - Launch process 0
DEBUG - Launch process 1
DEBUG - Launch process 2
DEBUG - Launch process 3
DEBUG - Running cmake on /mnt/c/Users/steven/projects/stofl-trailer/zephyr/integration for native_posix
DEBUG - Calling cmake with arguments: ['-B/mnt/c/Users/steven/projects/stofl-trailer/zephyr/twister-out/native_posix/testing.ztest', '-S/mnt/c/Users/steven/projects/stofl-trailer/zephyr/integration', '-DEXTRA_CFLAGS="-Werror"', '-DEXTRA_AFLAGS="-Wa,--fatal-warnings', '-DEXTRA_LDFLAGS="-Wl,--fatal-warnings"', '-DEXTRA_GEN_DEFINES_ARGS=--err-on-deprecated-properties', '-GUnix Makefiles', '-DBOARD=native_posix']
DEBUG - Launch process 4
DEBUG - Launch process 5
ERROR - Cmake build failure: /mnt/c/Users/steven/projects/stofl-trailer/zephyr/integration for native_posix
INFO - 1/1 native_posix testing.ztest FAILED Cmake build failure (build)
ERROR - see: /mnt/c/Users/steven/projects/stofl-trailer/zephyr/twister-out/native_posix/testing.ztest/build.log
DEBUG - running footprint_reports
INFO - 0 of 1 test configurations passed (0.00%), 1 failed, 0 skipped with 0 warnings in 3.52 seconds
INFO - In total 1 test cases were executed, 0 skipped on 1 out of total 331 platforms (0.30%)
INFO - 0 test configurations executed on platforms, 1 test configurations were only built.
INFO - Saving reports...
INFO - Writing xunit report /mnt/c/Users/steven/projects/stofl-trailer/zephyr/twister-out/twister.xml...
INFO - Writing xunit report /mnt/c/Users/steven/projects/stofl-trailer/zephyr/twister-out/twister_report.xml...
INFO - Run completed
The cmake error log:
Including boilerplate (Zephyr base): /home/proxima/zephyrproject/zephyr/cmake/app/boilerplate.cmake
-- Application: /mnt/c/Users/steven/projects/stofl-trailer/zephyr/integration
-- Zephyr version: 2.5.99 (/home/proxima/zephyrproject/zephyr)
-- Found Python3: /home/proxima/zephyr/venv/bin/python3.8 (found suitable exact version "3.8.5") found components: Interpreter
-- Found west (found suitable version "0.10.0", minimum required is "0.7.1")
-- Board: native_posix
-- Cache files will be written to: /home/proxima/.cache/zephyr
-- Found toolchain: host (gcc/ld)
-- Found BOARD.dts: /home/proxima/zephyrproject/zephyr/boards/posix/native_posix/native_posix.dts
-- Generated zephyr.dts: /mnt/c/Users/steven/projects/stofl-trailer/zephyr/twister-out/native_posix/testing.ztest/zephyr/zephyr.dts
-- Generated devicetree_unfixed.h: /mnt/c/Users/steven/projects/stofl-trailer/zephyr/twister-out/native_posix/testing.ztest/zephyr/include/generated/devicetree_unfixed.h
-- Generated device_extern.h: /mnt/c/Users/steven/projects/stofl-trailer/zephyr/twister-out/native_posix/testing.ztest/zephyr/include/generated/device_extern.h
Parsing /home/proxima/zephyrproject/zephyr/Kconfig
Loaded configuration '/home/proxima/zephyrproject/zephyr/boards/posix/native_posix/native_posix_defconfig'
Merged configuration '/mnt/c/Users/steven/projects/stofl-trailer/zephyr/integration/prj.conf'
Configuration saved to '/mnt/c/Users/steven/projects/stofl-trailer/zephyr/twister-out/native_posix/testing.ztest/zephyr/.config'
Kconfig header saved to '/mnt/c/Users/steven/projects/stofl-trailer/zephyr/twister-out/native_posix/testing.ztest/zephyr/include/generated/autoconf.h'
CMake Error at /usr/share/cmake-3.16/Modules/CMakeDetermineSystem.cmake:185 (configure_file):
configure_file Problem configuring file
Call Stack (most recent call first):
/home/proxima/zephyrproject/zephyr/cmake/app/boilerplate.cmake:592 (project)
/home/proxima/zephyrproject/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:24 (include)
/home/proxima/zephyrproject/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:35 (include_boilerplate)
CMakeLists.txt:4 (find_package)
-- The C compiler identification is GNU 9.3.0
CMake Error at /usr/share/cmake-3.16/Modules/CMakeDetermineCCompiler.cmake:212 (configure_file):
configure_file Problem configuring file
Call Stack (most recent call first):
/home/proxima/zephyrproject/zephyr/cmake/app/boilerplate.cmake:592 (project)
/home/proxima/zephyrproject/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:24 (include)
/home/proxima/zephyrproject/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:35 (include_boilerplate)
CMakeLists.txt:4 (find_package)
-- The CXX compiler identification is GNU 9.3.0
CMake Error at /usr/share/cmake-3.16/Modules/CMakeDetermineCXXCompiler.cmake:210 (configure_file):
configure_file Problem configuring file
Call Stack (most recent call first):
/home/proxima/zephyrproject/zephyr/cmake/app/boilerplate.cmake:592 (project)
/home/proxima/zephyrproject/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:24 (include)
/home/proxima/zephyrproject/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:35 (include_boilerplate)
CMakeLists.txt:4 (find_package)
-- The ASM compiler identification is GNU
-- Found assembler: /usr/bin/gcc
CMake Error at /usr/share/cmake-3.16/Modules/CMakeDetermineASMCompiler.cmake:222 (configure_file):
configure_file Problem configuring file
Call Stack (most recent call first):
/home/proxima/zephyrproject/zephyr/cmake/app/boilerplate.cmake:593 (enable_language)
/home/proxima/zephyrproject/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:24 (include)
/home/proxima/zephyrproject/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:35 (include_boilerplate)
CMakeLists.txt:4 (find_package)
CMake Error at /home/proxima/zephyrproject/zephyr/CMakeLists.txt:372 (configure_file):
configure_file Problem configuring file
CMake Error at /home/proxima/zephyrproject/zephyr/misc/generated/CMakeLists.txt:17 (configure_file):
configure_file Problem configuring file
Call Stack (most recent call first):
/home/proxima/zephyrproject/zephyr/CMakeLists.txt:438 (include)
CMake Error at /home/proxima/zephyrproject/zephyr/cmake/linker/ld/target_configure.cmake:6 (configure_file):
configure_file Problem configuring file
Call Stack (most recent call first):
/home/proxima/zephyrproject/zephyr/CMakeLists.txt:939 (toolchain_ld_configure_files)
-- Configuring incomplete, errors occurred!
See also "/mnt/c/Users/steven/projects/stofl-trailer/zephyr/twister-out/native_posix/testing.ztest/CMakeFiles/CMakeOutput.log".
If I run this within real zephyr
project workspace, everything works.
So how does one use zephyr
tools in a framework-zephyr
project in PlatformIO?