This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

fstorage - Put fs_data at end of flash?

Hello,

i am using the fstorage library for very simple persistent storage. How can i modify the linker script to put the storage at the end of the flash, and with a fixed size? I noticed that depending on the size of the application, the location of fs_data will differ. I would instead like to specify the size of fs_data, and also a maximum flash size (FLASH = softdevice usage - persistent storage usage).

Perhaps something like:

MEMORY
{
  FLASH (rx) : ORIGIN = 0x1f000, LENGTH = 0x48000
  STORAGE (rx) : ORIGIN = 0x67000, LENGTH = 0x19000
  RAM (rwx) :  ORIGIN = 0x20003600, LENGTH = 0xca00
}

SECTIONS
{
  .fs_data :
  {
    PROVIDE(__start_fs_data = .);
    KEEP(*(.fs_data))
    PROVIDE(__stop_fs_data = .);
  } > STORAGE
}

What is a suitable solution for this? I will of course need to use some other initialization than:

FS_REGISTER_CFG(fs_config_t m_fs_config) =
{
    .callback   = fs_evt_handler,           // Function for event callbacks.
    .num_pages  = STORAGE_NUM_FLASH_PAGES,  // Number of physical flash pages required.
    .priority   = 0xFE                      // Priority for flash usage.
};
Related