2025-12-10 3:41 AM - last edited on 2025-12-10 3:43 AM by Andrew Neil
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
Solved! Go to Solution.
2025-12-10 1:07 PM - edited 2025-12-10 1:10 PM
So you have:
#define ILI9488_TFTWIDTH 320
#define ILI9488_TFTHEIGHT 480and
/**
* @brief Buffer storing 4-bit color values for each LCD pixel.
* Each byte represents color information for two adjacent pixels, utilizing 4 bits per pixel
*/
static uint8_t image_buffer[ ILI9488_TFTWIDTH*ILI9488_TFTHEIGHT/2 ] = {0};which becomes
static uint8_t image_buffer[ 320*480/2 ] = {0};320*480/2 = 76800 bytes !
ie, 75K bytes
Which is exactly what @KnarfB said earlier - from the map file.
2025-12-10 3:45 AM - edited 2025-12-10 3:57 AM
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
2025-12-10 3:49 AM - edited 2025-12-10 11:52 AM
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 32K bytes of RAM; your code is using 54K more than that - so about 182K 86K total.
You have 2 choices:
Correction: The chip has only 32K RAM - see post below by @KnarfB
2025-12-10 4:32 AM
It's a relatively small code, without many tables, and I still don't know how to optimize it.
2025-12-10 4:45 AM
@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!
2025-12-10 5:21 AM
@ValterMatos wrote:
It's a relatively small code, without many tables, and I still don't know how to optimize it.
You can saturate the memory with one large table.
Check these tables' sizes..
2025-12-10 5:24 AM
> It's a relatively small code, without many tables, and I still don't know how to optimize it.
Then you can probably share it here.
Because a 54928 bytes overflow is a lot - but you can "achieve" it with one single definition ...
Or the map file, it it's enabled and the toolchain created one.
2025-12-10 6:37 AM
2025-12-10 6:53 AM
DMA doesn't consume RAM per se.
You just configure previously defined buffers as source or target addresses.
On a loosely related note, the recently displayed message "Virus scan in progress..." for attachments suggests no such scan had been in place before ...
2025-12-10 6:54 AM
Unfortunately, your project is stuck in the virus scan:
See: Attachments stuck on "virus scan in progress..."
@ValterMatos wrote:It's a relatively small code
So just post the code, then?
See: How to insert source code
Does the build generate a Linker Listing (aka "map") file?
Does the CubeIDE Build Analyzer work?
https://forum.digikey.com/t/utilizing-the-build-analyzer-in-stm32cubeide/3882