hungbui gravatar image

Posted 2016-10-21 13:41:45 +0200

blogs->nordicers

Segger Embedded Studio - A Cross Platform IDE

Download and Setup

Note: It is recommended, but not necessary, to use the most recent releases of the above software.

Importing a Keil uVision project

  • Open SEGGER Embedded Studio 3.10e
  • Select Tools -> Package Manager... and install the CMSIS-CORE Support Package

image description

  • Select File -> Import IAR EWARM / Keil MDK Project...
  • Navigate to your local nRF5 SDK and in NRF5_SDK/examples/ble_peripheral/ble_app_beacon/ select pca10040/s132/arm5_no_packs/ble_app_beacon_pca10040_s132.uvprojx
  • The Import Build Configuration window will pop-up. Make sure you select to use Embedded Studio's Internal Toolchain (GCC/Clang) for now...

image description

Nuances

If you've used Keil uVision with Nordic's SDK before, you might remember that each example BLE project contains a dummy project configuration for easy flashing of the SoftDevice. We don't need this in Embedded Studio and it can cause confusion so let's delete it.

  • Select Project -> Build Configurations... and under Public Configurations select flash_s132_nrf52_3.0.0_softdevice and delete it by clicking the - symbol in the upper right-hand corner of the pop-up window.

Your build configurations should look like this now:

image description

And your project explorer:

image description

Adding nRF5 MDK Files

Keil uVision uses Device packs for Startup/System Setup. This pack contains the nRF5 startup assembly files arm_startup_nrf52.s and the system setup files system_nrf52.c along with some header files. We will need to manually add these files to our Embedded Studio project.

  • Download ses_nrf51_startup.s and ses_nrf52_startup.s and save them into NRF5_SDK/components/toolchain/embedded_studio/ (create the folder)
  • Remove Cortex_M_Startup.s from the Internal Files folder in the Project Explorer
  • Right click the Internal Files folder and select Add Existing File...
  • In NRF5_SDK/components/toolchain/ select system_nrf52.c
  • Do the same for NRF5_SDK/components/toolchain/embedded_studio/ses_nrf52_startup.s

Your project explorer should look like this now:

image description

  • Select Project -> Edit Options... and then select the Preprocessor tab
  • Add ../../../../../../components/device to the User Include Directories field to include the device header files in our Embedded Studio project

Your user include directories should look like this now:

image description

Peer Manager/Flash Data Storage

Most of the examples in the SDK use Peer Manager. Peer Manager uses Flash Data Storage and Flash Storage. To indicate where information from Peer Manager (e.g bonding information) should be store page tags in flash (section variables) is used. These page tags need to be written to flash. To do so, flash_placement.xml and thumb_crt0.s have to be added and modified. Thanks to @RK and @Håkon Alseth in this post.

Flash_placement.xml can be located in the project folder, for example: ..\nRF5_SDK_xxx\examples\ble_peripheral\ble_app_gls\pca10040\s132\arm5_no_packs

You have to generate flash_placement.xml using text editor, notepad for example. After that you can import it by right click on the project name and choose "Import Section placement"

flash_placement.xml should then look like the following (SDK 12):

<!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" load="Yes" name=".init" />
    <ProgramSection alignment="4" load="Yes" name=".init_rodata" />
    <ProgramSection alignment="4" load="Yes" name=".text" />
    <ProgramSection alignment="4" load="Yes" name=".dtors" />
    <ProgramSection alignment="4" load="Yes" name=".ctors" />
    <ProgramSection alignment="4" load="Yes" name=".rodata" />
    <ProgramSection alignment="4" load="Yes" name=".ARM.exidx" address_symbol="__exidx_start" end_symbol="__exidx_end" />
    <ProgramSection alignment="4" load="Yes" runin=".fast_run" name=".fast" />
    <ProgramSection alignment="4" load="Yes" runin=".data_run" name=".data" />
    <ProgramSection alignment="4" load="Yes" runin=".tdata_run" name=".tdata" />
    <ProgramSection alignment="4" keep="Yes" load="Yes" runin=".fs_data_run" name=".fs_data" />
  </MemorySegment>
  <MemorySegment name="$(RAM_NAME:RAM);SRAM">
    <ProgramSection alignment="0x100" load="No" name=".vectors_ram" start="$(RAM_START:$(SRAM_START:))" />
    <ProgramSection alignment="4" load="No" name=".fast_run" />
    <ProgramSection alignment="4" load="No" name=".data_run" />
    <ProgramSection alignment="4" load="No" name=".tdata_run" />
    <ProgramSection alignment="4" load="No" keep="Yes" name=".fs_data_run" address_symbol="__start_fs_data" end_symbol="__stop_fs_data" />
    <ProgramSection alignment="4" load="No" name=".bss" />
    <ProgramSection alignment="4" load="No" name=".tbss" />
    <ProgramSection alignment="4" load="No" name=".non_init" />
    <ProgramSection alignment="4" size="__HEAPSIZE__" load="No" name=".heap" />
    <ProgramSection alignment="8" size="__STACKSIZE__" load="No" place_from_segment_end="Yes" name=".stack" />
    <ProgramSection alignment="8" size="__STACKSIZE_PROCESS__" load="No" name=".stack_process" />
  </MemorySegment>
  <MemorySegment name="$(FLASH2_NAME:FLASH2)">
    <ProgramSection alignment="4" load="Yes" name=".text2" />
    <ProgramSection alignment="4" load="Yes" name=".rodata2" />
    <ProgramSection alignment="4" load="Yes" runin=".data2_run" name=".data2" />
  </MemorySegment>
  <MemorySegment name="$(RAM2_NAME:RAM2)">
    <ProgramSection alignment="4" load="No" name=".data2_run" />
    <ProgramSection alignment="4" load="No" name=".bss2" />
  </MemorySegment>
