2023-12-11 09:47 AM
I am using STM32H747I-DISCO board where the stack and heap memory allocated in SRAM , but I want to use external SDRAM as stack and heap memory, can any one please help me how to configure external SDRAM as main data memory instead of SRAM.
2023-12-11 09:57 AM
You don't want to use it for stack. You want to use TCM memory for stacks so as not to bog down everything with the highest latency memory available.
For HEAP you're going to have to clean up syscalls.c so that _sbrk() allocator functions properly and has high/low water marks in SDRAM for the heap, and not use the stack pointer (SP) as the high water mark, as it's in an entirely different memory region/space.
You should ideally bring up external memories in SystemInit() so they can be used by the run-time and constructors.
2023-12-11 09:03 PM
Instead of SRAM I want to use external SDRAM in my application, how to change it in program level please suggest with some example.
2023-12-12 09:15 AM
You'd want to bring up the memory, think Clock, GPIO, FMC/SDRAM peripheral in SystemInit(), this is somewhat antithetical to HAL/CubeMX, but it's the way it's supposed to be done, per ARM/CMSIS and decades of precedence.
Modify startup.s to address the different region, and copy the initialization.
Modify the Linker Script (.LD) to describe the SDRAM section, what lives in it, and the "} >SDRAM AT> FLASH"
Create symbols for the memory within the SDRAM, and the location the initialization data staged in FLASH.
See how CCMRAM is dealt with here.. https://github.com/STMicroelectronics/STM32CubeF4/blob/master/Projects/STM324x9I_EVAL/Examples/ADC/ADC_TriggerMode/STM32CubeIDE/STM32F429NIHX_FLASH.ld
I could write you some code, but there's some cost to doing that.
2023-12-12 09:33 AM
Back linking to your other thread on this topic area. https://community.st.com/t5/stm32-mcus-embedded-software/how-to-use-sdram-for-bss-and-data-region/td-p/618725