2018-08-18 11:53 AM
Hi,
I have some problems with setting up the virtual EEPROM on an stm32f405vgt6. I did not adjust the linker script and run into a hard fault. What I found out is, that the memory region of the flash, which I wanted to use for the virtual EEPROM, is already used by the microcontroller itself, such that I have to adjust the linker script. The problem is now, that I need sector 2 and 3 of the flash for the two 16kByte pages i want to use and this two pages are in between the flash and not at the end of the flash. So I need to adjust the linker script, such that it reserves me memory of sector 2 and 3, but I dont know how to achieve that.
What I imagine to do is something like this:
MEMORY
{
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K
CCMRAM (rw) : ORIGIN = 0x10000000, LENGTH = 64K
FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 32k
EMULATED_EEPROM (rwx) : ORIGIN = 0x8008000 LENGTH=2*16k
FLASH (rx) : ORIGIN = 0x8008000+2*16k, LENGTH = 1024k-(32k+2*16k)
}
Such that I can split up the flash around my memory I use for the virtual EEPROM. How can I achieve that?
Datasheet:
https://www.mouser.ch/datasheet/2/389/stm32f405rg-956214.pdf
2018-08-18 02:56 PM
Correct you need to create a hole that the linker doesn't use.
The three flash regions would need to be uniquely named, with the vector table directed into the first.
FLASHBOOT (rx) : ORIGIN = 0x8000000, LENGTH = 32K
EMULATED_EEPROM (rwx) : ORIGIN = 0x8008000, LENGTH=32K
FLASHMAIN (rx) : ORIGIN = 0x8010000, LENGTH = 960K
Downstream script would need to direct objects and sections as required, linker isn't going to span
You might also consider having a separate boot loader and app, where the app gets the 960KB region starting at 0x08010000
2018-08-19 01:46 AM
Thank you, that worked.