</Root>

Thumb_crt0.s is located in the Segger Embedded studio install folder: ..\SEGGER\SEGGER Embedded Studio \source

In thumb_crt0.s, fs_data should be added, it can be added after tdata (thanks to @RK):

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

Building

Our project should build successfully now:

  • Build the project by selecting Build -> Build ble_app_beacon_pca10040_s132 or by simply hitting F7

image description

Notice that the compiled binary is placed at the beginning of FLASH and SRAM. This project requires a SoftDevice so let's reserve the correct amount of room for it.

  • Select Project -> Edit Options... and then select the Linker tab
  • Paste the following into the Section Placement Macros field:

FLASH_START=0x1F000
SRAM_START=0x20002000

Your Project Options should look like this now:

image description

  • Re-build the project by selecting Build -> Rebuild ble_app_beacon_pca10040_s132 or by simply hitting Alt + F7

Now you should see that space has been reserved in FLASH and SRAM for the SoftDevice:

image description

Fine-Tuning

  • Select Project -> Edit Options... and then select the Preprocessor tab
  • Add the definition NO_VTOR_CONFIG to the Preprocessor Definitions field (this tells Embedded Studio to expect a SoftDevice to be present and that it will forward exceptions/interrupts to the application)

Your Preprocessor Definitions should look like this now:

image description

Flashing the SoftDevice with our application

  • Select Project -> Edit Options... and then select the Loader tab
  • Add the absolute path to the SoftDevice NRF5_SDK/components/softdevice/s132/hex/s132_nrf52_3.0.0_softdevice.hex to the Additional Load File[0] field

Your Loader options should look like this now:

image description

Running

  • Connect your nRF5 Development Kit to your computer and turn it on
  • Run the application by selecting Debug -> Build and Run or hitting Ctrl + F5

Your Output log should look like this now:

image description

The application should be running on your nRF5 DK and LED1 should be blinking. You should be able to scan for and find the beacon using nRF Connect.

Debugging

  • Select Debug -> Go or simply hit F5

You should see that you have entered the debugging interface now:

image description

Notice that our application has ran until the first line in main() and is halted. You should experiment with debugging in Embedded Studio. It has all the debugging features you would expect from a professional IDE and more (makes sense as SEGGER makes the debuggers as well).

Peer manager

To make peer manager (SDK 10(?), SDK 11, SDK 12) work with Segger Embedded Studio the modifications in this post are needed.

Troubleshooting

If you are stuck, previous blog posts (although deprecated) may help you fix your problem (also see the questions section):

54 comments

Posted Oct. 23, 2016, 7:27 p.m.

This is a most excellent post. I'm glad to see the Nordic folks pick up on this excellent IDE and put it to use on the nrf5 product line.

syntroniks gravatar image

Posted Oct. 24, 2016, 5:01 p.m.

I'm having an issue. I am using the same software version and SDK version as you, but SES seems to think I'm compiling for an ARM7 in ARM mode. This makes it include crt0.s as opposed to thumb_crt0.s like your screenshot shows.

If I change the target processor and try to compile, there are linker errors before editing section placement macros. Shouldn't we include the nRF CPU support package? I had done that for previous SES projects.

Thanks! Perhaps memory map .XML files for the linker would be helpful to include in /toolchain

syntroniks gravatar image

Posted Oct. 24, 2016, 5:08 p.m.

