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

fstorage memory allocation in Segger Embedded Studio

On fds_init() I am getting back an "Invalid Data" error code and I'm not sure why.

This is on pca10040, SDK11 and S132 v 2.0

I lifted the example mentioned here -> devzone.nordicsemi.com/.../ and put this in my UART example.

I am using Segger Embedded Studio and I amended the flash placement xml with address symbol and end symbols to enable it to compile.

I have also registered by event handler with fds_register which seems fine but moving to the next step of fds_init yields the error code 0x0000000b or Invalid Data. Tracing the cause back to fds.c this part is causing the fault:

  fds_init_opts_t init_opts = pages_init();

if (init_opts == NO_PAGES)
{
    return FDS_ERR_NO_PAGES;
}

I haven't looked beyond here as I thought I would pause and ask a question since it must be something simple I am missing.

Thanks a lot

[Update on above issue]

Ok, I think the issue is the allocation of memory in flash_placement.xml for Segger Embedded Studio. I have read RK's comment here -> devzone.nordicsemi.com/.../

Since the post above, I started a brand new project just focusing on fstorage using the example here as a base -> devzone.nordicsemi.com/.../ . I got the error "region `UNPLACED_SECTIONS' overflowed by 17 bytes" message

I then amended the flash_placement_xml as follows:

    <MemorySegment name="$(FLASH_NAME:FLASH)">
....
    <ProgramSection alignment="4" load="Yes" runin=".fs_data_run" name="fs_data" />
</MemorySegment>

<MemorySegment name="$(RAM_NAME:RAM);SRAM">
....
    <ProgramSection alignment="4" load="No" name=".fs_data_run" address_symbol="__start_fs_data"  end_symbol="__stop_fs_data" />
</MemorySegment>

[Update] I also updated thumb_crt0.o as RK suggested in the comment in the forum linked above. Unfortunately after making all of those changes I am still getting

> /Applications/SEGGER Embedded Studio 2.16a/gcc/arm-none-eabi/bin/ld: region `UNPLACED_SECTIONS' overflowed by 17 bytes

Is there any guidance on how to set up the flash placement when using fstorage? There are snippets in the forum, but it would be good if there was one "OK, this is what you need to do...", perhaps added to the tutorial on setting up Segger Embedded Studio. It seems the only thing holding SES back from being really good are issues around memory allocation.

Thanks

Related