cancel
Showing results for 
Search instead for 
Did you mean: 

STM32G431CBU: section `.bss' will not fit in region `RAM'

ValterMatos
Associate II

 

Good morning.
Could anyone tell me about this error and how to resolve it.
C:/ST/STM32CubeIDE_1.19.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.13.3 .rel1.win32_1.0.0.202411081344/tools/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/bin/ld.exe: Oscillo_STM32G431CBU.elf section `.bss' will not fit in region `RAM'
C:/ST/STM32CubeIDE_1.19.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.13.3 .rel1.win32_1.0.0.202411081344/tools/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/bin/ld.exe: region `RAM' overflowed by 54928 bytes
I'm using IDE 1.19 to compile the code for a G431CBU
Grateful

Valter Matos

4 REPLIES 4
mƎALLEm
ST Employee

Hello,

region `RAM' overflowed by 54928 bytes

Maybe you declared a large table in the RAM..

Use const for the table declaration to relocated it into the flash if that table content keeps unchanged in your application 

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.
Andrew Neil
Super User

The key part of the message is:

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

It's telling you that your code uses more RAM than is available on the chip.

Specifically:

region `RAM' overflowed by 54928 bytes

It needs 54,928 more bytes.

The STM32G431CBU has 128K bytes of RAM; your code is using 54K more than that - so about 182K total.

You have 2 choices:

  1. Reduce the amount of RAM your code uses;
  2. Choose a different chip - with >182K RAM.
A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.

It's a relatively small code, without many tables, and I still don't know how to optimize it.


@ValterMatos wrote:

without many tables, 


It's not about the number - it's about the total amount of RAM that they occupy...

 


@ValterMatos wrote:

I still don't know how to optimize it.


Nobody can help you without seeing the code!

How to insert source code

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.