CubeAI generates wrong relative paths in CMake projects
- February 3, 2026
- 2 replies
- 321 views
Hi all,
this issue is related to: https://community.st.com/t5/stm32cubemx-mcus/cmake-project-generation-with-cubemx-cubeai-fail/m-p/770680/highlight/true#M31054. , where it was solved by updating from STM32CubeMX V6.12.0 to STM32CubeMX V6.13.0. However, I have STM32CubeMX V6.16.1, so the error might have reappeared.
Background: I try two write code for an STM32N6 and use a CMake project for this. For the setup, I used the following tutorial: https://community.st.com/t5/stm32-mcus/how-to-debug-the-stm32n6-using-vs-code/ta-p/833499 and I can compile + flash the code and get a blinking LED, so the CMake project itself is working correctly.
However, when I export a neural network to the Application using CubeAI, CubeMX generates wrong relative paths in Appli/mx-generate.cmake. More specifically, all paths related to CubeAI have one "../" more than needed. Example:
----------------
set(ST_Src
${CMAKE_CURRENT_SOURCE_DIR}/../../Middlewares/ST/AI/Npu/ll_aton/ll_aton_osal_threadx.c
----------------
Correct would be:
----------------
set(ST_Src
${CMAKE_CURRENT_SOURCE_DIR}/../Middlewares/ST/AI/Npu/ll_aton/ll_aton_osal_threadx.c
.....
----------------
As a result, when gcc compiles the code, it throws multiple errors like:
----------------
[build] CMake Error at mx-generated.cmake:98 (target_sources):
[build] Cannot find source file:
[build]
[build] ...../Middlewares/ST/AI/Npu/ll_aton/ll_aton_osal_threadx.c
----------------
I appended the .ioc that generated the code.
Do you have an idea what is the cause of this error and how it can be avoided?
Best,
devjalx
