Skip to main content
Associate II
Sep 19, 2024 8:46 PM UTC
Solved

FLASH.ld syntax error when upgrading to CubeMX v6.12.1

Hello,

Since the latest release of CubeMX (6.12.1), I have been encountering syntax errors related to the "FLASH.ld" file. This issue only arises when I generate code while setting the Toolchain/IDE to CMake. I am using STM32H753IIKx. It seems that CubeMX does not specify which RAM to use when setting the Toolchain/IDE to CMake.

I have also included the FLASH.ld file that was generated for your reference.

 

Thanks for your help.

This topic has been closed for replies.
STTwo-32
STTwo-32Best answer
ST Technical Moderator
Dec 2, 2024 3:53 AM UTC

Hello @OmidES 

Issue has been solved on 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.

45 replies

Associate
Nov 25, 2024 9:35 PM UTC

It's been at least TWO MONTHS since this major, show-stopping bug was reported. WTF ST? Get your act together. This is appalling. 

STTwo-32
STTwo-32Best answer
ST Technical Moderator
Dec 2, 2024 3:53 AM UTC

Hello @OmidES 

Issue has been solved on 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.
OmidESAuthor
Associate II
Dec 3, 2024 8:01 AM UTC

Hi,

I still get the same error even with STM32CubeMX V6.13.0.

 

Thanks

STTwo-32
ST Technical Moderator
Dec 3, 2024 8:12 AM UTC

Have you created a new project from the beginning? Please try this.

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.
LPetr.1
Senior
Dec 3, 2024 7:47 AM UTC

Still not fixed for me on Version 6.13.0

I get the following error when trying to build blank project for STM32F407ZGT

 

c:/program files (x86)/gnu arm embedded toolchain/10 2021.10/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe:stm32f407zgtx_flash.ld:56: syntax error
collect2.exe: error: ld returned 1 exit status

 


 The CubeMX generated .ld file:

 

/*
******************************************************************************
**

** File : LinkerScript.ld
**
** Author		: STM32CubeMX
**
** Abstract : Linker script for STM32F407ZGTx series
** 1024Kbytes FLASH and 192Kbytes RAM
**
** Set heap size, stack size and stack location according
** to application requirements.
**
** Set memory bank area and size if external memory is used.
**
** Target : STMicroelectronics STM32
**
** Distribution: The file is distributed “as is,” without any warranty
** of any kind.
**
*****************************************************************************
** @attention
**
** <h2><center>&copy; COPYRIGHT(c) 2019 STMicroelectronics</center></h2>
**
** Redistribution and use in source and binary forms, with or without modification,
** are permitted provided that the following conditions are met:
** 1. Redistributions of source code must retain the above copyright notice,
** this list of conditions and the following disclaimer.
** 2. Redistributions in binary form must reproduce the above copyright notice,
** this list of conditions and the following disclaimer in the documentation
** and/or other materials provided with the distribution.
** 3. Neither the name of STMicroelectronics nor the names of its contributors
** may be used to endorse or promote products derived from this software
** without specific prior written permission.
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
** SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
** OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
**
*****************************************************************************
*/

/* Entry Point */
ENTRY(Reset_Handler)

/* Highest address of the user mode stack */
_estack = ORIGIN() + LENGTH(); /* end of RAM */
/* Generate a link error if heap and stack don't fit into RAM */
_Min_Heap_Size = 0x200; /* required amount of heap */
_Min_Stack_Size = 0x400; /* required amount of stack */

/* Specify the memory areas */
MEMORY
{
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K
CCMRAM (xrw) : ORIGIN = 0x10000000, LENGTH = 64K
FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 1024K
}

