AnsweredAssumed Answered

Section for external SDRAM STM32F746 GCC

Question asked by hoevener.jan on Sep 27, 2016
Latest reply on Sep 28, 2016 by hoevener.jan

Hey guys,

I have a problem with defining a section for the external SDRAM on the STM32F746-Disco. I red many posts in different forums but I didn't find the way to a working code.

I initialized the SDRAM in the SystemInit() and it's working because I can use it in the main() function without additional initialisation. Afterwords I took the linker script and added a memory entry like followed:

MEMORY
{
FLASH (rx)          : ORIGIN = 0x8000000, LENGTH = 1024K
RAM (xrw)          : ORIGIN = 0x20000000, LENGTH = 320K
SDRAM (xrw)          : ORIGIN = 0xC0000000, LENGTH = 8M
}

and a section entry like this:

...
.sdram_data (NOLOAD) :
{
. = ALIGN(8);
_sdram_data_begin = .;
*(.sdram_data)
*(.sdram_data*)
. = ALIGN(8);
_sdram_data_end = .;
} >SDRAM
...

When I now declare a variable in the main file

const char picture1[480*272*3]__attribute__((section(".sdram_data")));

and want to fill it afterwards with information

picture1[] = {
0x00, 0xFF, 0xFF;
0x00, 0xFF, 0xFF;
0x00, 0xFF, 0xFF;
...
};

I get the error:

../src/main.c:53:1: warning: data definition has no type or storage class
picture1[] = {
^
../src/main.c:53:1: warning: type defaults to 'int' in declaration of 'picture1' -Wimplicit-int
../src/main.c:53:1: error: conflicting types for 'picture1'
../src/main.c:52:12: note: previous declaration of 'picture1' was here
const char picture1480*272*3__attribute__((section(".sdram_data")));

When I declare the variable as followed I don't get an error but it's also not working.

__attribute__((section(".sdram_data")))
const char picture1[] =
{
0x00, 0xFF, 0xFF;
0x00, 0xFF, 0xFF;
0x00, 0xFF, 0xFF;
...
};

I hope anybody of you can help me.

Outcomes