Skip to main content
Sylex
Associate
October 6, 2024
Solved

STMCubeMX generate errors in the ld script (Toolchain/IDE : Makefile)

  • October 6, 2024
  • 4 replies
  • 1376 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

 

This topic has been closed for replies.
Best answer by STTwo-32

Hello @Sylex 

Thanks again for sharing this with us. This behavior has been solved on the last version of the STM32CubeMX V6.13.0.

Best Regards.

STTwo-32

4 replies

STTwo-32
ST Technical Moderator
October 6, 2024

Bonjour @Sylex et bienvenue sur la communauté de ST :smiling_face_with_smiling_eyes:.

I think that this is a known regression that i have escalated for correction on the comming releases. Take a look at this post for more details.

Best Regards.

STTwo-32 

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.
Sylex
SylexAuthor
Associate
October 6, 2024

So, if I well understand, I must regress CubeMX  to version 6.12.0 !

Why ST is pushing release without serious test? Does STM consider us (the developers) to be the beta testers?

STTwo-32
STTwo-32Best answer
ST Technical Moderator
December 2, 2024

Hello @Sylex 

Thanks again for sharing this with us. This behavior has been solved on the last version of the STM32CubeMX V6.13.0.

Best Regards.

STTwo-32

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.
Sylex
SylexAuthor
Associate
December 2, 2024

Tested and fixed, thanks