Skip to main content
Graduate
February 12, 2025
Solved

STM32CubeMX CMake project build error

  • February 12, 2025
  • 5 replies
  • 1021 views
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
    This topic has been closed for replies.
    Best answer by Saket_Om

    Hello @OParis 

    The issue has been solved on STM32CubeMX 6.14.0

    5 replies

    Technical Moderator
    February 13, 2025

    Hello @JFisher 

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

    JFisherAuthor
    Graduate
    February 14, 2025

    Hi Omar,

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

    Thank you,

    Jonathan

    Technical Moderator
    February 14, 2025

    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).

    Visitor II
    May 7, 2025

    I am also having this issue. Was there an update on this topic since February?

     

    Thanks

    Olivier

    Super User
    May 7, 2025

    It looks like you've put in your tx_user.h file stuff that should not be there. It can contain #defines but not C code such as function prototypes.

     

    Visitor II
    May 8, 2025

    You are correct Pavel A. 
    The function prototypes are put in tx_user.h by STM32CubeMX when setting THREADX->"Low Power"->"Enable LowPower Support" to "Enabled"

    I am using STM32CubeMX 6.13.0 for device STM32U073KCU6 with MCU Package 1.2.0

    Saket_OmAnswer
    Technical Moderator
    May 8, 2025

    Hello @OParis 

    The issue has been solved on STM32CubeMX 6.14.0