# 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: https://devzone.nordicsemi.com/blogs/...

the exact error message I receive is:

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

"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

edit retag close delete

Sort by » oldest newest most voted

I almost got it:

It was enough to add fs_data line in flash_placement.xml to get rid of UNPLACED_SECTIONS linker error:

<!DOCTYPE Linker_Placement_File>
<Root name="Flash Section Placement">
<MemorySegment name="(FLASH_NAME:FLASH)"> <ProgramSection alignment="0x100" load="Yes" name=".vectors" start="(FLASH_START:)" />
<ProgramSection alignment="4" los" name=".init" />
(...)


That fallowed to lack of __stop_fs_data and __start_fs_data definitions. Then I found this:

Keil does not require linker scripts. Named sections are generated automatically when registration macros are invoked.

For GCC compilations, you must add a definition for a linker script used in the compilation.This addition should be at the root level of the linker script file:

SECTIONS { .fs_data_out ALIGN(4):
{ PROVIDE( __start_fs_data = .); KEEP(*(fs_data)) PROVIDE( __stop_fs_data = .); } = 0 } This definition will add a named section fs_data that is aligned to a word and that has __start_fs_data and __stop_fs_data as symbols that are used from the code.

in Nordic InfoCenter https://infocenter.nordicsemi.com/ind...

It should be super easy from this point. BUT I try to attach this simple linker script to Segger E. Studio without success... Help will be appreciated. How to do it properly?

https://devzone.nordicsemi.com/questi... finally solved the problem (notice the dot "." in front of fs_data section definition in this solution!)

topic to close

more

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"


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">
....
</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
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.

more

Oh, OK! Thanks!

( 2016-02-21 16:02:33 +0100 )editconvert to answer

cannot load section placement file,what is the solution for this?

( 2016-11-02 06:53:28 +0100 )editconvert to answer

RK, you saved my week end ! This shall be included in the Segger IDE porting tutorial.

( 2016-11-14 10:48:34 +0100 )editconvert to answer

Hey RK, I added all the necessary codes mentioned by you and got past 7 linker errors. However, there's still one linker error left, for which I can't find any solution.

  Generating linker script ‘ble_app_hrs_pca10028_s130.ld’ (1 error)
cyclic memory section dependency with section .fast_run


Any ideas, as to what the underlying problem might be? Thanks.

( 2016-12-15 19:04:14 +0100 )editconvert to answer

@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.

( 2017-01-23 11:32:28 +0100 )editconvert to answer

fair enough. I didn't have a problem when I used that. I think if it's used it's kept and if it's not used it's not needed but I can see that the linker might need the symbols defined even if they aren't used so keep=yes seems very reasonable.

( 2017-01-23 11:39:50 +0100 )editconvert to answer

[hide preview]

## Recent blog posts

• ### Difference between nRF52840 Engineering A and B reference designs

Posted 2018-01-15 12:27:08 by Martin Børs-Lind
• ### [For Hire] Expert development services of custom Hardware devices | IoT solutions | Mobile Apps

Posted 2018-01-15 09:08:42 by Ilya Surinsky
• ### Rust bindings to nrf52 series

Posted 2018-01-12 23:23:07 by Coleman McFarland
• ### Show And Tell: Poly - Building an RC Airplane The Hard Way

Posted 2018-01-05 01:17:57 by Daniel Veilleux
• ### Bluetooth on a desktop computer (Windows, Mac, Linux)

Posted 2018-01-04 17:56:57 by kbaud

## Recent questions

• ### nrfutil, nRF Connect: Thingy52 DFU fails with message "FW version failure (Code = 5)"

Posted 2018-01-23 18:06:26 by Till
• ### nrf_sniffer_2.0.0-beta-1_51296aa/PCA10040/windows 7 not working

Posted 2018-01-23 18:03:32 by BramPeeters
• ### How send message to all from peripheral to peripheral in the multiperipheral example?

Posted 2018-01-23 17:20:07 by Renato Silva
• ### Soft Devices s310 Central and Peripheral

Posted 2018-01-23 17:05:52 by fede99
• ### Is nrf_drv_spi_transfer interrupt safe?

Posted 2018-01-23 16:27:39 by samer