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

Segger Embedded Studio -`UNPLACED_SECTIONS' problem

Hello,

I try to start developing my nrf51/nrf52 projects using Segger Embedded Studio but each time I receive the same linker error:

"(...) section fs_data' will not fit in regionUNPLACED_SECTIONS'"

In my case fds.c or fstorage.c is the problem but i saw at this forum that others have problems with diffrent libraries.

Looking forward to any help. Cheers!

EDIT: For better readability I will try to add more detail of the problem:

I import Keil 4 project into Segger E. Studio. I follow the import procedure located at this topic: devzone.nordicsemi.com/.../

the exact error message I receive is:

"(...) section fs_data' will not fit in regionUNPLACED_SECTIONS'"

"section fs_data loaded at [00000000,0000000f] overlaps section .vectors loaded at [00000000,000000a7]"

"region `UNPLACED_SECTIONS' overflowed by 17 bytes"

Next thing is I know where sections are defined (flash_placement.xml) but I have no idea what and how to change to make fs_data fit into the sections. I also found the .c file section options view (properties of the file -> secition options) but again nothing helpful is there.

I still try to dig the problem - If i find sth I will edit this post

Parents
  • You don't have to attach a hard-coded linker script to Segger Embedded Studio, it can generate it for you including the section variables __start_fs_data and __stop_fs_data.

    Put the following in the flash_placement xml file, you nearly had it right, you were just missing two keywords

    <ProgramSection alignment="4" keep="Yes" load="Yes" name=".fs_data" 
    address_symbol="__start_fs_data"  end_symbol="__stop_fs_data" />
    

    that will define those two linker symbols you need and set them to the start and end of the fs_data section.

    It's better to do it this way and let Segger Embedded Studio make the .ld file each time with all the correct pieces in it than to give it one hard-coded one which is what it seems your current solution does.

    Having looked at the linker file Nordic now has and realised this stuff is supposed to go in RAM it's more complicated. You import the flash_placement.xml file to your project and then add one line in the FLASH memory segment piece and one in the RAM memory segment piece

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

    Then you also need to import the standard thumb_crt0.s file and add, I suggest after the tdata copy the following code which copies the fs_data from FLASH into RAM.

    ldr r2, =__tdata_end__
    bl memory_copy
    # ADD HERE ... 
    ldr r0, =__fs_data_load_start__
    ldr r1, =__fs_data_start__
    ldr r2, =__fs_data_end__
    bl memory_copy
    # TO HERE ...
    

    If you use my first version - the data ends up in flash, but it's not very useful there as fds needs to modify it, which I didn't realise.

  • @RK: Your answer is close to perfection. I injected "keep="Yes"" to allow KEEP(.symbol) to be propagated through the xml->ld conversion. If this wasn't present; SES v3 will drop the symbol.

Reply Children
No Data
Related