Skip to main content
HL?�t
Associate II
August 18, 2018
Question

Virtual EEPROM Linker Script Adjustments

  • August 18, 2018
  • 2 replies
  • 921 views

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

    This topic has been closed for replies.

    2 replies

    Tesla DeLorean
    Guru
    August 18, 2018

    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

    Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
    HL?�t
    HL?�tAuthor
    Associate II
    August 19, 2018

    Thank you, that worked.