I also encountered a screen which was not shown in your walkthrough: screenshot

I can set the nrf52832 as a target processor only when I create a new SES project. I can't select it after the fact and as I mentioned above, the project importer defaults to ARM7


EDIT

It looks like I needed to restart SES to get this to take effect. I will continue to investigate this. I think I also contacted Segger staff about this a few months ago.

Artucas gravatar image

Posted Oct. 25, 2016, 9:29 a.m.

Looks very cool. Can we also use this for nrf51xx parts?

atune gravatar image

Posted Oct. 26, 2016, 12:06 p.m.

Seems like a really nice IDE. It was really easy to jump into business. Keil (and IAR) should pay heed... :) Not that I've had problems running things with Keil, but the clarity and usability feels much better with SES. Also the absence of limitations for non-commercial projects will do wonders for gaining traction methinks.

Random quick note: If you have a file selected in Project Explorer and select Project -> Edit Options... from the toolbar, the options will be opened for the selected file, not the project. Of course this is apparent since it will read File '<filename>' Options instead of Project '<prjname>' Options in the menu, but it managed to throw me off for a little while since I fully expected **Project** -> Edit Options... to always open the entire Project's settings.

Andreas gravatar image

Posted Oct. 26, 2016, 9:31 p.m.

Thanks for a great tutorial, Michael! Programming the ble_app_beacon works for me. However, when I try to program another project, the ble_app_uart, using this same tutorial, I can't make it work. I've commented out FILE stdout and FILE stdin in retarget.c. I'm able to build, run, and go through debugging without any errors, but the LED on my dev kit is not flashing, nor can I discover a bluetooth device with the nRF Toolbox app. How do I make it work?

Webmobi gravatar image

Posted Oct. 27, 2016, 2:07 p.m.

Has anyone tried blinky example using this method, when i dump into the nRF52-DK it is not advertising. what may be the reason?

jantore gravatar image

Posted Oct. 28, 2016, 3:28 p.m.

Hi, If you're having trouble getting the blinky (or other examples) to work, you can try to set the SRAM start value slightly higher. For the experimental blinky example in SDK v12.1, the following works for me: SRAM_START=0x20002600

jantore gravatar image

Posted Oct. 30, 2016, 12:32 p.m.

I have now tried SEGGER Embedded Studio (3.10f) on macOS, and I experience the same issue as @syntroniks when I import an example project from the SDK (12.1.0). It seems SES for some reason is not able to find the nRF52832_xxAA as target processor and because of that wrong files and settings are added to the project. There's an underlying problem with project imports on macOs in there somewhere causing this, so if someone has figured out what it is and how to fix it, please comment.

Here is what I did to get the examples working after the unsuccessful import, in addition to what is described in this tutorial:

  • Install the nRF CPU Support Package (along with the already installed CMSIS-CORE support package) Tools -> Package manager -> Install nRF CPU Support Package

  • Import the project. Remove crt0.s and ARM_Startup.s from Internal files folder in project explorer.

  • Add <your SES folder>/source/thumb_crt0.s to Internal files.

  • Go to Project -> Edit options... -> (General tab) Build -> Property Groups File and add the path $(PackagesDir)/nRF/XML/property_groups.xml

  • Click Ok for the previous step to take effect

  • Go to Project -> Edit options... -> (General tab) Build -> Target Processor and select nRF52832_xxAA as target

  • Go to Project -> Edit options... -> (Linker tab) Linker -> Section Placement File and add $(StudioDir)/targets/Cortex_M/flash_placement.xml

The project should now build. To flash it to the DevKit, confirm the following:

  • Project -> Edit options... -> (Debugging tab) J-Link -> Target Interface Type should be set to SWD
Webmobi gravatar image

Posted Oct. 31, 2016, 11:45 a.m.

Thanks @jan Tore Guggedal, now my Blinky example advertises

vladbabak gravatar image

Posted Nov. 7, 2016, 2:20 a.m.

Made some mistakes in Flash start RAM start values. After modification not going too far, debug always starts at 640 makes short run in files ble_advertising.c and fstorage.c than jumps to 49000000 and goes to ffffffff

vladbabak gravatar image

Posted Nov. 8, 2016, 5:52 a.m.

Debug constantly returns to static bool flash_access_in_progress() function part of ble_advertising.c and then goes to arrea around 49000000 or 63000000, looks like it is trying to upload Flash not successfully perhaps. I put FLASH_START=0x1c000 SRAM_START=0x20002800 for s130

jantore gravatar image

Posted Nov. 8, 2016, 10:02 a.m.

