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

58 REPLIES 58
LCE
Principal II

Many "medium" sized buffers... it all adds up!

Don't forget that u16 takes 2 bytes and so on...

So you got 2 channels, each with:

uint16_t waveform_raw_adc[512]

uint32_t waveform_display[480]

double fft_amplitude[64];

int32_t fft_frequency[64];

= 3712 bytes / channel

How many "Oscilloscope" do you declare?

If I'm not wrong Oscilloscope struct is consuming ~8000 bytes :

waveform_raw_adc[]: 512 *2 * 2 = 2,048 bytes
waveform_display[]: 480 *4 * 2 = 3,840 bytes
fft_amplitude[]: 128/2 * 8 * 2 = 1,024 bytes
fft_frequency[]: 128/2 * 8 * 2 = 1,024 bytes

I don't see where the RAM is consuming that extra 54928 bytes!

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

@ValterMatos again, have you examined the map file, and/or used the Build Analyzer?

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.

Oscilloscope is declared only once.
I haven't examined the map yet and haven't used the Build Analyzer.
I've already examined all the code and haven't found where there's an increase of 50K in RAM usage.
By my estimates, it wouldn't reach 20K in total.
Thank you.

/*
 * sprites.c
 *
 *  Created on: 3 maj 2024
 *      Author: Dominik
 */

#include "sprites.h"
#include "ILI9488.h"



const uint8_t trigRisingIcon[15][9] = {
    {0     , 0     , 0     , 0     , WHITE , WHITE , WHITE , WHITE , WHITE},
    {0     , 0     , 0     , 0     , WHITE , 0     , 0     , 0     , 0     },
    {0     , 0     , 0     , 0     , WHITE , 0     , 0     , 0     , 0     },
    {0     , 0     , 0     , 0     , WHITE , 0     , 0     , 0     , 0     },
    {0     , 0     , 0     , 0     , WHITE , 0     , 0     , 0     , 0     },
    {0     , 0     , 0     , 0     , WHITE , 0     , 0     , 0     , 0     },
    {0     , 0     , 0     , WHITE , WHITE , WHITE , 0     , 0     , 0     },
    {0     , 0     , WHITE , WHITE , WHITE , WHITE , WHITE , 0     , 0     },
    {0     , WHITE , WHITE , WHITE , WHITE , WHITE , WHITE , WHITE , 0     },
    {0     , 0     , 0     , 0     , WHITE , 0     , 0     , 0     , 0     },
    {0     , 0     , 0     , 0     , WHITE , 0     , 0     , 0     , 0     },
    {0     , 0     , 0     , 0     , WHITE , 0     , 0     , 0     , 0     },
    {0     , 0     , 0     , 0     , WHITE , 0     , 0     , 0     , 0     },
    {0     , 0     , 0     , 0     , WHITE , 0     , 0     , 0     , 0     },
    {WHITE , WHITE , WHITE , WHITE , WHITE , 0     , 0     , 0     , 0     }
};

const uint8_t arrowUpDown[15][8] = {
    {0     , 0     , 0     , WHITE , 0     , 0     , 0     , 0},
    {0     , 0     , WHITE , WHITE , WHITE , 0     , 0     , 0},
    {0     , WHITE , WHITE , WHITE , WHITE , WHITE , 0     , 0},
    {WHITE , WHITE , WHITE , WHITE , WHITE , WHITE , WHITE , 0},
	{0     , 0     , WHITE , WHITE , WHITE , 0     , 0     , 0},
    {0     , 0     , WHITE , WHITE , WHITE , 0     , 0     , 0},
    {0     , 0     , WHITE , WHITE , WHITE , 0     , 0     , 0},
    {0     , 0     , WHITE , WHITE , WHITE , 0     , 0     , 0},
    {0     , 0     , WHITE , WHITE , WHITE , 0     , 0     , 0},
    {0     , 0     , WHITE , WHITE , WHITE , 0     , 0     , 0},
    {0     , 0     , WHITE , WHITE , WHITE , 0     , 0     , 0},
    {WHITE , WHITE , WHITE , WHITE , WHITE , WHITE , WHITE , 0},
    {0     , WHITE , WHITE , WHITE , WHITE , WHITE , 0     , 0},
    {0     , 0     , WHITE , WHITE , WHITE , 0     , 0     , 0},
    {0     , 0     , 0     , WHITE , 0     , 0     , 0     , 0}
};

const uint8_t arrowLeftRight[7][15] = {
    {0     , 0     , 0     , WHITE , 0     , 0     , 0     , 0     , 0     , 0     , 0     , WHITE , 0     , 0     , 0},
    {0     , 0     , WHITE , WHITE , 0     , 0     , 0     , 0     , 0     , 0     , 0     , WHITE , WHITE , 0     , 0},
    {0     , WHITE , WHITE , WHITE , WHITE , WHITE , WHITE , WHITE , WHITE , WHITE , WHITE , WHITE , WHITE , WHITE , 0},
    {WHITE , WHITE , WHITE , WHITE , WHITE , WHITE , WHITE , WHITE , WHITE , WHITE , WHITE , WHITE , WHITE , WHITE , WHITE},
    {0     , WHITE , WHITE , WHITE , WHITE , WHITE , WHITE , WHITE , WHITE , WHITE , WHITE , WHITE , WHITE , WHITE , 0},
    {0     , 0     , WHITE , WHITE , 0     , 0     , 0     , 0     , 0     , 0     , 0     , WHITE , WHITE , 0     , 0},
    {0     , 0     , 0     , WHITE , 0     , 0     , 0     , 0     , 0     , 0     , 0     , WHITE , 0     , 0     , 0}
};

This architecture consumes little RAM.


@ValterMatos wrote:

/* Memories definition */
MEMORY
{
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 32K
FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 128K
}

You've defined the 'RAM' region to be only 32K ?

Edit: See post below by @KnarfB - 32K is correct.

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.

You've defined the 'RAM' region to be only 32K ?

STM32G431CBU:

  • 22 Kbytes of SRAM, with hardware parity check implemented on the first 16 Kbytes
  • Routine booster: 10 Kbytes of SRAM on instruction and data bus, with hardware parity check (CCM SRAM)

make (only) 32K in total.

hth

KnarfB

The best place to look for ram usage is in your .map file. 

 

If a reply has proven helpful, click on Accept as Solution so that it'll show at top of the post.
CAN Jammer an open source CAN bus hacking tool
CANableV3 Open Source


@KnarfB wrote:

make (only) 32K in total.


So it is!

I misread the Ordering Info earlier.

I've edited earlier posts with corrections.

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.