Setting up Segger on a mac or pc and debug - step by step for humans

Most guides out there are unclear and made for machines. Here is a full guide how to setup Segger for mac OS X with some example project from the SDK ( or even a PC but not tested), and also how to debug like a human not using terminal. ( or using it if you feel more clever)

All steps here most be done for every project(except step 10), thats because the hardware industry is still stuck in the 90's, and UI/UX are new terms for them. While Eclipse is slightly more into 2000's , setting it up is a real, real nightmare .

Daniel Wang, and Jan Tore Guggedal , 2 great guys that helped me in this nightmare.

You need :

  • Nordic dev kit NRF52832 / any other board with a JTAG Segger SWD programmer .

  • SDK13 (and up)

  • files at the bottom of this guide.


  1. download SDK save in a known location , download Segger studio. In Segger go to Tools-> package manager -> Install nRF CPU Support Package. Install it.

  2. In Segger: file->import IAR../Keil project

  3. navigate to: sdk location/examples/ble_peripheral/ble_app_hrs/pca10040/s132/ arm5_no_packs/ projectName.uvprojx . You can choose any other project.

  4. In Segger: project->build configuration , remove flash_s132 file by clicking the minus. We don't need it.

  5. On the left there is the project inspector, open the folder "internal files", remove all files(right click)

  6. Download from this guide(bottom) the files: set_nrf52_Startup.s , system_nrf52.c, thumb_crt0.s.

  7. On internal files folder(5) right click -> add existing file, add all the files from (6).

  8. On project inspector, right click on project name-> edit options-> C/C++-> preprocessor-> user include directories -> open this tab and add to the list: ../../../../../../components/device

  9. On project inspector, right click on project name-> edit options-> Debugging -> loader -> additional load file[0] , open this and add the path: sdk location/components/softdevice/s132/hex/..softdevice.hex

  10. go to Segger install folder: Applications->Segger studio->targets , replace the file flash_placement.xml, with the file in this guide (bottom). It will be used on all of your projects automatically.

  11. On project inspector, right click on project name-> edit options-> section placement macros. open this and add this 2 lines:


SRAM_START=0x20002000 //**pay attention

PAY ATTENTION: This tells the chip where the application start in memory. First we make place for soft device then to the app. to find out the exact address to put here in your project go to: PCA10040/s132/armgcc/ and open the file that ends with .ld in text editor. look there into RAM (rwx) : ORIGIN to get the right address. If its not right he will NOT ADVERTISE. Soft device is the software for the Bluetooth stack. ( protocols, etc).

Basically you can now go to Build->build and run, it should flash the device.


  1. If you get 100 errors for duplicates in definitions got to project->edit options -> linker -> allow multiple definitions - set this one to YES , default is no. (Thanks Daniel Wang!)
  2. According to the great Jan Tore Guggedal , you have to do some other stuff if its not working yet on your mac :
  • right click on project->edit options->general->property group files-> add this : $(PackagesDir)/nRF/XML/property_groups.xml click OK

  • right click on project->edit options->general->target processor change to nRF52832_xxAA.


You used to printf which is great but in real time it affects the program , so you can use this to print: NRF_LOG_INFO("I AM HUMAN!\r\n"); , its called RTT . To see what you print go to: Debug ->go , then hit the little green play button on the top. You will see your program prints on the bottom.


  1. Open terminal type : JLinkExe, you will see a bunch of stuff, type connect, and then follow the default values and type them in to create connection
  2. open a different terminal window, keep 1 open, type : JLinkRTTClient ( assuming you installed the Segger Jlink package already) you will start get your log prints in this window.


This are the files that you need, they are already modified according to the guides here. Except from the .xml file that is generic, you need them for every project. First 3 should be saved in a place you can always open, the last should be placed according to number 10.





You can use this guide to modify the files in your own SDK instead of downloading these files.(already modified)