Which project and to what chip are you trying to flash, vlad? What version of SDK and SoftDevice are you using? Are you using SES for Windows, macOS or Linux? You could attach the SES project file (.emProject) to make it easier to recreate the problem if you do not have any sensitive information there. Also, you could take the questions in the DevZone question section where more people can see it and help.

vladbabak gravatar image

Posted Nov. 8, 2016, 4:58 p.m.

Found my last mistake, shouldn't touch tnumb_crt0. It's all up an running. Great article, thanks a lot.

jfdevmoto gravatar image

Posted Nov. 10, 2016, 3:53 p.m.

It is quite complicated to build a project using peer manager due to flah storage module and section variables. There are some answers to those problems in the devzone forums area, it would be great to improve this tutorial with this, because with SDK12 peer manager is quite mandatory and code size limited environments cannot be used as soon as you have a little bit of code. see this post : https://devzone.nordicsemi.com/question/68722/segger-embedded-studio-unplaced_sections-problem/

bjorn-spockeli gravatar image

Posted Nov. 24, 2016, 2:58 p.m.

In case someone want to use SES to build the IoT SDK examples you have to edit the below settings in addition to the steps in the blog post above

  1. Edit MBEDTLS_CONFIG_FILE=<nrf_tls_config.h> under Preprocessor Definitions to `MBEDTLS_CONFIG_FILE="nrf_tls_config.h". (Only applicable to the examples that use TLS, e.g. MQTT)

  2. Add ../../../../../../../../components/iot/ble_6lowpan/lib/ble_6lowpan.a under Linker-> Set Additional Input files

  3. Set ARM FP ABI Type to Hard under C/C++ -> Code Generation
tpitman gravatar image

Posted Dec. 6, 2016, 4:39 p.m.

I am trying to get Segger Studio 3.10h going. I have followed the main instructions and the comment instructions.

I get a linker error: undefined reference to `SystemCoreClock'

mjdietz2 gravatar image

Posted Dec. 9, 2016, 4:13 a.m.

@Tony: you need to add the system_nrf52.c file to your project. This usually goes under the Internal Files directory in the project explorer.

tpitman gravatar image

Posted Dec. 9, 2016, 10 p.m.

@Michael: thanks for that. I missed that one line in the instructions. Now it gets past that error and I can build the Beacon project.

Now I am trying to build the HRS project because that is closer to what I want to start with and I get 8 linker errors. Please advise:

Output/nrf52832_xxaa/Exe/ble_app_hrs_pca10040_s132.elf section `.fs_data' will not fit in region `UNPLACED_SECTIONS'
region `UNPLACED_SECTIONS' overflowed by 17 bytes
Output/ble_app_hrs_pca10040_s132 nrf52832_xxaa/Obj/fstorage.o: In function `check_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

rogerclark gravatar image

Posted Dec. 21, 2016, 11:46 a.m.

I'm getting this error

Output/nrf51422_xxac/Exe/ble_app_template_pca10028_s130.elf section .fs_data' will not fit in regionUNPLACED_SECTIONS'

I've added the Section Placement Macros but it looks like something else is missing from the linker setup :-(

syntroniks gravatar image

Posted Dec. 21, 2016, 9:22 p.m.

@Roger Clark

Use Bjørn Spockeli's files: https://devzone.nordicsemi.com/question/91735/how-do-i-set-flash_placementxml-for-nrf52-bootloader-in-ses/ in the accepted answer

If that doesn't work, try <ProgramSection alignment="4" load="No" name=".fs_data_run" address_symbol="__start_fs_data" end_symbol="__stop_fs_data" /> in the SRAM section

rogerclark gravatar image

Posted Dec. 22, 2016, 12:29 a.m.

@syntronics

The accepted answer didn't work for me. The xml file in the accepted answer still gave the same error.

I had to also adjust the flash and RAM start as they did not import correctly from the Keil project.

And I also have a different issue, where "Build and Run" does not run the code.

It gets uploaded, and I double checked it gets put in the correct place, and I can single step etc.

If I go back into the JFlash and connect then Start Application, it runs OK.

So it looks like there is some other incompatibility, and perhaps I need to update my JLink firmware.

Edit. Umm. Jlink seems to be up to date. So its some other problem, I'll try seatching on Seggers forum

wilhelmsen gravatar image

Posted Jan. 17, 2017, 9:44 a.m.

Placing the <ProgramSecion alignment... /> in <MemorySegment name="$(RAM_NAME:RAM);SRAM"> instead of <MemorySegment name="$(FLASH_NAME:FLASH)"> like I first did made the ble_app_hrs example work for me (PCA10040, SDK 12.2)

