# 'UNPLACED SECTIONS' issue - Segger Embedded Studio

Hello,

I am trying to run a simple ble_app_hrs example from the SDK v12, but I am getting the same error as in this post https://devzone.nordicsemi.com/questi...

Building ‘ble_app_hrs_pca10040_s132’ from solution ‘ble_app_hrs_pca10040_s132’ in configuration ‘nrf52832_xxaa’

Generating linker script ‘ble_app_hrs_pca10040_s132.ld’ Linking ble_app_hrs_pca10040_s132.elf Output/nrf52832_xxaa/Exe/ble_app_hrs_pca10040_s132.elf section .fs_data' will not fit in regionUNPLACED_SECTIONS' region UNPLACED_SECTIONS' overflowed by 16 bytes Output/ble_app_hrs_pca10040_s132 nrf52832_xxaa/Obj/fstorage.o: In functioncheck_config': undefined reference to __start_fs_data' undefined reference to__stop_fs_data' Output/ble_app_hrs_pca10040_s132 nrf52832_xxaa/Obj/fstorage.o: In function fs_init': undefined reference to__stop_fs_data' undefined reference to __start_fs_data' Build failed

I can see that the question has been answered, but I am still not quite sure what the solution is.

1) How is the flash_placement.xml file added to the project and what is the correct content of this file?

2) The post also mentions that I need to 'import' and modify the standard thumb_crt.s file. It is already added under 'internal files', but If I try to modify the thumb_crt.s file then I get a warning, that this file can't be modified.?

If anyone could sum up exactly how to cope with this 'UNPLACED SECTIONS' issue it will be very much appreciated.

Cheers, Jan

edit retag close delete

Sort by » oldest newest most voted

Hi Jan L!

Did you follow this blog-post when testing Segger Embedded Studio?

1) The flash_placement.xml file you can just generate using a text editor. Simply create a new file and rename it to flash_placement.xml. This file should be in your project folder. For example, if you are using the beacon example for the nRF52 DK it should be in this folder:
SDK_InstallFolder/examples/ble_peripheral/ble_app_beacon/pca_10040/s132/arm_no_packs.

The correct content of this file is explained in the blog-post, as well as the devzone-case you referred to in your question.

2) You should be able to modify the thumb_crt.s file, but you most probably will need administrator rights.

If you haven't done so already, I highly suggest that you take a look at the blog-post I have mentioned above. Let me know if you have any more questions.

Best regards, Joakim.

more

Hi Joakim, Thanks for your reply. I have now followed the blog post except the thumb_crt0.s part. I followed the post and added the flash_placement.xml file for SDK 12. I added the file using 'Import Section Placement' under Project. I started with the 'ble_app_hrs example' and I am able to build and run the code, but LED1 is not flashing and the 'peripheral' is not visible in the HRM page of the nRF Toolbox App, i.e not advertising. If I press Build and Debug it jumps to the start of Main() as expected, so it seems ok. I then tried the 'ble_app_beacon' example following the same procedure. In this case I do see a 'beacon' on the nRF Connect App, so that seems to work. What can I be missing since the ble_app_hrs example is not advertising when everything builds and runs fine..? Thanks in advance. Best regards, Jan

( 2017-09-07 22:30:39 +0200 )editconvert to answer

Hi Jan. What happens if you program the code as a hex file using nrfgostudio? Does the ble_app_hrs example work then? Does LED1 flash (board is advertising)?

I believe Joakim has gotten the ble_app_hrs example working on SDK 12.2. I will talk to him & ask if his board advertises or not.

Kind Regards,

Bjørn

( 2017-09-08 13:36:52 +0200 )editconvert to answer

Hi Bjørn. I am not sure how I can Build and Run the example from nRF Go Studio. I have only used that for programming hex files (softdevice and application) and erasing the chip etc. It would be very helpful if you could ask Joakim how he got the ble_app_hrs up and running on SDK 12.2. Let me know when you know more. Thanks. Best regards, Jan

( 2017-09-08 16:47:03 +0200 )editconvert to answer

Hi Jan L. I did get the ble_app_hrs example to work. I can see two possible reasons that your device is not advertising.
1. You forgot to add the Softdevice to be flashed with the example.
2. You need to change the flash and sram settings. Try changing them to;

FLASH_START=0x1F000
SRAM_START=0x20002C38


Let me know how if any of this helps.

( 2017-09-11 10:43:31 +0200 )editconvert to answer

Hi Joakim, I have added the Softdevice hex file under 'Additional Load File[0] from the following location nRF5_SDK_12.2.0_f012efa/components/softdevice/s132/hex/s132_nrf52_3.0.0_softdevice.hex. But that was already added. So the only change I have tried now is to change flash and ram settings from FLASH_START=0x1F000
SRAM_START=0x20002000

to FLASH_START=0x1F000
SRAM_START=0x20002C38

BUT it makes no difference. The LED is not blinking and the device is not visible in the HRM app.

Best regards, Jan

( 2017-09-11 21:38:11 +0200 )editconvert to answer

I have now tried to erase all and program then softdevice from nRFgostdio. Then I choose Build and Debug from Segger Embedded Studio. The debugger starts in Main(). Then I Step over until I reach ble_stack_init(). When I try to step over this function nothing happens and when I then pause I end up with a Hardfault_Handler in the ses_nrf52_startup.s file. Does that give you any hint to why it is not working on my side..?

( 2017-09-11 21:52:07 +0200 )editconvert to answer

Could it be my flash and ram settings. I haven't added FLASH_SIZE and SRAM_SIZE, only FLASH_START and SRAM_START. What should the sizes be..? Best regards, Jan

