2023-01-27 08:41 AM
Have a problem with write Scatter-Loading Description File for STM32H743 (arm keil).
I need to map SDRAM memory.
Regular I do it like:
RW_RAM1 0xD0000000 0x00800000 { ; fmc bank 2
*(SDRAM)
}
On all other MCU's it's work perfect, but not for stm32H7.
It's fail on BX R0 command from startup file:
LDR R0, =SystemInit
BLX R0
LDR R0, =__main
BX R0 //after this command
2023-02-07 02:40 AM
Hello @AOrlo.2
Could you share a screenshot of your faults state using CubeProgrammer (in hot plug mode) or on Keil using Faults report?
You may refer to configuration 6 using scatter file remapping SDRAM.
X-CUBE-PERF-H7 - STM32H7 performance software expansion for STM32Cube (AN4891) - STMicroelectronics
Hope this help!
Firas
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2023-02-07 02:46 AM
Have a Hard Fault Handler that outputs actionable information.
Make sure the FPU is enabled.
Look at what gets moved or loaded in SDRAM
Makes sure the SDRAM is initialized in SystemInit() not later in main()
2023-02-07 03:24 AM
Hello,
Some video of debug from start to error (with registers and call stack):
With Faults Report panel
The SDRAM is still not initialized, but just for debuging, I don't call and don't use this memory in code. So on this state, compiler don't try to create any initialized(zeroed) memory in SDRAM.
I just want to create region.
2023-02-07 05:39 AM
Hi again @AOrlo.2,
It appears that the linker has placed some variables in the SDRAM memory region starting at address 0xD0000000.
You can check the map file to find out what is located in this region.
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2023-02-07 06:07 AM
From map file:
Execution Region RW_RAM1 (Exec base: 0xd0000000, Load base: 0x0800e9c0, Size: 0x00000000, Max: 0x00800000, ABSOLUTE)
**** No section assigned to this execution region ****
2023-02-07 06:10 AM
From a map file:
Execution Region RW_RAM1 (Exec base: 0xd0000000, Load base: 0x0800e9c0, Size: 0x00000000, Max: 0x00800000, ABSOLUTE)
**** No section assigned to this execution region ****
2023-02-07 06:28 AM
Ok, I recheck it now...
If no section assigned to 0xd0000000, no errors.
I move FMC&SDRAM initialization to SystemInit().
Add some variable to sdram, and it go to error.
If I use sdram by absolut adress like:
uint32_t *bufersdram = (uint32_t *) 0xD0000000; //it's work
uint16_t bufersdram[10] __attribute__ ((section("SDRAM"))); //go to error after SystemInit()
2023-02-07 07:45 AM
Is it possible to run a simple test in order to read/write SDRAM after SystemInit() execution?
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2023-02-07 08:48 AM
If I use declaration like uint32_t *bufersdram = (uint32_t *) 0xD0000000;
So I can write and read it.
My test before main loop:
uint32_t *bufersdram = (uint32_t *) 0xD0000000;
HAL_StatusTypeDef hal_stat = HAL_OK;
int i;
for(i=0;i<16;i++){
bufersdram [i]=i;
}
for(i=0;i<16;i++){
hal_stat+=(i != bufersdram [i]);
if(hal_stat! = HAL_OK)
{
printf("SDRAM Error");
break;
}
}