cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H7 will not fit in region `RAM', wrong RAM location

emwp
Associate II

I am using the STM32H753VIHX. I have a large amount of data that does not all fit in RAM. I am trying to allocate some of it to the other RAM such as RAM_D2 and RAM_D3. I seem unable to. Below is the error message I am getting

c:\st\stm32cubeide_1.6.1\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.9-2020-q2-update.win32_1.5.0.202011040924\tools\arm-none-eabi\bin\ld.exe: 170093_stm32h753.elf section `.D3data' will not fit in region `RAM'
 
c:\st\stm32cubeide_1.6.1\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.9-2020-q2-update.win32_1.5.0.202011040924\tools\arm-none-eabi\bin\ld.exe: region `RAM' overflowed by 9952 bytes

it keeps saying region RAM, but I want to allocate to the other location. Does anyone have an example of the proper way to configure the linker file? I added the following to my STM32H753VIHX_RAM.Id file.

.D2data :
  {
    . = ALIGN(4);
    *(.D2data)         /* .rodata sections (constants, strings, etc.) */
    *(.D2data*)        /* .rodata* sections (constants, strings, etc.) */
    . = ALIGN(4);
  } >RAM_D2
  
    .D3data :
  {
    . = ALIGN(4);
    *(.D3data)         /* .rodata sections (constants, strings, etc.) */
    *(.D3data*)        /* .rodata* sections (constants, strings, etc.) */
    . = ALIGN(4);
  } >RAM_D3

I have only made changes to the linker file. Is there anywhere else that I need to make changes, or is there something else that I need to change?

1 ACCEPTED SOLUTION

Accepted Solutions
TDK
Guru

The FLASH linker script is used by default. Delete the one you don't want to ensure it's not being used, or rename it to a text file.

Linker script used is under "MCU GCC Linker" settings.

If you feel a post has answered your question, please click "Accept as Solution".

View solution in original post

5 REPLIES 5

Are you sure it is using the right .LD file?

Are these early enough in the file that your data hasn't already been binned into the RAM section with a wildcard?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

The only other LD file I see is the _FLASH one in the root directory. Would there be others in another location? I tried originally putting it below .rodata, so one of the first, then put it below /DISCARD/, so near the end. Both locations yielded the same result.

I don't know what CubeIDE does, and I don't see the command line in the log. I use GNU/GCC w/make.

You could try renaming the singular "RAM" to some more noteworthy/unique name, then you'd see from the error message whether your file was being used, or not.

It's not clear to me how data would manifest in SRAM without some actual code in startup.s to move it there, and it getting staged in FLASH

I don't have your original or modified files, but like I said it probably isn't early enough. Define your MEMORYs, then have this at the top of SECTIONS

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
TDK
Guru

The FLASH linker script is used by default. Delete the one you don't want to ensure it's not being used, or rename it to a text file.

Linker script used is under "MCU GCC Linker" settings.

If you feel a post has answered your question, please click "Accept as Solution".
emwp
Associate II

Thank you this was the solution for me. I did not realize FLASH was the default. I thought RAM would be the default.