2023-12-12 05:15 AM
I am using STM32H747I-DISCO board, I want to use external SDRAM for bss and data region and I called the SDRAM initialization function inside the SystemInit() function and I tried with the debugger point it will go to hard fault when debugger point hit the SDRAM initialization function. and Checked the SDRAM initialization by read and write it is working fine, please anyone suggest how to use external SDRAM for bss and data memory.
2023-12-12 07:58 AM
Why, what does this buy you?
SDRAM is volatile, so your program will be lost on reset. You can store it in flash and load it to SDRAM at program start, but that buys you nothing.
Broadly speaking, you can do this but you need to initialize the SDRAM before you first use it. I would recommend getting a normal working application running which uses SDRAM and then take that initialization and put it into this program.
Similar/duplicate:
2023-12-12 09:32 AM
Look at what exactly is Hard Faulting
There's some chicken-egg situations here, your code in SystemInit() can't be dependent of static structure initialization in to RAM. You usually want to define things as "static const" so they live at fixed addresses in FLASH, and will not be modified by your code.
Watch also things like where your stack pointer (SP) lives. This needs to be in viable memory when you start, so 0x20002000 for example, and not 0xC0100000
Some of ST's own examples basically have a "bare-metal" register level approach to peeking/poking values into RCC, GPIO and FMC
This isn't your board, but an example of that method
More on-point