rogerclark gravatar image

Posted Jan. 18, 2017, 10:56 a.m.

Just a few thoughts about Segger Embedded Studio

Although its free and has no code limits, the license states that you can only use the product for free for evaluation or for eduction or self education.

The license does not allow you to use the software for your own home projects, or to build something for your friends or family etc.

I evaluated the software for a while, but found it didn't contain a lot of the features that I expect from software with a retail cost of over $1800 (USD)

I think if you have that much money to spend then Keil would be a better option

If you just want to write code for self education and can live with the 32k application code limit, IMHO you should use Keil.

Personally, I'm now just using gcc with an external editor and will probably move to using Eclipse at a future date, as it has virtually all the features of Embedded Studio and is completely free even for commercial development.

AI gravatar image

Posted Jan. 23, 2017, 12:42 p.m.

Followed all the steps to import and build ble_app_hrs example. Comments about the unplaced_section error were very helpful so now I have the example that successfully builds and apparently downloads as well. But nothing seems to be happening after Build and Run i.e. I can't find the BLE peripheral when searching for it. Other people have reported similar issues above. What's the best way to try and find what the problem could be?

EDIT: I am usin SDK 12.2, and also tried Jan's tip of setting SRAM_START slightly higher to 0x20002600

wilhelmsen gravatar image

Posted Jan. 24, 2017, 12:26 p.m.

I might ask a dumb question now, but have you remember to press the "play" button a second time? It just jumps to main and stops there by default.

AI gravatar image

Posted Jan. 24, 2017, 12:44 p.m.

Yes, I believe that happens when you Build and Debug. (It should run automatically when you Build and Run I think but neither of these are working).

jantore gravatar image

Posted Jan. 24, 2017, 1:07 p.m.

Hi, anasimtiaz . You could try setting SRAM_START=0x20002c38 for the ble_app_hrs example. The default values for each example's SRAM and flash can be found in the .ld file in <example_name>/pca_xxxxx/<softdevice>/armgcc. And also remember to manually reset the Development Kit after Build and Run.

AI gravatar image

Posted Feb. 2, 2017, 6:34 p.m.

Thanks Jan. Still doesn't work for me. It seems weird since I do have it working in most other toolchains. I am going to start from scratch and try again.

jaewoo.kim@outlook.com gravatar image

Posted Feb. 16, 2017, 7:49 p.m.

image description

When I hit Build and Run (ble beacon example app), the log output was as above. The first questions is why the status messages under each task (e.g. Programming and Flash download) are all "Working", not "Completed". Is it proper messages? Then, the second issue is that the phone cannot detect the device. I am using the latest SDK. Any suggetions to resolve them?

wtbn gravatar image

Posted Feb. 23, 2017, 11:28 a.m.

Did anyone had any problems using SES 3.12 on Windows 10? I am trying to use my project made on Win7 on different machine, but SES is crashing (with no details) after clicking "debug"

edit.

Ok, I did more testing.

Crash only occurs, when I have monitor mode, set in: project options -> debugging -> jlink -> additional jlink options, and there:

SetMonModeDebug=1
SetMonModeVTableAddr=0x001F000

When I remove that script, it starts debugging, but doesnt go to debugged source file and works really weirdly. Breakpoints does not work, only assembly view seems to be working fine.

Ofc I tried updating jlink software, but the situation is the same on old version (i tried 5.12f), and newest ones like 6.12j. I tried it (with the same project, but that should not matter as it works on win7 smoothly) on 3 different win10 machines.

After app crash, there is a crash report app with "send report" option available, but when I click it... it also crash.

Should I check some specific logs? Jlink log doesnt say anything useful.

freddyperdok gravatar image

Posted Feb. 28, 2017, 9:43 a.m.

I also have problems with SES 3.12 on windows 10. I went back to 3.10e and i can continue working on my projects.

G_fox72 gravatar image

Posted March 11, 2017, 9:53 p.m.

Can anyone point me to why I would get a warning "no linker script or memory map file specified" despite I selected the flash_placement.xml and done all the steps in above guidline for my current configuration ? I always succeeded in having the section placements end up correctly since discovery of the the above guideline but for some reason(s) this one configuration must have a wrong setting somewhere. image description

SvenKBach gravatar image

Posted March 24, 2017, 10:10 a.m.

Thanks for the brilliant post! I have managed to run the hid keyboard example - though one needs to allocate extra bytes on RAM for SD. But one thing I am wondering is that there is no register view for nRF52 devices (only CPU). Do I need to to additional setup or something?

MoritzB gravatar image