/* Define output sections */
SECTIONS
{
 /* The startup code goes first into FLASH */
 .isr_vector :
 {
 . = ALIGN(4);
 KEEP(*(.isr_vector)) /* Startup code */
 . = ALIGN(4);
 } >FLASH

 /* The program code and other data goes into FLASH */
 .text :
 {
 . = ALIGN(4);
 *(.text) /* .text sections (code) */
 *(.text*) /* .text* sections (code) */
 *(.glue_7) /* glue arm to thumb code */
 *(.glue_7t) /* glue thumb to arm code */
 *(.eh_frame)

 KEEP (*(.init))
 KEEP (*(.fini))

 . = ALIGN(4);
 _etext = .; /* define a global symbols at end of code */
 } >FLASH

 /* Constant data goes into FLASH */
 .rodata :
 {
 . = ALIGN(4);
 *(.rodata) /* .rodata sections (constants, strings, etc.) */
 *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
 . = ALIGN(4);
 } >FLASH

 .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
 .ARM : {
 __exidx_start = .;
 *(.ARM.exidx*)
 __exidx_end = .;
 } >FLASH

 .preinit_array :
 {
 PROVIDE_HIDDEN (__preinit_array_start = .);
 KEEP (*(.preinit_array*))
 PROVIDE_HIDDEN (__preinit_array_end = .);
 } >FLASH
 .init_array :
 {
 PROVIDE_HIDDEN (__init_array_start = .);
 KEEP (*(SORT(.init_array.*)))
 KEEP (*(.init_array*))
 PROVIDE_HIDDEN (__init_array_end = .);
 } >FLASH
 .fini_array :
 {
 PROVIDE_HIDDEN (__fini_array_start = .);
 KEEP (*(SORT(.fini_array.*)))
 KEEP (*(.fini_array*))
 PROVIDE_HIDDEN (__fini_array_end = .);
 } >FLASH

 /* used by the startup to initialize data */
 _sidata = LOADADDR(.data);

 /* Initialized data sections goes into RAM, load LMA copy after code */
 .data : 
 {
 . = ALIGN(4);
 _sdata = .; /* create a global symbol at data start */
 *(.data) /* .data sections */
 *(.data*) /* .data* sections */

 . = ALIGN(4);
 _edata = .; /* define a global symbol at data end */
 } > AT> FLASH

 _siccmram = LOADADDR(.ccmram);

 /* CCM-RAM section 
 * 
 * IMPORTANT NOTE! 
 * If initialized variables will be placed in this section,
 * the startup code needs to be modified to copy the init-values. 
 */
 .ccmram :
 {
 . = ALIGN(4);
 _sccmram = .; /* create a global symbol at ccmram start */
 *(.ccmram)
 *(.ccmram*)
 
 . = ALIGN(4);
 _eccmram = .; /* create a global symbol at ccmram end */
 } >CCMRAM AT> FLASH

 
 /* Uninitialized data section */
 . = ALIGN(4);
 .bss :
 {
 /* This is used by the startup in order to initialize the .bss secion */
 _sbss = .; /* define a global symbol at bss start */
 __bss_start__ = _sbss;
 *(.bss)
 *(.bss*)
 *(COMMON)

 . = ALIGN(4);
 _ebss = .; /* define a global symbol at bss end */
 __bss_end__ = _ebss;
 } >

 /* User_heap_stack section, used to check that there is enough RAM left */
 ._user_heap_stack :
 {
 . = ALIGN(8);
 PROVIDE ( end = . );
 PROVIDE ( _end = . );
 . = . + _Min_Heap_Size;
 . = . + _Min_Stack_Size;
 . = ALIGN(8);
 } >

 

 /* Remove information from the standard libraries */
 /DISCARD/ :
 {
 libc.a ( * )
 libm.a ( * )
 libgcc.a ( * )
 }

}

 




Issue has been fixed after creating NEW project from the beggining

STTwo-32
ST Technical Moderator
Dec 3, 2024 9:05 AM UTC

Hello @OmidES @streb2001 @RichardS1 @LPetr.1 @luoqi 

It seems to be solved on my side. I've migrated the file shared by the @OmidES (the one using the STM32CubeMX VB6.12.1) and it seems to be working fine.

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.
Graduate II
Dec 3, 2024 10:07 AM UTC

If it compiles but chooses the wrong RAM then surely it is not fixed?

OmidESAuthor
Associate II
Dec 3, 2024 12:27 PM UTC

Hard to say. In my case, DTCMRAM is not the right RAM for my application.

 

OmidESAuthor
Associate II
Dec 3, 2024 2:00 PM UTC

I think I found a solution to also choose the desired RAM in CubeMX. This has been added in CubeMX v6.13.

To do this, navigate to Tools > Memory Management, where you can select the type of RAM you want to use.

Make sure to enable the following options:
- "Apply Application Regions to Peripherals"
- "Apply Application Regions to Linker Files"
- and check the "Default Data Region" box.

Also, ensure that you delete the existing .ld file in your project folder. Otherwise, the .ld file will not be updated.

I have highlighted the important steps for your attention in the figure below:

 

OmidES_0-1733234315698.png