Associate
October 6, 2024
Solved
STMCubeMX generate errors in the ld script (Toolchain/IDE : Makefile)
- October 6, 2024
- 2 replies
- 1326 views
Hi everybody,
I found a bug in STMCubeMX in the way it generates .ld scripts.
Context:
- STMCubeMX V 6.12.1 (linux)
- EVK : NUCLEO-F446RE
- Toolchain/IDE : Makefile
- arm-none-eabi-gcc (GNU Arm Embedded Toolchain 10.3-2021.10) 10.3.1 20210824 (release)
Problem:
The STM32F446RE Tx_FLUSH.ld file generated by STMCubeMX contains several errors that do not allow a link to be made correctly using Makefile.
Here are the difference :
Notice:
- the STM32F446RETx_FLASH.ld.CubeMx is the one generated by STMCubeMX
- the STM32F446RETx_FLASH.ld is the corrected one
They are both stored in the attached zip.
diff -rup ./STM32F446RETx_FLASH.ld.CubeMx ./STM32F446RETx_FLASH.ld
--- ./STM32F446RETx_FLASH.ld.CubeMx 2024-10-06 08:43:28.775227144 +0200
+++ ./STM32F446RETx_FLASH.ld 2024-10-06 08:43:23.579187576 +0200
@@ -53,7 +53,7 @@
ENTRY(Reset_Handler)
/* Highest address of the user mode stack */
-_estack = ORIGIN() + LENGTH(); /* end of RAM */
+_estack = ORIGIN(RAM) + LENGTH(RAM); /* end of RAM */
/* Generate a link error if heap and stack don't fit into RAM */
_Min_Heap_Size = 0x600; /* required amount of heap */
_Min_Stack_Size = 0x400; /* required amount of stack */
@@ -143,7 +143,7 @@ SECTIONS
. = ALIGN(4);
_edata = .; /* define a global symbol at data end */
- } > AT> FLASH
+ } >RAM AT> FLASH
/* Uninitialized data section */
@@ -160,7 +160,7 @@ SECTIONS
. = ALIGN(4);
_ebss = .; /* define a global symbol at bss end */
__bss_end__ = _ebss;
- } >
+ } >RAM
/* User_heap_stack section, used to check that there is enough RAM left */
._user_heap_stack :
@@ -171,7 +171,7 @@ SECTIONS
. = . + _Min_Heap_Size;
. = . + _Min_Stack_Size;
. = ALIGN(8);
- } >
+ } >RAM
