cancel
Showing results for 
Search instead for 
Did you mean: 

Create a variable in SDRAM

RMasi.19
Associate II

Hi i have configured the FMC and can read and write in SDRAM extern, begin in 0xC0000000, i now want create a variable in this SDRAM, then i define:

uint32_t myFrameBuffer[65280] __attribute__((section(".sdram_data"))) = {0};
but when i see the debugger direction of myFrameBuffer is 0x2000000C,

I have intent also with these:

uint32_t myFrameBuffer[65280] __attribute__((section(".mySection")));

and in .ld file i write inside of .section, this :

.mySection :

{

. = 0xC0000000; // Dirección de inicio de la RAM externa

*(.mySection)

} >EXT_RAM

but follow the direction in 0x2000000C, How can make for what

myFrameBuffer begin in the direction 0xC0000000 ?

3 REPLIES 3
TDK
Guru

If you don't need to initialize it, leave the linker along and define it explicitly.

uint32_t* myFrameBuffer = (uint32_t*) 0xC0000000;

 

If you feel a post has answered your question, please click "Accept as Solution".

Hi, thanks i can see now MyFrameBuffer in 0xC0000000 but no can write here, for example:

 

uint32_t* myFrameBuffer = (uint32_t*) 0xC0000000;

//no write either in direction 0xC0000000
memcpy(&myFrameBuffer, &RGB565_480x272, 65280 * sizeof(uint32_t));
//yes, write in direction 0xC0000000
memcpy(0xC0000000, &RGB565_480x272, 65280 * sizeof(uint32_t));
//compiler error
MyFrameBuffer[0]=0;

 

 Also, i no can asign data a MyFrameBuffer[0]=0;  MyFrameBuffer[1]=1; etc, compiler error give, why ? 

error: 'MyFrameBuffer' undeclared (first use in this function); did you mean 'myFrameBuffer'?

 

TDK
Guru

In order to write to SDRAM memory, the SDRAM needs to be properly configured. Did you do that somewhere? You said you configured the FMC, but if you can't write there, it's not properly configured. Is this a custom board?

> Also, i no can asign data a MyFrameBuffer[0]=0;  MyFrameBuffer[1]=1; etc, compiler error give, why ? 

> error: 'MyFrameBuffer' undeclared (first use in this function); did you mean 'myFrameBuffer'?

Variables are case sensitive.

If you feel a post has answered your question, please click "Accept as Solution".