cancel
Showing results for 
Search instead for 
Did you mean: 

Max heap size and allocating memory

wojdembi
Associate
Posted on April 24, 2015 at 19:12

Hi!

I have STM32F407VET6 MCU with 192kB RAM. I need allocate 150kB for storing image after processing data. However I can't allocate such big array. I though I should increase heap size, but I can't increase it more than 120~130kB... I don't know why, my processor have 192kB RAM so what I am doing wrong?

#stm32-heap-sram-allocate-memory
3 REPLIES 3
AvaTar
Lead
Posted on April 24, 2015 at 19:55

Download the reference manual and/or the datasheet for the STM32F407, and read the section(s) about the memory, it's layout and it's properties.

That explains why you can't allocate it at once.

Posted on April 24, 2015 at 20:27

I don't know why, my processor have 192kB RAM so what I am doing wrong?

http://www.merriam-webster.com/dictionary/discontinuous

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
jpeacock
Associate II
Posted on April 24, 2015 at 22:02

That 192KB is divided into three regions: CCM is the first 64KB, and cannot be used for DMA; SRAM1 is the next 112KB, cached and DMA capable; and last is SRAM2, a 16KB non-cached DMA capable region.

You can allocate 150KB for an image, providing you don't use DMA since it will overlap into the CCM area.  But you have to make sure all other program data, stack and heap fit in the remaining 42KB.  From your description your other requirements take too much RAM.

What does your loader map show for memory allocation?

  Jack Peacock