Posted March 24, 2017, 6:53 p.m.

I don't know if it was allready mentioned, but SRAM_START often needs to be set individually. Depending on the example you open. If your project doesn't work this could be the case. If this is the case all 4 LEDs on the DK flicker rather weak. But you dont get any errors in Embedded Studio. To find out how SRAM_START should be set you can open Termite and you get an ERROR. Like SDH:WARNING:RAM start should be adjusted to 0x20002558 so you have to use this instead of 20002000.

rShergold gravatar image

Posted March 25, 2017, 1:53 p.m.

Could this blog post be edited to make the flash_placement.xml steps more explicit.

To do so, flash_placement.xml and thumb_crt0.s have to be modified

But where those files are isn't mentioned

Kristin gravatar image

Posted March 27, 2017, 9:35 a.m.

@Remi: Done!

jcormier@criticallink.com gravatar image

Posted April 3, 2017, 10:05 p.m.

flash_placement.xml seems to be located in the segger install directory instead of in the project directory mentioned above.

/usr/share/segger_embedded_studio_3.12/targets/Cortex_M/flash_placement.xml

jcormier@criticallink.com gravatar image

Posted April 3, 2017, 11:25 p.m.

Using SDK 12.2 and SES 3.12. Following instructions on linux and windows, I get "nrf.h: No such file or director".

bjorn-spockeli gravatar image

Posted April 4, 2017, 8:37 a.m.

@svenkbach: You have to add the register definition file to your project, this is done by navigating to

Project -> Edit Options -> Debugger -> Register Definition File

and then selecting the register definition file for your device.

You'll find the register definition files(.svd) in the svd folder in the nRF5_SDK folder, e.g. for SKD v12.0.0 you'll find it in nRF5_SDK_12.2.0_f012efa\svd

f_mohsen gravatar image

Posted April 5, 2017, 1:53 p.m.

@jcormier I had the same problem but using SDK13, I initially got "nrf.h: No such file or director". I found that my problem was in the second part of "Adding nRF5 MDK Files" section. It asks you to "Select Project -> Edit Options...", but first make sure you have clicked on you active project from project explorer before doing this step. This solved my missing file issue.

adityakoparkar gravatar image

Posted April 8, 2017, 10:12 p.m.

For people who are trying to setup the Segger Embedded Studio on mac\windows. This post is for nRF52-DK board. If you are using the nRF-51 board, check the PCA100xx number that you have on your nrf51-DK board.

Use the ses_nrf51_startup.s, system_nrf51.c files to add them to internal files.

FLASH_START=0x1F000 SRAM_START=0x20002000 The above values are for the nRF52-DK board. For nRF51-DK you need to retrieve these values from the loader file located in the SDK directory that you download: nRF5_SDK_12-2/examples/ble_peripheral/ble_app_beacon/pca10028/s130/armgcc/ble_app_beacon_gcc_nrf51.ld USE THE VALUE FOR FLASH_START and SRAM_START from this file.

Lastly the .hex softdevice file that you use in the loader, make sure that you select the on from 'S130' directory. I had struggled for a day because of these stupid mistakes that I made.

Thank you Nordic so much for putting together this wonderful post! Happy tinkering :)

r0b0ty gravatar image

Posted April 14, 2017, 4:43 a.m.

Hey, guys... I'm stuck at the "Peer Manager/Flash Data Storage" with a compile error. I'm running SES V3.12 on Linux with SDK 13, and have modified both the flash_placement.xml and thumb_crt0.s files (hopefully correctly).

I get this error:

image description

This is what I added to the thumb_crt0.s file:

image description

I'm attaching my flash_placement.xml file that resides in the project directory, to see if you can see a problem. By the way, I also tried modifying the one that resides in the SES installation directory, but got a similar compilation error.

Finally... this is how my project structure looks like:

image description

Can anyone help me out, please? Thanks in advance!

r0b0ty gravatar image

Posted April 15, 2017, 4:18 p.m.

Hi, again! Happy to report that all is working now.

I'm not 100% sure of this, but I believe that it may have been the flash_placement.xml file. The original instructions in the tutorial stated:

Flash_placement.xml is located in the project folder, for example: ..\nRF5_SDK_xxx\examples\ble_peripheral\ble_app_gls\pca10040\s132\arm5_no_packs

There was none in SDK 13, so I may have copied over the file from the Segger installation directory (thanks to jcormier) into the project folder... and modified it.

To matters more confusing to me, I noticed that there are two flash_placement.xml files, one in:

/usr/share/segger_embedded_studio_3.12/targets/

and one in:

/usr/share/segger_embedded_studio_3.12/targets/Cortex_M/

