cancel
Showing results for 
Search instead for 
Did you mean: 

.elf section `.bss' will not fit in region `RAM'

Jeff Teng
Associate II

Hello everyone,

I am trying to deploy ML model to microcontrollers and I have two boards of STM32L4R9I-Discovery​ and STM32H7B3I-Discovery. The experiments and related results are shown below:

0693W00000Czv2EQAR.jpgI use TFLite Micro and STM32Cube.AI runtime to profile my ML model and then compile on two different boards. The hardware resource related to these two boards are provided and STM32H7B3I is a bigger one. However, it's strange that I can successively get the results on smaller board (STM32L4R9I) but build fail on a bigger one (STM32H7B3I) with the following error:

.../arm-none-eabi/bin/ld.exe: *****.elf section `.bss' will not fit in region `RAM'

​.../arm-none-eabi/bin/ld.exe: region `RAM' overflowed by 251112 bytes

Could anyone provide some suggestions about how to address this issue? Thank you very much.

​Best regards,

Jeff

1 ACCEPTED SOLUTION

Accepted Solutions
TDK
Guru

I'm not familiar with STM32Cube.AI. It is possible it requires two separate sections here for some reason. If it were a regular project, you could simply swap the names of those two.

> I have tried to increase the length of RAM in "STM32H7B3LIHXQ_RAM.ld" and then built again, but the length of RAM in "STM32H7B3I_ST_MCU2.map" doesn't change.

Are you sure it's using that linker script? Look in the command line output when you build to see what it uses. The default in many cases is the FLASH linker script.

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

View solution in original post

4 REPLIES 4
TDK
Guru

Go into the STM32H7B3I linker file and figure out what section "RAM" points to. You may be able to change the size by locating it somewhere else. See the memory map in the refence manual for available spaces, specifically SRAM1-3.

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

Hello TDK,

Thank you very much for your reply. I am a novice of microcontrollers. Based on your suggestion, I have checked "STM32H7B3LIHXQ_RAM.ld" and found the following information:

MEMORY

{

 RAM_EXEC (xrw) : ORIGIN = 0x24000000, LENGTH = 1024K

 RAM (xrw)   : ORIGIN = 0x20000000, LENGTH = 128K

 AHB_SRAM (xrw) : ORIGIN = 0x30000000, LENGTH = 128K

}

The part of RAM is actually not enough. Based on the reference manual, SRAM1-3 have 256KB, 384KB and 384KB, respectively, and I guess it is the part of RAM_EXEC. And I have also checked "STM32H7B3I_ST_MCU2.map" and got the following information:

Memory Configuration

Name       Origin       Length       Attributes

FLASH      0x08000000     0x00200000     xr

RAM       0x20000000     0x00020000     xrw

AXI_SRAM     0x24000000     0x00100000     xrw

AHB_SRAM     0x30000000     0x00020000     xrw

*default*    0x00000000     0xffffffff

It is strange that the name of RAM_EXEC is changed to AXI_SRAM. I have tried to increase the length of RAM in "STM32H7B3LIHXQ_RAM.ld" and then built again, but the length of RAM in "STM32H7B3I_ST_MCU2.map" doesn't change.

Could you provide more information about how to address this issue? I also attach these two files as references. Thank you very much!

Best regards,

Jeff​

TDK
Guru

I'm not familiar with STM32Cube.AI. It is possible it requires two separate sections here for some reason. If it were a regular project, you could simply swap the names of those two.

> I have tried to increase the length of RAM in "STM32H7B3LIHXQ_RAM.ld" and then built again, but the length of RAM in "STM32H7B3I_ST_MCU2.map" doesn't change.

Are you sure it's using that linker script? Look in the command line output when you build to see what it uses. The default in many cases is the FLASH linker script.

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

Hi TDK,

You are amazing. After checking, it actually uses the FLASH linker script. And after I swap the names, it is successfully built.

Thank you very much for your useful instructions!

Best regards,

Jeff