AnsweredAssumed Answered

how to use sdram as a ram used by compiler

Question asked by jones.david.009 on Aug 3, 2015
Latest reply on Aug 3, 2015 by jones.david.009
hi all

i use an external SDRAM in my board. i want to use STEmwin in my program but when i use one of Segger sample in my program an error appear and tells that there is not enough space ( some thing like this"no space .... .ANY" ) in RAM.
So i decide to Set compiler that uses  External SDRAM as  RAM like internal Ram.

i then go to Option->Target and add offchip ram Start=0xd0000000,Size=0x01c000000
 ("my external Sdram size is 0x02000000 32MB and i Use 0x01c00000-0x01e00000 for LTDC layer0 buffer and 0x01e00000-0x02000000 for LTDC layer1")
it  temporarily correct compiler error but when i load programm in MCU an error occures that core is halted

i then do lot of search and all i found was i must init SDRAM Before declaring Variable so i Use System_Init Function Template to initialize SDRAM. i notice that the template mostly use Registers to initialize SDRAM but in some cases to make Delay uses some local variables and exactly in those place system goes to HardFault_Handler.
i then try to initial Stack to use Internal Ram in startup file
Initial_sp EQU 0x20000000+StackSize
result was core is halting(i even could not enter debug mode)
then i try to initialize Those Local Variable in System_init As Global and Attribute them Separately to be in Internal Ram
For example like below
volatile uint32_t tmp __attribute__(at(0x20000000));
the core again halt
i then saw an example in a site that claims to use external ram but i tested it in f429 disco and it wont work (see it's scatter file)
 any help is appreciated