Showing results for 
Search instead for 
Did you mean: 

STM32CubeMX Makefile/CMake generation failure STM32U5*



I am trying to generate a project using STM32CubeMX v6.11.1 Linux using the NUCLEO-U5A5ZJ-Q project template.

I am happy to use either a Makefile or a CMake based build, but unfortunately both have issues.


If I select a Makefile build, and click Generate, the project is created, but the stdout log of STM32CubeMX provides this warning:


No such linker file: /home/user/STM32Cube/Repository//STM32Cube_FW_U5_V1.5.0//Drivers/CMSIS/Device/ST/STM32U5xx/Source/Templates/gcc/linker/STM32U5a5xx_FLASH.ld
No such linker file: /home/user/STM32Cube/Repository//STM32Cube_FW_U5_V1.5.0//Drivers/CMSIS/Device/ST/STM32U5xx/Source/Templates/gcc/linker/STM32U5a5xx_RAM.ld


 If I try to build with make, I see this issue reflected in the build:


arm-none-eabi-gcc build/main.o build/stm32u5xx_it.o build/stm32u5xx_hal_msp.o build/stm32u5xx_nucleo.o build/stm32u5xx_hal_adc.o build/stm32u5xx_hal_adc_ex.o build/stm32u5xx_hal_dma.o build/stm32u5xx_hal_dma_ex.o build/stm32u5xx_hal.o build/stm32u5xx_hal_i2c.o build/stm32u5xx_hal_i2c_ex.o build/stm32u5xx_hal_rcc.o build/stm32u5xx_hal_rcc_ex.o build/stm32u5xx_hal_cortex.o build/stm32u5xx_hal_flash.o build/stm32u5xx_hal_flash_ex.o build/stm32u5xx_hal_gpio.o build/stm32u5xx_hal_exti.o build/stm32u5xx_hal_pwr.o build/stm32u5xx_hal_pwr_ex.o build/stm32u5xx_hal_gtzc.o build/stm32u5xx_hal_icache.o build/stm32u5xx_hal_tim.o build/stm32u5xx_hal_tim_ex.o build/stm32u5xx_hal_pcd.o build/stm32u5xx_hal_pcd_ex.o build/stm32u5xx_ll_usb.o build/stm32u5xx_hal_usart.o build/stm32u5xx_hal_usart_ex.o build/stm32u5xx_hal_uart_ex.o build/stm32u5xx_hal_uart.o build/system_stm32u5xx.o build/sysmem.o build/syscalls.o build/startup_stm32u5a5xx.o  -mcpu=cortex-m33 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -specs=nano.specs -T  -lc -lm -lnosys  -Wl,-Map=build/,--cref -Wl,--gc-sections -o build/adc_capture_prototype.elf
/home/user/bin/gcc-arm-none-eabi-10.3-2021.10/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld: cannot open linker script file --library=c: No such file or directory
collect2: error: ld returned 1 exit status
make: *** [Makefile:191: build/adc_capture_prototype.elf] Error 1


If I instead select a CMake build, the following warning is shown when I hit Generate:


The log from STM32CubeMX shows a similar fault:


2024-06-23 11:21:01,952 [INFO] ConfigFileManager:1503 - The Die is : DIE481
No such linker file: /home/user/STM32Cube/Repository//STM32Cube_FW_U5_V1.5.0//Drivers/CMSIS/Device/ST/STM32U5xx/Source/Templates/gcc/linker/STM32U5a5xx_FLASH.ld
No such linker file: /home/user/STM32Cube/Repository//STM32Cube_FW_U5_V1.5.0//Drivers/CMSIS/Device/ST/STM32U5xx/Source/Templates/gcc/linker/STM32U5a5xx_RAM.ld
2024-06-23 11:21:02,389 [INFO] ToolchainGenerator:486 - [Project Generator] Problem in the project generation
2024-06-23 11:21:02,389 [ERROR] ToolchainGenerator:487 - 
java.lang.StringIndexOutOfBoundsException: begin -1, end 0, length 0
        at java.lang.String.checkBoundsBeginEnd( ~[?:?]
        at java.lang.String.substring( ~[?:?]
        at java.lang.String.substring( ~[?:?]
        at generators.CMakeGenerator.generateCMake( ~[STM32CubeMX:?]
        at convertor.Convertor.generateMakefileProject( ~[STM32CubeMX:?]
        at convertor.Convertor.generateCMake( ~[STM32CubeMX:?]
        at convertor.Convertor.generate( ~[STM32CubeMX:?]
        at convertor.Convertor.convert( ~[STM32CubeMX:?]
        at convertor.Convertor.generate( ~[STM32CubeMX:?]
        at ~[?:?]
        at ~[?:?]
        at ~[?:?]
        at ~[?:?]
2024-06-23 11:21:03,747 [INFO] ConfigFileManager:2923 - mx.scratch is deleted!
2024-06-23 11:21:03,747 [INFO] ProjectBuilder:5002 - Time for Generating toolchain IDE Files: 1852mS.
2024-06-23 11:21:03,747 [ERROR] ProjectBuilder:5008 - Error in Project Generation
2024-06-23 11:21:03,748 [ERROR] ProjectBuilder:985 - Error in Project Generation


It appears that the upstream STM32Cube repository that should contain these files ( does not contain the corresponding linker scripts for this platform. Do you have an estimate when these support will be complete? I have a development board arriving shortly and it would be a shame to not be able to start development because linker scripts are not available.

Thank you for your help.

ST Employee

Hello @audiofish 

Thank you for posting!

Actually, the support for the CMake toolchain in STM32CubeMX V6.11.1 is only for single-context series (mono-core, without Arm® TrustZone®(a)). However, since NUCLEO-U5A5ZJ-Q is based on Arm Cortex-M33 MCU with TrustZone, CMake is not supported in this case.
The support for this feature will be included in the upcoming release that will be published as soon as possible.