Showing results for 
Search instead for 
Did you mean: 

Help to create large buffers in RAM

Associate III
Posted on August 12, 2013 at 21:48

Hello guys,

I need some help. I want to create a large buffer in the sram and I'm having some problems with the compiler. I want to use the 112KB SRAM memory (pag 52 - RM0090) for my buffer. But when I want to create a buffer of 35000Bytes I get this error: CoIDE errors: [...]/arm-none-eabi/bin/ld.exe: uIP 1.elf section `.co_stack' will not fit in region `ram' [...]/arm-none-eabi/bin/ld.exe: region `ram' overflowed by 3232 bytes After search and read a lot I found a couple of helpful topics, like this one. The thing is that my linker looks different and, as I don't know anything about lkr files, I don't know what to do. This is my lkr.

OUTPUT_FORMAT (''elf32-littlearm'', ''elf32-bigarm'', ''elf32-littlearm'')
/* Internal Memory Map*/
rom (rx) : ORIGIN = 0x08000000, LENGTH = 0x00100000
ram (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00020000
ram1 (rwx) : ORIGIN = 0x10000000, LENGTH = 0x00010000
_eram = 0x20000000 + 0x00020000;
/* Section Definitions */ 
.text : 
KEEP(*(.isr_vector .isr_vector.*)) 
*(.text .text.* .gnu.linkonce.t.*) 
*(.glue_7t) *(.glue_7) 
*(.rodata .rodata* .gnu.linkonce.r.*) 
} > rom
.ARM.extab : 
*(.ARM.extab* .gnu.linkonce.armextab.*)
} > rom
__exidx_start = .;
.ARM.exidx :
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
} > rom
__exidx_end = .;
. = ALIGN(4); 
_etext = .;
_sidata = .; 
.data : AT (_etext) 
_sdata = .; 
*(.data .data.*) 
. = ALIGN(4); 
_edata = . ;
} > ram
/* .bss section which is used for uninitialized data */ 
.bss (NOLOAD) : 
_sbss = . ; 
*(.bss .bss.*) 
. = ALIGN(4); 
_ebss = . ; 
} > ram
/* stack section */
.co_stack (NOLOAD):
. = ALIGN(8);
*(.co_stack .co_stack.*)
} > ram
. = ALIGN(4); 
_end = . ; 

And I use the same declaration as


volatile uint8_t buffer[35000] __attribute__((section(''.buffram'')));

I'm very confused because I know I don't have a buffram section defined in my lkr. So I used this other declaration:

volatile uint8_t buffer[35000] __attribute__((section(''.co_stack''))); 

with same results. So please, does anyone can help me to create a buffer as big as possible? Best Regards! #stm32f4
Posted on August 12, 2013 at 22:30

Are you sure it's using this linker script? They usually have a .ld extension.

You should review the .MAP file to understand what memory is actually being used, and why there appears to be less RAM available than you want.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Associate III
Posted on August 13, 2013 at 01:02

Solved! I kept reading with more atention and I saw that in my linker file, the ram of 128KB is defined as .data, so I've just defined: 

uint8_t mp3Buffer[100000] __attribute__ ((section(''.data'')));

and it works.

As always, thank you clive1. You are always disposed to help and I really appreciate it.