Hi,
I noticed that the support for targets was significantly reduced with the introduction of mbed-os 6.x and cmake support.
I’m using a NRF52840 Laird module and was able to create a custom target in custom_targets.json with the old mbed-os 5.15 and mbed-cli 1 using the following json declaration:
"MTB_LAIRD_BL654_CUSTOM": {
"inherits": ["MCU_NRF52840"],
"release_versions": ["5"],
"device_name": "nRF52840_xxAA",
"detect_code": ["0465"],
"features_remove": ["CRYPTOCELL310"],
"macros_remove": ["MBEDTLS_CONFIG_HW_SUPPORT"],
"macros_add": ["NRFX_RNG_ENABLED=1", "RNG_ENABLED=1", "NRF_QUEUE_ENABLED=1", "CONFIG_GPIO_AS_PINRESET"],
"overrides": {
"lf_clock_src": "NRF_LF_SRC_RC",
"console-uart-flow-control": null
}
},
However, this seems to be broken using mbed-cli 2 and cmake. I can build a simple “hello world” main.cpp and latest mbed-os 6.9 with the NRF52840_DK without any problem:
mbed-tools compile -m NRF52840_DK -t GCC_ARM
→ works fine
I have seen that the NRF52840_DK is also simply derived from MCU_NRF52840 like my custom target is.
But if configure/build with my custom target, the compiler is not able to find the NRF52 specific headers:
stefan@phidias:~/projects/mbed6test2$ mbed-tools compile -m MTB_LAIRD_BL654_CUSTOM -t GCC_ARM
Configuring project and generating build system…
– Configuring done
– Generating done
– Build files have been written to: /home/stefan/projects/mbed6test2/cmake_build/MTB_LAIRD_BL654_CUSTOM/develop/GCC_ARM
Building Mbed project…
[1/121] Building C object CMakeFiles/mbed6test2.dir/mbed-os/cmsis/CMSIS_5/CMSIS/RTOS2/RTX/Source/rtx_delay.c.obj
FAILED: CMakeFiles/mbed6test2.dir/mbed-os/cmsis/CMSIS_5/CMSIS/RTOS2/RTX/Source/rtx_delay.c.obj
/opt/gcc-arm-none-eabi-9-2019-q4-major/bin/arm-none-eabi-gcc @CMakeFiles/mbed6test2.dir/mbed-os/cmsis/CMSIS_5/CMSIS/RTOS2/RTX/Source/rtx_delay.c.obj.rsp -MD -MT CMakeFiles/mbed6test2.dir/mbed-os/cmsis/CMSIS_5/CMSIS/RTOS2/RTX/Source/rtx_delay.c.obj -MF CMakeFiles/mbed6test2.dir/mbed-os/cmsis/CMSIS_5/CMSIS/RTOS2/RTX/Source/rtx_delay.c.obj.d -o CMakeFiles/mbed6test2.dir/mbed-os/cmsis/CMSIS_5/CMSIS/RTOS2/RTX/Source/rtx_delay.c.obj -c …/…/…/…/mbed-os/cmsis/CMSIS_5/CMSIS/RTOS2/RTX/Source/rtx_delay.c
In file included from …/…/…/…/mbed-os/cmsis/device/RTE/include/RTE_Components.h:23,
from …/…/…/…/mbed-os/cmsis/CMSIS_5/CMSIS/RTOS2/RTX/Source/rtx_core_c.h:30,
from …/…/…/…/mbed-os/cmsis/CMSIS_5/CMSIS/RTOS2/RTX/Source/rtx_lib.h:30,
from …/…/…/…/mbed-os/cmsis/CMSIS_5/CMSIS/RTOS2/RTX/Source/rtx_delay.c:26:
…/…/…/…/mbed-os/cmsis/device/rtos/include/mbed_rtx_conf.h:26:10: fatal error: mbed_rtx.h: No such file or directory
26 | #include “mbed_rtx.h”
| ^~~~~~~~~~~~
compilation terminated.
Even creating a custom target which only inherits from the working NRF52840_DK causes the same issue.
I have expected that the usage of custom_targets.json and mbed-cli 2/cmake is still possible. Is this correct? Has anybody an idea on what’s wrong with my approach?
Best Regards,
Stefan