cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H7 and heap location

Francois Tremblay
Associate III
Posted on February 26, 2018 at 19:38

I am porting our application from a STM32F779 to a STM32H753 device. Our application looks to run fin if we have the heap located on the DTCM_RAM  (the whole 128k is reserved for heap allocation).

If the heap is moved to end of AXI-SRAM (last 128Kb) or  SRAM1, our application performs wrong computation.

In all cases, data and bss section are on beginning of AXI-SRAM and stack on SRAM2.

Is there something special about DTCM_RAM that can explain this behavior?

-François

10 REPLIES 10
Posted on May 16, 2018 at 20:26

My experience (impression): D2 SRAM is not enabled on reset and startup in H7 MCU. As mentioned here in this thread, it has to be enabled during run time, via: __HAL_RCC_D2SRAM1_CLK_ENABLE(); etc.

But it means (results in): this SRAM cannot be used for any initialized data (no way to use as .data or .bss). The startup cannot load any data, even a .bss zero memory fill done in startup will fail. This memory becomes just access-able after enabling the clocks and the SRAM2 content will be random (uninitialized). So, you cannot define a region/section in linker script to load something before main() function is called. You can used for buffers but not for malloc: malloc would need some data structures initialized during startup, after reset released. So, I use SRAM2 only as uninitialized buffer regions during run-time, w/o to expect any pre-initialized data on it.