I think I used the wrong one to copy over (the one in .../targets).

In summary... I followed the excellent instructions in this tutorial and the only deviation I made to get it all working was to modify the flash_placement.xml file that resides in the following directory:

/usr/share/segger_embedded_studio_3.12/targets/Cortex_M/

Just sharing my experience with those using SDK 13.0. Have a good day!

Malvin gravatar image

Posted April 15, 2017, 11:08 p.m.

Believe I've followed this to the letter, but upon compiling I keep getting the following build error: image description

Any idea what I'm doing wrong here?

MikeLemon gravatar image

Posted April 17, 2017, 11:28 p.m.

Hello,

I followed every step of this tutorial and I cant manage to build the project successfully that's what is shows when I try to build:

image description

and at Adding nRF5 MDK Files step at preprocessor at user include directories it doesn't show me the whole list as displyed here:

image description

What should I do?

r0b0ty gravatar image

Posted April 18, 2017, 2:06 a.m.

@MikeLemon,

Have you tried removing the trailing period after ".../device." in the pre-processor User Include Directories?

I don't know if it'll solve the missing (and long) list of the other include directories, though.

Have you tried making sure that you click on the "Project 'ble_app_beacon_pca10040_s132'" line in your Project Explorer prior to selecting Project-> Edit Options -> Preprocessor.

I'm quite new to all of this as well, but do wish you luck.

jantore gravatar image

Posted April 18, 2017, 11:53 a.m.

@MikeLemon, you can try to select the project in the project item list on the left in your workspace before trying to edit the project options (as I now see r0b0ty already mentioned). Then you will probably see the full list of include directories, and you can add the ../device line to it.

MikeLemon gravatar image

Posted April 19, 2017, 12:56 a.m.

Didn't get it what to do now? any way when I try to build it shows me error messages similar to the error messages shown at my Eclipse IDE set up attempt. some thing with nrf.h no such file directory.

r0b0ty gravatar image

Posted April 20, 2017, 1:56 a.m.

@MikeLemon, from my very limited experience... you WILL get such a compilation error if the appropriate "include" directories are not referenced.

If you refer to your original screenshot, you'll note that you had clicked on the "Internal Files" folder in Project Explorer when you pulled up the "Set User Include Directories" window. If I select the project name in Project Explorer, however, it shows this:

image description

If you've done this already, I'm not sure what it could be... maybe an indication of some other setup issue?

Unless one of the gurus here can make a better recommendation, maybe [1] try this again from scratch (maybe replace the entire example ble_app_beacon directory with the default one from an original SDK zip file) and follow the directions again, or [2] manually entering the info in the "Set User Include Directories" window... again, after selecting the project name in the Project Explorer window.

Here's a copy and paste of mine (which should work if you retained the original SDK folder structure after unzipping):

