AnsweredAssumed Answered

Create large objects in STM32F429Disco SRAM

Question asked by honeycutt.matt on Oct 24, 2017
Latest reply on Oct 24, 2017 by Clive One

Hi all,

 

I'm somewhat new to the micro world of development. I am trying to create a fairly large object in the SRAM on the F429Disco.

 

I am using the FMC_SDRAM example provided by ST. It compiles and run fine Out of the box, so I wont clutter up the thread with all that code. 

 

/* Program the SDRAM external device */
SDRAM_Initialization_Sequence(&hsdram, &command);

 

Right after the above code, I try to creating some large arrays by using a new char and a vector.

 

char *pMem = new char[4000000];

for(int i = 0; i< 4000000 - 1; ++i)
{
pMem[i] = 0xAA;
}

delete[] pMem;

 

The above code goes into a hard fault, I notice that the address of the pointer is 0x20000910 which is not in the SRAM region. Therefore, when I try to initialize the object with 0xAA it goes to hard fault.

 

When I try to create a vector, same result vector<char> data(4000000); causes death when I try to initialize.

 

How can I create a large array (block of memory) in the external SRAM? 

 

Thanks in advance!

Outcomes