( 2017-09-11 22:04:23 +0200 )editconvert to answer

Hi again Jan. I will take a look at your case and get back to you as soon as possible. I will try to see if I can reproduce what you are experiencing. Did you make any modifications at all to the example? Could you also try to flash the precompiled hex-file and see if that works? You can find it in <SDK_Installfolder>/examples/ble_peripheral/ble_app_hrs/hex/ble_app_hrs_pca10040_s132.hex.

( 2017-09-12 08:45:07 +0200 )editconvert to answer

Hi Joakim, I have not made any changes to the example code. I will try the precompiled hec file tonight. Let me know what you find. Best regards, Jan

( 2017-09-12 09:30:31 +0200 )editconvert to answer

As mentioned I followed the blog, but the only part I did not do was to add/change the thumb_crt0.s file as mentioned in the blog. I only added the flash_placement.xml file for SDK 12.2. Best regards, Jan

( 2017-09-12 09:35:18 +0200 )editconvert to answer

Now I think I know the cause of your problems. I'm afrad that the thumb_crt0.s file needs to be modified to make the example work. If I remove the changes I made to my own file, my device stops advertising as well. You need to find a way to modify the file, rebuild the example and flash it to your device. Best regards.

( 2017-09-12 11:38:48 +0200 )editconvert to answer

Hi Joakim. So is there only one thumb_crt0.s file associated with the SES installation or one for each project?. What changes must be made to the file? Br. Jan

( 2017-09-12 13:48:19 +0200 )editconvert to answer

Yes, there is only one thumb_crt0.s file. That lies in the SES_installation_folder/source. The changes that needs to be made is explained in the blogpost i referred to in my original answer. There is also a thumb_crt0.s` file ready for download in the blog. You can simply download and replace it.

( 2017-09-12 14:01:41 +0200 )editconvert to answer

Hi Joakim, I have tried to download the pre-compiled hex file and that works fine. Then I tried to replace the original thumb_crt0.s with the one found in the blogpost (though it seems to be for SDK 14 and I am using SDK 12). When I replace it I receive the following build errors:

Linking ble_app_hrs_pca10040_s132.elf Output/ble_app_hrs_pca10040_s132 nrf52832_xxaa/Obj/thumb_crt0.o: In function memory_set: undefined reference to _start_nrf_sections undefined reference to _start_nrf_sections_run undefined reference to _end_nrf_sections_run

I did add the following lines to the new thumb_crt0.s as stated in the blogpost:

ldr r0, =__fs_data_load_start__ ldr r1, =__fs_data_start__ ldr r2, =__fs_data_end__ bl memory_copy

FLASH_SIZE=0x65000 SRAM_START=0x20002C38 SRAM_SIZE=0x8000

BR. Jan

( 2017-09-12 21:44:41 +0200 )editconvert to answer

Hi, your error does seem to be caused by your flash_placement.xml file not being correct. Sometimes SES will overwrite the content of the file, instead of using the content.
Try opening the flash_placement.xml file inside SES and make sure that the content is what it should be. You can find it in the Project Explorer -> System Files.
Using the files that are made for SDK 14 should not make a difference, and they should work (They are the ones I'm using).

( 2017-09-13 08:41:21 +0200 )editconvert to answer

Hi Joakim, I am quite sure that the flash_placement content is as stated in the blogpost for SDK 12 since I copied it from there. Anyway I will double check. So to be sure that I am doing it correctly.

1) Use the thumb_crt0.s from the blogpost under SDK 14 and add fs_data as mentioned in the blogpost.

ldr r0, =__fs_data_load_start__ ldr r1, =__fs_data_start__ ldr r2, =__fs_data_end__ bl memory_copy

2) Change the content of the flash_placement.xml file as stated in the blogpost under SDK 12.

3) Add the FLASH AND RAM settings to the following:

FLASH_START=0x1F000

SRAM_START=0x20002C38

4) Do I also need to add FLASH_SIZE and SRAM_SIZE?

5) Change/add other settings mentioned in the blogpost

Anything else missing?

Best regards, Jan

( 2017-09-13 10:44:20 +0200 )editconvert to answer

Hi Jan. To avoid any more confusion, I have added the files you can use in my original answer. Please try to use both of those files, and please open the flash_placement.xml inside SES to verify that the content is the same as in the file I've added. The rest of your settings should be fine.

( 2017-09-13 12:26:12 +0200 )editconvert to answer

[hide preview]

## Recent blog posts

• ### 6 Things to Know about Bluetooth Beacons

Posted 2017-09-22 08:27:00 by Rose Martin
• ### Creating a Keil project for a Bluetooth Mesh example

Posted 2017-09-19 12:08:11 by Kristian Skordal
• ### Using millis() like in Arduino.

Posted 2017-09-18 11:58:04 by schef
• ### Flashing nRF5x firmware using any dumb terminal program via standard serial COM port

Posted 2017-09-18 03:53:40 by Nguyen Hoan Hoang
• ### How to Debug the nRF52 Interrupts — Useful Tips

Posted 2017-09-13 15:15:22 by Yaniv Nis

## Recent questions

• ### Device crashes when debug flags are turned on

Posted 2017-09-24 04:09:33 by tyler
• ### nrf52832 of UART problem

Posted 2017-09-24 04:05:27 by lenli
• ### RTT Stability

Posted 2017-09-24 03:28:49 by Yatekii
• ### HardFault with GPIOTE & SD

Posted 2017-09-24 03:18:09 by Yatekii
• ### adding a service to existing sdk example code

Posted 2017-09-24 02:45:24 by alikob