cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CubeMX CMake project build error

JFisher
Associate II
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
1 ACCEPTED SOLUTION

Accepted Solutions

Hello @OParis 

The issue has been solved on STM32CubeMX 6.14.0

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.
Saket_Om

View solution in original post

7 REPLIES 7
Saket_Om
ST Employee

Hello @JFisher 

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

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.
Saket_Om
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).

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.
Saket_Om

Hi Omar,

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

Thank you,

Jonathan

OParis
Associate

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

 

Thanks

Olivier

Pavel A.
Super User

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.

 

OParis
Associate

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

Hello @OParis 

The issue has been solved on STM32CubeMX 6.14.0

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.
Saket_Om