This post is an introductory tutorial to SEGGER Embedded Studio. If you haven't already please skim through this post https://devzone.nordicsemi.com/blogs/825/segger-embedded-studio-cross-platform-ide-w-no-cod/ but don't follow along with it. This is the new and improved tutorial using the nRF device pack and assumes no prior knowledge on Embedded Studio.
After following this tutorial you will be able to build, debug and run a BLE project on nRF5x devices! You will also be able to load a softdevice (and any other file of your choice, i.e. a bootloader) to your board upon loading your application.
We just released V2.16 of Embedded Studio, which includes some improvements based on your / blog readers' feedback:
To follow along with this post download and install each of the following:
Open SEGGER Embedded Studio V2.14. If this is the first time you will see the Dashboard Welcome Screen. If you've already been using Embedded Studio make sure you close all open solutions. The first thing we need to do is install the CMSIS and nRF Device packages. Go to "Tools -> Packages -> Manually Install Packages" and select nRF.emPackage.
Now in "Tools -> Package Manager..." update the packages by clicking the "Refresh package list" button in the upper right hand corner. Select the "CMSIS-Core Support Package" by clicking it and then click "next" (right lower corner) and follow the instructions to download and install this package. Now make sure the CMSIS-Core Support Package and the Nordic Semiconductor nRF CPU Support Package are both installed.
Embedded Studio allows you to import Keil and IAR projects. In this tutorial we will import the bleapp_hrs_s132_pca10040 example (if you are using an nRF51 Series device or the nRF52 Preview DK import the corresponding uVision project file and follow along - minor differences will be highlighted along the way). This feature makes Embedded Studio plug & play with our SDK. Go to "File -> Open IAR EWARM / Keil MDK Project" and select '\nRF5_SDK...\examples\ble_peripheral\ble_app_hrs\pca10040\s132\arm5_no_packs\ ble_app_hrs_s132_pca10040.uvprojx.' Make sure you select nRF_EXE as the template for this project.
Our project will get its structure from the Keil uVision project we imported. All the source files, preprocessor definitions, user include directories and many project settings will be carried over from Keil. The nRF_EXE template (from our nRF device package) configures the rest of our project settings (memory map, flash section placement, etc...) and adds the system/startup files to our project.
At this point we are almost done! But we need to make some minor adjustments to compile our project.
At this point your project should compile with no errors or warnings (but it won't run correctly)! Build it and make sure!
As with every BLE project we will need to reserve some FLASH and RAM for the softdevice. To do this we need to set the Section Placement Macros used by "flash_placement.xml". This file tells our linker where to put the different parts of our application in FLASH and RAM. Go to "Project Properties -> Linker -> Linker Options" and in "Section Placement Macros" set FLASH_START=0x1b000 RAM_START=0x20001f00 (see screenshot below) or whatever these addresses should be for your specific softdevice.
Now we may need to edit the memory map for our device (most likely if you are using the nRF52 Preview DK). Go to "Edit Memory Map" (right above Import Section Placement) and double check that this is correct for your device. If you are using the nRF52 Preview DK change the size of RAM to 0x8000.
Now we want Embedded Studio to automatically program the softdevice to our board along with our application whenever we run/debug. To do this go to "Project Properties -> Debugger -> Loader Options" and set "Additional Load File" to the full path of your softdevice.
Now rebuild your project. Everything should compile without warnings or errors and you should notice that your application is leaving some space for the softdevice!
At this point you should be able to run and debug this application. Embedded Studio will program the softdevice and then the application. Your program should run until the first instruction in main().
However you will hard fault. We have a few more fixes to do...
Rebuild and run the application. Everything should work!
Thanks to all the great feedback on the last post about SEGGER Embedded Studio we decided to make this post! Note that there are still little workarounds we have to do that will be fixed very shortly. We are working with SEGGER to make Embedded Studio even easier to use with nRF5x devices. Please continue to give us feedback so we can keep improving! Nordic customers using OS X/Linux are no longer second class citizens and your feedback is driving this initiative!
Please experiment around with Embedded Studio. Tell us what you like, what you don't like, what you want to see and why you need this to be fully supported in the future!