I have the following project tree
├── app-1
│ ├── build
│ ├── child_image
│ ├── CMakeLists.txt
│ ├── key
│ ├── mk_release.py
│ ├── prj.conf
│ └── src
├── app-2
│ ├── build
│ ├── child_image
│ ├── CMakeLists.txt
│ ├── CMakePresets.json
│ ├── nrf9160dk_switch.overlay
│ ├── prj.conf
│ └── src
├── boards
│ └── arm
├── CHANGELOG.md
├── common Common code for all projects and for unit tests
│ └── src
├── disable-debug-console.conf
├── firmware.env
├── Kconfig
├── module.yml
├── README.md
├── tests
│ ├── data
│ ├── fs
│ ├── Kconfig
│ ├── rtos
│ └── update
└── west.yml
I want to add an additional Kconfig option CONFIG_UNIT_TEST to use it in my source code.
Therefore I added a KConfig file in folder root/tests with the following content:
menu "Unit Test Options"
config UNIT_TEST
bool "Enable Unit Test Mode"
help
Aktiviert speziellen Code, der nur für Unit-Tests verwendet wird.
endmenu
and publish the test configuration by adding 'source "tests/Kconfig"' in root/Kconfig
In root/tests/data/prj.conf I added the line CONFIG_UNIT_TEST=y
and in a header file in common folder I added:
#ifdef CONFIG_UNIT_TEST
#error
#endif
When I try to compile the unit test program /root/tests/data/ I get following error message:
root@4b1f7826e2e0:/workspaces/prometheus-xl-firmware/tests/data# west build -p -b mps2_an521
-- west build: generating a build system
Loading Zephyr default modules (Zephyr base).
-- Application: /workspaces/prometheus-xl-firmware/tests/data
-- Found Python3: /usr/bin/python3.10 (found suitable exact version "3.10.12") found components: Interpreter
-- Cache files will be written to: /workspaces/.cache//zephyr
-- Zephyr version: 3.2.99 (/workspaces/zephyr)
-- Found west (found suitable version "0.14.0", minimum required is "0.7.1")
-- Board: mps2_an521
-- Found host-tools: zephyr 0.15.2 (/home/zephyr-sdk)
-- Found toolchain: zephyr 0.15.2 (/home/zephyr-sdk)
-- Found Dtc: /usr/bin/dtc (found suitable version "1.6.1", minimum required is "1.4.6")
-- Found BOARD.dts: /workspaces/zephyr/boards/arm/mps2_an521/mps2_an521.dts
-- Generated zephyr.dts: /workspaces/prometheus-xl-firmware/tests/data/build/zephyr/zephyr.dts
-- Generated devicetree_generated.h: /workspaces/prometheus-xl-firmware/tests/data/build/zephyr/include/generated/devicetree_generated.h
-- Including generated dts.cmake file: /workspaces/prometheus-xl-firmware/tests/data/build/zephyr/dts.cmake
warning: FPU (defined at soc/arm/nxp_imx/mcimx6x_m4/Kconfig.defconfig.mcimx6x_m4:11,
soc/arm/nxp_s32/s32ze/Kconfig.defconfig.series:15, arch/Kconfig:785) was assigned the value 'y' but
got the value 'n'. Check these unsatisfied dependencies: ((SOC_MCIMX6X_M4 && SOC_SERIES_IMX_6X_M4)
|| SOC_SERIES_S32ZE_R52 || CPU_HAS_FPU) (=n). See
docs.zephyrproject.org/.../kconfig.html and/or look up FPU in the
menuconfig/guiconfig interface. The Application Development Primer, Setting Configuration Values,
and Kconfig - Tips and Best Practices sections of the manual might be helpful too.
/workspaces/prometheus-xl-firmware/tests/data/prj.conf:44: warning: attempt to assign the value 'y' to the undefined symbol UNIT_TEST
Parsing /workspaces/zephyr/Kconfig
Loaded configuration '/workspaces/zephyr/boards/arm/mps2_an521/mps2_an521_defconfig'
Merged configuration '/workspaces/prometheus-xl-firmware/tests/data/prj.conf'
error: Aborting due to Kconfig warnings
CMake Error at /workspaces/zephyr/cmake/modules/kconfig.cmake:328 (message):
command failed with return code: 1
Call Stack (most recent call first):
/workspaces/nrf/cmake/modules/kconfig.cmake:29 (include)
/workspaces/zephyr/cmake/modules/zephyr_default.cmake:108 (include)
/workspaces/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
/workspaces/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:92 (include_boilerplate)
CMakeLists.txt:2 (find_package)
-- Configuring incomplete, errors occurred!
FATAL ERROR: command exited with status 1: /usr/local/bin/cmake -DWEST_PYTHON=/usr/bin/python3 -B/workspaces/prometheus-xl-firmware/tests/data/build -GNinja -DBOARD=mps2_an521 -S/workspaces/prometheus-xl-firmware/tests/data
root@4b1f7826e2e0:/workspaces/prometheus-xl-firmware/tests/data#
Would you please be so kind to check what I'm doing wrong or forgot to konfigure in the correct way.
I attached a stripped down example to show you my configurations.
If you need more informations please contact me.
Thanks in advance
Andreas Stenger3073.prometheus-xl-firmware.zip