Incomplete project generation from example
I tried to create a project based on an existing STM32CubeC5 example and build it from command line.
I am working on Linux and had the same issue on Ubuntu and Fedora.
I opened CubeMX2 (Version: 1.1.1) and selected the “freertos_low_power.ioc2” under “STM32CubeC5/examples/middleware/freertos/low_power/NUCLEO-C562RE”, saved it to my new project folder as recommend via “save as” and tried to generate the CMake project.
Direct at generation start I got the error message shown below, but a “good looking” project folder was still generated.
Project extraction failed:
=========================================================
Example Path: /home/lecd/devel/STM32CubeC5/examples/middleware/freertos/low_power/NUCLEO-C562RE/freertos_low_power.ioc2
Project Name: low_power
Board Name: NUCLEO-C562RE
Format: CMake
Project Directory: /home/lecd/devel/stm32c5_demo
SW Pack Root: /home/lecd/devel/STM32CubeC5
Extract STM32CubeMX2 project with the selected format: false
Copy Only Dependencies: true
Exact Match Project Name: true
=========================================================
[ERROR] No CMake project for this example, please select another format. Available formats for this example are: ["ewarm", "open-cmsis", "cmake"]
{"status":"error","messages":{"errors":["No CMake project for this example, please select another format. Available formats for this example are: [\"ewarm\", \"open-cmsis\", \"cmake\"]"],"warnings":[],"infos":[]}}
The following CMake config looked fine:
[0]lecd@lecd:~/devel/stm32c5_demo/freertos_lowpower_test_cmake/build$ cmake -G Ninja -DCMAKE_BUILD_TYPE=debug_GCC_NUCLEO-C562RE -DTOOLCHAIN_FILE=GCC.14.3.1.cmake ..
-- The C compiler identification is GNU 14.2.1
-- The CXX compiler identification is GNU 14.2.1
-- Configuring done (1.4s)
-- Generating done (0.1s)
-- Build files have been written to: /home/lecd/devel/stm32c5_demo/freertos_lowpower_test_cmake/build
When I tried to run “ninja” I got the following error:
/home/lecd/devel/stm32c5_demo/freertos_lowpower_test_cmake/main.c: In function 'background_task_entry':
/home/lecd/devel/stm32c5_demo/freertos_lowpower_test_cmake/main.c:140:30: error: 'NOTIFICATION_VALUE_UNKNOWN' undeclared (first use in this function)
140 | uint32_t ulNotifiedValue = NOTIFICATION_VALUE_UNKNOWN;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
/home/lecd/devel/stm32c5_demo/freertos_lowpower_test_cmake/main.c:140:30: note: each undeclared identifier is reported only once for each function it appears in
/home/lecd/devel/stm32c5_demo/freertos_lowpower_test_cmake/main.c:155:14: error: 'NOTIFICATION_VALUE_SUCCESS' undeclared (first use in this function)
155 | case NOTIFICATION_VALUE_SUCCESS:
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
/home/lecd/devel/stm32c5_demo/freertos_lowpower_test_cmake/main.c:160:14: error: 'NOTIFICATION_VALUE_ERROR' undeclared (first use in this function)
160 | case NOTIFICATION_VALUE_ERROR:
| ^~~~~~~~~~~~~~~~~~~~~~~~
[35/45] Building C object CMakeFiles/freertos_lowpower_test.dir/stm32c5xx_drivers/hal/stm32c5xx_hal_flash_itf.c.obj
ninja: build stopped: subcommand failed.
Comparing the generated folder with the example it turned out that the “mx_freertos_app.{c,h}” files are simply missing the actual example application code.
After porting the application code over the build worked just fine.
Questions:
- Is the first error during generation a real problem and if so, when will it get fixed?
- Is the missing app code a result of the initial generation error, a separate issue or designed behavior?
- When (if ever) will it be possible to transfer board or MCU config to a different compatible board or MCU in CubeMX2?