$(PackagesDir)/CMSIS_4/CMSIS/Include
../../../config
../../../../../../components
../../../../../../components/ble/ble_advertising
../../../../../../components/ble/ble_dtm
../../../../../../components/ble/ble_racp
../../../../../../components/ble/ble_services/ble_ancs_c
../../../../../../components/ble/ble_services/ble_ans_c
../../../../../../components/ble/ble_services/ble_bas
../../../../../../components/ble/ble_services/ble_bas_c
../../../../../../components/ble/ble_services/ble_cscs
../../../../../../components/ble/ble_services/ble_cts_c
../../../../../../components/ble/ble_services/ble_dfu
../../../../../../components/ble/ble_services/ble_dis
../../../../../../components/ble/ble_services/ble_gls
../../../../../../components/ble/ble_services/ble_hids
../../../../../../components/ble/ble_services/ble_hrs
../../../../../../components/ble/ble_services/ble_hrs_c
../../../../../../components/ble/ble_services/ble_hts
../../../../../../components/ble/ble_services/ble_ias
../../../../../../components/ble/ble_services/ble_ias_c
../../../../../../components/ble/ble_services/ble_lbs
../../../../../../components/ble/ble_services/ble_lbs_c
../../../../../../components/ble/ble_services/ble_lls
../../../../../../components/ble/ble_services/ble_nus
../../../../../../components/ble/ble_services/ble_nus_c
../../../../../../components/ble/ble_services/ble_rscs
../../../../../../components/ble/ble_services/ble_rscs_c
../../../../../../components/ble/ble_services/ble_tps
../../../../../../components/ble/common
../../../../../../components/ble/nrf_ble_qwr
../../../../../../components/ble/peer_manager
../../../../../../components/boards
../../../../../../components/device
../../../../../../components/drivers_nrf/clock
../../../../../../components/drivers_nrf/common
../../../../../../components/drivers_nrf/comp
../../../../../../components/drivers_nrf/delay
../../../../../../components/drivers_nrf/gpiote
../../../../../../components/drivers_nrf/hal
../../../../../../components/drivers_nrf/i2s
../../../../../../components/drivers_nrf/lpcomp
../../../../../../components/drivers_nrf/pdm
../../../../../../components/drivers_nrf/power
../../../../../../components/drivers_nrf/ppi
../../../../../../components/drivers_nrf/pwm
../../../../../../components/drivers_nrf/qdec
../../../../../../components/drivers_nrf/rng
../../../../../../components/drivers_nrf/rtc
../../../../../../components/drivers_nrf/saadc
../../../../../../components/drivers_nrf/spi_master
../../../../../../components/drivers_nrf/spi_slave
../../../../../../components/drivers_nrf/swi
../../../../../../components/drivers_nrf/timer
../../../../../../components/drivers_nrf/twi_master
../../../../../../components/drivers_nrf/twis_slave
../../../../../../components/drivers_nrf/uart
../../../../../../components/drivers_nrf/usbd
../../../../../../components/drivers_nrf/wdt
../../../../../../components/libraries/bsp
../../../../../../components/libraries/button
../../../../../../components/libraries/crc16
../../../../../../components/libraries/crc32
../../../../../../components/libraries/csense
../../../../../../components/libraries/csense_drv
../../../../../../components/libraries/ecc
../../../../../../components/libraries/experimental_section_vars
../../../../../../components/libraries/fds
../../../../../../components/libraries/fstorage
../../../../../../components/libraries/gpiote
../../../../../../components/libraries/hardfault
../../../../../../components/libraries/hci
../../../../../../components/libraries/led_softblink
../../../../../../components/libraries/log
../../../../../../components/libraries/log/src
../../../../../../components/libraries/low_power_pwm
../../../../../../components/libraries/mem_manager
../../../../../../components/libraries/pwm
../../../../../../components/libraries/queue
../../../../../../components/libraries/scheduler
../../../../../../components/libraries/slip
../../../../../../components/libraries/strerror
../../../../../../components/libraries/timer
../../../../../../components/libraries/twi
../../../../../../components/libraries/uart
../../../../../../components/libraries/usbd
../../../../../../components/libraries/usbd/class/audio
../../../../../../components/libraries/usbd/class/cdc
../../../../../../components/libraries/usbd/class/cdc/acm
../../../../../../components/libraries/usbd/class/hid
../../../../../../components/libraries/usbd/class/hid/generic
../../../../../../components/libraries/usbd/class/hid/kbd
../../../../../../components/libraries/usbd/class/hid/mouse
../../../../../../components/libraries/usbd/class/msc
../../../../../../components/libraries/usbd/config
../../../../../../components/libraries/util
../../../../../../components/softdevice/common/softdevice_handler
../../../../../../components/softdevice/s132/headers
../../../../../../components/softdevice/s132/headers/nrf52
../../../../../../components/toolchain
../../../../../../external/segger_rtt
../config

I wish you luck!

Lola gravatar image

Posted April 30, 2017, 3:32 p.m.

God, and all of that you have to do for every project ? this tutorial show very specific things you must do for the BLE to work, I don't want to think how many things I am going to miss if I try to write software that uses any other kind of components . Its cool that you wrote this tutorial but this seems like a nightmare.

Posted May 17, 2017, 8:18 a.m.

It looks like something isn't quite 100% in the libraries shipped with SES 3.12 at least. printf("%02d", 5) gives you "2d" instead of "05". This is used behind the scenes when logging floats using NRF_LOG_FLOAT_MARKER and NRF_LOG_FLOAT().

I'm a little concerned there might be other subtleties as well. SES isn't officially supported by Nordic, so things obviously haven't been tested as well either.

I filed a bugreport for the printf issue in the SES forum: http://forum.segger.com/index.php?page=Thread&threadID=4120

evgeny.erlihman@sbdinc.com gravatar image

Posted June 29, 2017, 10:28 p.m.

I just want to make sure i am not missing anything. I saw, on several posts in this forum, that the segger embedded studio is free. But if i look at the license, it is only free if you do evaluation. So if i use it for a real product, i have to pay for it?

rogerclark gravatar image

Posted June 29, 2017, 10:50 p.m.

I am not a lawyer, but my understanding, this is NOT a free product.

I do not see anything in the license to suggest it's free, for any form of usage apart from initial evaluation.

Sign in to comment.

Related posts by tag