cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CubeMX CMake project build error

JFisher
Associate
Hello,
I am creating a CMake project using STM32CubeMX 6.13.0 for the STM32U575QGI6Q, but am having trouble with the following error:
 
[1/10] Building ASM object CMakeFiles/rtm.dir/Middlewares/...x/ports/cortex_m33/gnu/src/tx_thread_context_restore.S.obj
FAILED: CMakeFiles/rtm.dir/Middlewares/ST/threadx/ports/cortex_m33/gnu/src/tx_thread_context_restore.S.obj
C:\ARM-NO~1\14EFD8~1.2RE\bin\AR19DD~1.EXE -DDEBUG -DSTM32U575xx -DTX_INCLUDE_USER_DEFINE_FILE -DTX_SINGLE_MODE_NON_SECURE=1 -DUSE_HAL_DRIVER -ID:/code/firmware/rtm/stm32/cmake/stm32cubemx/../../Core/Inc -ID:/code/firmware/rtm/stm32/cmake/stm32cubemx/../../AZURE_RTOS/App -ID:/code/firmware/rtm/stm32/cmake/stm32cubemx/../../Drivers/STM32U5xx_HAL_Driver/Inc -ID:/code/firmware/rtm/stm32/cmake/stm32cubemx/../../Drivers/STM32U5xx_HAL_Driver/Inc/Legacy -ID:/code/firmware/rtm/stm32/cmake/stm32cubemx/../../Middlewares/ST/threadx/common/inc -ID:/code/firmware/rtm/stm32/cmake/stm32cubemx/../../Drivers/CMSIS/Device/ST/STM32U5xx/Include -ID:/code/firmware/rtm/stm32/cmake/stm32cubemx/../../Middlewares/ST/threadx/ports/cortex_m33/gnu/inc -ID:/code/firmware/rtm/stm32/cmake/stm32cubemx/../../Middlewares/ST/threadx/utility/low_power -ID:/code/firmware/rtm/stm32/cmake/stm32cubemx/../../Drivers/CMSIS/Include -mcpu=cortex-m33 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -Wall -Wextra -Wpedantic -fdata-sections -ffunction-sections -O0 -g3 -x assembler-with-cpp -MMD -MP -g -MD -MT CMakeFiles/rtm.dir/Middlewares/ST/threadx/ports/cortex_m33/gnu/src/tx_thread_context_restore.S.obj -MF CMakeFiles\rtm.dir\Middlewares\ST\threadx\ports\cortex_m33\gnu\src\tx_thread_context_restore.S.obj.d -o CMakeFiles/rtm.dir/Middlewares/ST/threadx/ports/cortex_m33/gnu/src/tx_thread_context_restore.S.obj -c D:/code/firmware/rtm/stm32/Middlewares/ST/threadx/ports/cortex_m33/gnu/src/tx_thread_context_restore.S
D:/code/firmware/rtm/stm32/Core/Inc/tx_user.h: Assembler messages:
D:/code/firmware/rtm/stm32/Core/Inc/tx_user.h:271: Error: bad instruction `void App_ThreadX_LowPower_Timer_Setup(unsigned long count)'
D:/code/firmware/rtm/stm32/Core/Inc/tx_user.h:278: Error: bad instruction `void App_ThreadX_LowPower_Enter(void)'
D:/code/firmware/rtm/stm32/Core/Inc/tx_user.h:282: Error: bad instruction `void App_ThreadX_LowPower_Exit(void)'
D:/code/firmware/rtm/stm32/Core/Inc/tx_user.h:286: Error: bad instruction `unsigned long App_ThreadX_LowPower_Timer_Adjust(void)'
ninja: build stopped: subcommand failed.
 
The project is configured with ThreadX middleware, with Low Power mode enabled. This error does not happen if I generate the project for STM32CubeIDE. The difference appears to be the definition "TX_INCLUDE_USER_DEFINE_FILE"; in STM32CubeIDE, it does not seem to be defined for these assembly files, but in the CMake project, it is.
I can work around this by modifying the CMake file, but would prefer not to fight with the STM32Cube tool if I can help it. Alternatively, I can generate a STM32CubeIDE project and maintain the CMake files myself. Any guidance would be appreciated!
 
Thank you,
Jonathan
3 REPLIES 3
Saket_Om
ST Employee

Hello @JFisher 

Could you please share your .ioc file with us? This will help us support you more effectively.

If your question is answered, please close this topic by clicking "Accept as Solution".

Thanks
Omar
Saket_Om
ST Employee

Hello @JFisher 

I reported your issue internally and will get back to you as soon as possible. 

Internal ticket number: 203303 (This is an internal tracking number and is not accessible or usable by customers).

If your question is answered, please close this topic by clicking "Accept as Solution".

Thanks
Omar

Hi Omar,

I've attached the CMake version of the project that yields this error.

Thank you,

Jonathan