[Update] I’ve published a more up-to-date version of this blog post that covers all three major operating systems (macOS, Windows, and Linux) using a different IDE. Check it out here: The complete cross-platform nRF development tutorial

Today’s tutorial focuses on setting up the environment for nRF52 Mac development and debugging for Bluetooth Low Energy applications. Specifically, I will be using the new Nordic nRF52840 Preview Development Kit board that supports the enhanced features of Bluetooth 5 (including longer range, bigger advertisements and increased speed).

A few notes about the setup/environment as well as the goals of this tutorial:

  • We’ll be running on macOS Sierra v10.12.4 (on a late-2016 15″ MacBook Pro)
  • We will be using the NetBeans IDE for this tutorial (really any IDE that supports gdb and gdbserver connection should work with additional customizations)
  • We’ll be using the nRF52840 Preview Development Kit
  • We’ll be able to live-debug (runtime debug) the application within the IDE and stepping through source code
  • The power of running within a macOS or Linux environment vs. Windows is the capabilities for automation and automated testing
  • This will be a first in a series of blog posts focused on deep technical implementations of BLE applications on different development kits
  • Nordic Semiconductor modules have great gcc support which makes it relatively easy to get started on a macOS or Linux environment
  • This tutorial is intended to serve as a complete tutorial that guides you step by step on setting up your environment from scratch (this should be a one-time thing)
  • I ran through all these steps with Xcode already installed on my Mac, so I recommend installing it first to be able to run through the tutorial successfully.

On macOS, unless you’re running within a Virtual Machine, you’re stuck with following tutorials that help you set up with Eclipse (or you can shell out some serious money for IAR or Keil). I’m a big fan of open-source tools such as GCC and believe they have some major advantages over proprietary and IDE-based tools (automation, consistency across multiple platforms…etc).

I’m personally not a big fan of Eclipse (although I realize it’s the most popular open-source IDE for  embedded developers) – I just find it a bit slow and too clunky whereas NetBeans is more simplified and provides a better user experience. I’ve been using NetBeans for embedded (both Linux and microcontroller level) development for over 10 years now. (If you’re not aware, Microchip’s most recent IDE called MPLAB X is actually based on NetBeans. Other vendors have done the same but with Eclipse.)

Alright, enough with all this Eclipse vs. NetBeans dilemma. Let’s get technical.

The nRF52 series

The nRF series are one of the most popular Bluetooth low energy chips, and are used in many BLE applications. Some of the reasons why they’ve been a top choice for many are:

  • The new nRF52 chips support Bluetooth 5.
  • Support for multiple development environments and toolchains including GCC, which gives developers more freedom and flexibility over what other vendors provide.
  • The excellent support you get from Nordic’s Developer Zone.
  • Support by new open source IoT and BLE solutions (nRF5x series is supported by both the Zephyr Project and MyNewt which are gaining popularity because of their openness and strong capabilities)

From Nordic’s Infocenter:

The nRF52 Series of system on chip (SoC) devices embed a powerful yet low-power ARM® Cortex®-M4 processor with our industry leading 2.4 GHz RF transceivers. In combination with the very flexible orthogonal power management system and a programmable peripheral interconnect (PPI) event system, the nRF52 series enables you to make ultra-low power wireless solutions.

The nRF52 Series offers pin-compatible device options for Bluetooth® low energy, proprietary 2.4 GHz, and Apache®solutions giving you the freedom to develop your wireless system using the technology that suits your application the best. Our unique memory and hardware resource protection system allows you to develop applications on devices with embedded protocol stacks running on the same processor without any need to link in the stack or strenuous testing to avoid application and stack from interfering with each other.

The nRF52 runs a proprietary BLE stack provided by Nordic Semiconductor called the SoftDevice.

From Nordic’s Infocenter:

A SoftDevice is a wireless protocol stack library for building System on Chip (SoC) solutions.

SoftDevices are precompiled into a binary image and functionally verified according to the wireless protocol specification, so that all you have to think about is creating the application. The unique hardware and software framework provide run-time memory protection, thread safety, and deterministic real-time behavior. The Application Programming Interface (API) is declared in header files for the C programming language. These characteristics make the interface similar to a hardware driver abstraction where device services are provided to the application, in this case, a complete wireless protocol.

Hardware Requirements

To follow this tutorial you will need the following:

  • Nordic Semiconductor nRF52 Development Kit
  • A micro-USB to USB cable (for connecting the development kit to your PC)
  • A macOS computer (MacBook Pro, MacBook, MacBook Air…etc)

Make sure your dev kit is configured as follows:

nRF Power Source is set to VDD (middle-position)
The top-right switch is set to DEFAULT
The bottom-left switch is set to ON


Download NetBeans

NetBeans is an open source IDE that’s targeted towards Java development but supports other development environments including C & C++. Since it is JVM-based it can run on all the major platforms including macOS, Linux, and Windows. You can download the latest version of NetBeans here. Make sure you download the C/C++ (or “All” version which includes all supported technologies). I am running with version 8.2 (latest as of May 2017). After the download is complete go ahead and install the application.

NetBeans Download C/C++ Option

Download nRF tools and SDK

There are a couple of tools that you’ll need to download from Nordic Semi’s site to get started with the nRF52840 development kit. All can be found under the Downloads section HERE. Download each of these to your local machine (preferably you local Downloads folder).

  1. nRF5x SDK: nRF5-SDK-zip. (I’m running with version 13.0.0).
  2. nRF5x Command Line Tools: nRF5x-Command-Line-Tools-OSX (I’m running with version 9.4.0)

Download the ARM GCC toolchain

Download the latest version from this link. I’m running with version 6-2017-q1-update. Look for the Mac OS X 64-bit link.

Download and install the SEGGER tools

Download the tool here. Look for the J-Link Software and Documentation pack for MacOSX download link under J-Link Software and Documentation Pack. After downloading go ahead and install the software.

Setting up the downloaded tools

To make things easy we’ll put all the tools in one folder.

Start by running a terminal session (⌘ + Space bar -> type “terminal” -> return).

$ mkdir -p ~/opt
$ cd ~/opt
$ tar xjvf ~/Downloads/gcc-arm-none-eabi-6-2017-q1-update-mac.tar.bz2
$ mkdir -p nRF5_SDK_13.0.0
$ cd nRF5_SDK_13.0.0
$ tar xjvf ~/Downloads/nRF5_SDK_13.0.0_04a0bfd.zip
$ cd ~/opt
$ mkdir -p nRF5x-Command-Line-Tools_9_4_0_OSX
$ cd nRF5x-Command-Line-Tools_9_4_0_OSX
$ tar xjvf ~/Downloads/nRF5x-Command-Line-Tools_9_4_0_OSX.tar
[/simterm]After that you’ll want to configure the SDK to point to the correct compiler that you installed.
First, run the following command:
[simterm]$ ~/opt/gcc-arm-none-eabi-6-2017-q1-update/bin/arm-none-eabi-gcc –version[/simterm]
You should see an output similar to:
Locate the Makefile.posix file in a Finder session (under ~/opt/nRF5_SDK_13.0.0/components/toolchain/gcc) and edit the file to correspond to the version and location we have it installed in. For example, mine changed from:
Note: If you are using nRF SDK 14.0.0 or above, you will need to include “/bin/” appended to the end of the path.

Install a serial terminal program

You can use any serial terminal program that runs on macOS. I prefer a multi-platform program called CoolTerm (download it here).

Set up the development project in NetBeans

We’ll be running an example included in the nRF SDK called ble_app_hrs (Heart Rate Service demo).

Launch NetBeans.

Configure the armgcc toolchain.
Navigate to the Netbeans menu -> Preferences -> C/C++ tab -> Build Tools
Click on Add
Browse and locate the folder for the gcc compiler (mine is at ~/opt/gcc-arm-none-eabi-6-2017-q1-update)

Click Open
Choose GNU Mac for Tool Collection Family
Type a name like “GNU_ARM
First we need to add the path to the nRF command line tool to our Run path so we can flash the target from the IDE
Click on $PATH
Under Modify Run Command Path:
Add the folder for nrfjprog to the PATH variable
(for me I added ;${HOME}/opt/nRF5x-Command-Line-Tools_9_4_0_OSX/nrfjprog/)
Click OK
Set the C Compiler, C++ Compiler, Assembler, Debugger command as following (make should already be set):
C Compiler: ${HOME}/opt/gcc-arm-none-eabi-6-2017-q1-update/bin/arm-none-eabi-gcc
C++ Compiler: ${HOME}/opt/gcc-arm-none-eabi-6-2017-q1-update/bin/arm-none-eabi-g++
Assembler: ${HOME}/opt/gcc-arm-none-eabi-6-2017-q1-update/bin/arm-none-eabi-as
Debugger: ${HOME}/opt/gcc-arm-none-eabi-6-2017-q1-update/bin/arm-none-eabi-gdb
(If you’re going to be using NetBeans a lot for developing on the nRF platform go ahead and set the compiler as the Default)
Press OK

Create the NetBeans project
Navigate to the File menu -> New Project

Choose C/C++ Project with Existing Sources
Click Next
Click the Browse button and navigate to the folder ${HOME}/opt/nRF5_SDK_13.0.0/examples/ble_peripheral and select the ble_app_hrs folder
Select “Custom” under “Select Configuration Mode:
Disable the “Use Build Analyzer” option
Hit Next

Make sure the Pre-Build Step option is checked
Click Browse and navigate to the folder ${HOME}/opt/nRF5_SDK_13.0.0/examples/ble_peripheral/ble_app/hrs/pca10056/s140/armgcc/
Hit Select
Under Custom Command -> Command type: make

Hit Next until you get to the Project Name and Location step
Name the project (preferably a name different than the original ble_app_hrs name)
Click Browse and choose a folder where you want the NetBeans project to be created (I prefer a Projects folder under my home directory)
Click Finish
The project should start building automatically and (fingers-crossed) the build will succeed.

This build is fine if we want to just flash the target and let it run. However, if we want to debug the application we need to make some modifications to Makefile.
In the Projects window look for the label Important Files, expand it and double click on Makefile.
Scroll down the file until you find the section:

change the line to:

This will remove the code optimization performed by the compiler and also ensure all debug symbols needed by gdb are produced.
After this step, you’ll want to clean and rebuild your project.

Configuring the NetBeans project
Right Click on the Project in the Project window, Click Properties
Navigate to Code Assistance -> C Compiler
Click the “…” next to Include Directories
Click Add
Navigate to ${HOME}/opt and click on the nRF5_SDK_13.0.0 folder, then click Select
Press OK
Right-click on the Project -> Code Assistance -> Reparse Project
This will make sure that functions and API calls are parsed correctly, and that you can navigate to function and symbol definitions and be able to browse the source code more efficiently (the whole point of using an IDE!).
Note: If you’re running into issues and still seeing a lot of red underlined #include and function calls, try this:

Right click on the Project
Click on Code Assistance
Configure Code Assistance
Select Analyzer : Search file system for C/C++ header files
Hit Next
Browse to locate the …..opt/nRF5_SDK_13.0.0 folder and select it
Hit Next
Hit Finish

Configure the Run command (to flash the target)
Right click the Project name -> Properties -> Run
Replace the Run Command with make flash_softdevice flash
Your configuration should look something like this:

Hit OK
Make sure the development kit is connected to your computer and the LED (labeled LED5) right next to the MCU labeled PCA10056 is lit-up.
Hit the Play button at the Top of the Editor window and make sure the operation runs successfully.
The Output window should look something like this:

Note: You can remove the “flash_softdevice” part, it is only needed once or when the softdevice firmware changes. (I prefer to keep it just in case – worth the few extra seconds added…)

Setting the Build Result file
Project Properties -> Make -> Build Result -> “…” button
Navigate to the ble_app_hrs/pc10056/s140/armgcc/_build/nrf52840_xxaa.out (make sure you build before this step, otherwise an output file and the _build folder won’t exist)

Set up gdbserver in NetBeans
Tools menu -> Plugins -> Available Plugins (may need to click “Check for Newest”)
Find the C/C++ gdbserver plugin and install it


In a terminal window, run the following command:
[simterm]$ JLinkGDBServer -device nRF52840_xxAA -if swd -endian little -speed 1000 -port 2331 -singlerun -notimeout[/simterm]
Let’s make sure we understand each of the arguments:
-device nRF52840_xxAA: sets the device to the nRF52840
-if swd: sets the interface to SWD or Serial Wire Debug which is the interface used on the development kit we’re using
-endian little: sets the configuration to little endian
-speed 1000: sets the speed to 1000 Hz or 1 kHz
-port 2331: sets the IP port for the gdbserver to 2331 (you can change it to whatever port number you want, just make sure you change it accordingly in NetBeans
-singlerun: this will configure gdbserver to accept a single connection from gdb, and will exit upon termination of that one debug session
-notimeout: this will disable any timeout waiting for a connection from gdb.Once you run the command you should see an output similar to this:
(Insert picture of terminal session showing the gdbserver creating the session)

Now on the actual debugging!
Here we’ll learn how to debug a target program in real-time and step through the code.
First set a breakpoint in the main() function in main.c (in our example it is located under ble_app_hrs/main.c and the last part of that file.
I set mine at log_init(); 
The way you set a breakpoint is click in the margin on the line number of the desired line.

Now make sure your JLinkGDBServer is running in the terminal and come back to NetBeans.
Note: Reader Mike Wirth pointed out that there are some issues with running JLinkGDBServer in a separate Terminal window. The solution is to run the command from within NetBeans. You can do so by navigating to the menu Window -> IDE Tools -> Terminal and running the command from there (within NetBeans).  
Click the Dropdown menu arrow on the debug button then select “Attach Debugger”.

Make sure the Target is set to: remote localhost:2331 (this is the port we set for the GDB server on the local machine)

Basically, JLink connects to the Interface chip (the chip on the dev kit that creates a mounted drive. It then creates a proxy gdbserver on the local machine that allows a gdb process to connect to and debug the target MCU (in this case the nRF 52840). Once you hit OK, you should see NetBeans connect to the gdbserver and momentarily it’ll stop at the breakpoint you set in the main function. It may take a few seconds before it hits the breakpoint, but eventually the breakpoint line will be highlighted in GREEN.

If you run into issues and don’t see it stop at the breakpoint, try restarting the JLinkGDBServer command
We ran JLinkGDBServer in singlerun mode, which means once you hit the Stop Debug button in NetBeans you will have to start the GDBServer again. To run continuously run the command without the “-singlerun” argument. Then when you stop debugging and initiate the remote debugging again JLink will restart the target.

Note: there are some well-known difficulties and challenges with debugging applications running with the SoftDevice stack. More about it here and here


The interface MCU also provides a serial output that you can monitor through a terminal program on your development machine. You may have to do a trial and error, for me the serial shows up as “usbmodem1461”. Set the Baud rate at 115200, hit OK then click Connect.

You should see log messages when you connect to the BLE peripheral. For example:

You can increase the log level by modifying the following in sdk_config.h at …./ble_app_hrs/pca10056/s140/config/sdk_config.h


The default value for NRF_LOG_DEFAULT_LEVEL is 3. The different levels are:
<0=> Off
<1=> Error
<2=> Warning
<3=> Info
<4=> Debug

Summary and Closing

In this tutorial we went over how to set up, install and configure a project in NetBeans to develop for the nRF52840 Preview Development Kit. In the upcoming blog posts I will be going over:

  • More in-depth tutorials for development of actual BLE applications
  • Utilizing the new Bluetooth 5 features
  • Other tutorials for setup and development on other popular BLE dev kits.

Feel free to add any comments or questions in the comments section below. Hope you found this post useful!


  1. Avatar Kaushik on July 17, 2018 at


    I am really glad I found this tutorial. Its been very helpful. I was trying to configure the GCC with Eclips and it seemed to always have some problem

    I am using nRF51 on a windows machine. Everything till the debugging works great. I have been trying to get the debugging to work and is not having the greatest luck.

    I have the J-Link GDB server running and I am using SWD 2 wire with a J-Link Base. Every time I try to attach the debugger I don’t see anything happening other than a window with “: No such file or directory.” I also noticed that I need to run the GDB server from NetBeans so I did that as well and I also selected a GDBInit file that I found inside the SEGGER folder.

    Any help to resolve this will be greatly appreciated.

    Thank you and thanks again for this great tutorial.

  2. Avatar Mark Conover on May 28, 2018 at

    Nothing happened at all. No pop-up window. But, the good news is that I worked around the problem by ditching Netbeans for Segger’s Embedded Studio. So, I’m productive again. Thank you again. -Mark

    • Mohammad Afaneh Mohammad Afaneh on May 28, 2018 at

      Ok, great! I was gonna say, if you’re using it for nRF5x development, then you’re much better off using SES (as I’ve switched to using myself as well).

      Glad that’s working well for you!


  3. Avatar Mark Conover on May 19, 2018 at

    A very detailed and admirably well written tutorial. I have encountered one issue. I’m running NetBeans 8.2. I have successfully been able to compile and flash the device. The gdbserver is running, reporting that it is connected.

    But: When I click on “Attach Debugger”, no pop-up window is displayed to permit configuration.

    • Mohammad Afaneh Mohammad Afaneh on May 28, 2018 at

      Thanks, Mark.

      It’s a bit difficult to debug NetBeans issues sometimes. Are you still running into this issue? Are you using it to program and debug nRF52 applications? What happens when you click on “Attach Debugger”? Anything at all?

  4. Avatar Roger Archibald on April 18, 2018 at


    When I first wanted to mess with the NRF52 I looked at some similar tutorials and ultimately decided to buy a cheap Windows machine rather than mess with GCC. It was all going great until my project hit 32.8K and Keil said no more. I was worried that porting my project to GCC would be a major pain, but your directions made it very painless simple and I’m back making progress (and not messing with 180+ second compile times with the cheapest Windows machine I could find!)

    You’ve got a gift for explanation! It’s rare to find any tutorial with so much explanation in so few words. It’s very clear and concise, and very much appreciated!

    • Mohammad Afaneh Mohammad Afaneh on April 18, 2018 at

      Thanks, Roger! Glad you’ve found the tutorial helpful!

  5. Avatar Ludo on April 11, 2018 at

    Really great tutorial! Thank’s a lot!

    I can build on what few people said about that error :
    make: nrfjprog: No such file or directory
    make: *** [flash_softdevice] Error 1

    I was struggling with that one too, and the reason was quite silly to be honest : I wasn’t using the GNU_ARM tool collection that we created before. To be sure that we’re using that one, you have to go in Project properties > Build and be sure that it’s GNU_ARM that is selected and not the default one “GNU”. For those who are using netbeans for different kind of project and didn’t put the GNU_ARM as default tool, it could be worth to mention it during the tutorial. Here is a picture to bring clarity : https://imgur.com/LqiW4aP

    Have a nice day


  6. Avatar Lorenzo on April 5, 2018 at

    I thought it may be useful for you to see the JLink output…here it is!

    cm536ll:~> JLinkGDBServer -device nRF52832_xxAA -if swd -endian little -speed 1000 -port 2331 -notimeout -singlerun
    SEGGER J-Link GDB Server V6.20 Command Line Version

    JLinkARM.dll V6.20 (DLL compiled Sep 8 2017 18:05:19)

    Command line: -device nRF52832_xxAA -if swd -endian little -speed 1000 -port 2331 -notimeout -singlerun
    —–GDB Server start settings—–
    GDBInit file: none
    GDB Server Listening port: 2331
    SWO raw output listening port: 2332
    Terminal I/O port: 2333
    Accept remote connection: yes
    Generate logfile: off
    Verify download: off
    Init regs on start: off
    Silent mode: off
    Single run mode: on
    Target connection timeout: none
    ——J-Link related settings——
    J-Link Host interface: USB
    J-Link script: none
    J-Link settings file: none
    ——Target related settings——
    Target device: nRF52832_xxAA
    Target interface: SWD
    Target interface speed: 1000kHz
    Target endian: little

    Connecting to J-Link…
    J-Link is connected.
    Firmware: J-Link OB-SAM3U128-V2-NordicSemi compiled Jul 24 2017 17:30:12
    Hardware: V1.00
    S/N: 682040226
    Checking target voltage…
    Target voltage: 3.30 V
    Listening on TCP/IP port 2331
    Connecting to target…Connected to target
    Waiting for GDB connection…Connected to
    Reading all registers
    Read 4 bytes @ address 0x0000BA24 (Data = 0x0104F8D4)
    Read 2 bytes @ address 0x0000BA24 (Data = 0xF8D4)
    Read 4 bytes @ address 0x0000B9AA (Data = 0xF7F7B198)
    Read 2 bytes @ address 0x0000B9AA (Data = 0xB198)
    Read 4 bytes @ address 0x0000B9AA (Data = 0xF7F7B198)
    Read 2 bytes @ address 0x0000B9AA (Data = 0xB198)
    Reading 64 bytes @ address 0x00026F80
    Read 2 bytes @ address 0x00026F84 (Data = 0x3030)
    Setting breakpoint @ address 0x00026F84, Size = 2, BPHandle = 0x0001
    Starting target CPU…

  7. Avatar Lorenzo on April 5, 2018 at

    Hello again,

    I am facing a weird problem now that I started using the Debug function.
    Actually, everything seems to be working fine: I can start the JLinkGDBServer (I tried both from an external terminal and from the terminal inside Netbeans), I can attach the debugger, but then….nothing happens.
    By this I mean that I see printed on the JLinkGDBServer the text “Starting target CPU…”, and this stays there forever (I waited for 15 minutes, but nothing happened). A new file opens automatically in Netbeans, named “Disassembly”, which is empty, and the normal Debug buttons (run, stop, pause, step over etc.) are shaded, so I cannot click on them.
    I double checked that I correctly set the make –> build result path as you described in the post, and I double checked that I included in the Makefile the -ggdb flag. To be sure, I tried different projects, including original projects from Nordic examples I did not modify, I tried different USB ports on my PC and I tried applications both with soft device and without….still no luck.

    Do you have any idea where the problem could be?
    Just for you to know, I am working under Linux Ubuntu 16.04, but until now I did not find any difference at all between your guide and my system…..Thanks a lot!

    • Mohammad Afaneh Mohammad Afaneh on April 5, 2018 at

      Hi Lorenzo,

      Have you considered moving to Segger Embedded Studio instead? Unfortunately, I have moved away from NetBeans (at least for nRF development) and have recently switched to using Segger Embedded Studio (SES). SES is a professional IDE with built-in support for J-Link and target debugging, and best of all Segger provides a free license for nRF developers!

      It’s also cross-platform so it works on Linux, macOS, and Windows with minimal setup involved. I’m currently working on a blog post detailing how to set it up and use it for nRF development.

      • Avatar Lorenzo on April 6, 2018 at

        Hi Mohammad,

        thank you! I didn’t consider it yet until now because of the cost of the license and because I liked having all my code on one IDE (I do not program only nRF chips). I will have a look while waiting for your blog post then. Thank you.

  8. Avatar Lorenzo on March 16, 2018 at

    Hello, thanks a lot for the wonderful tutorial! I followed it for Ubuntu 16.04 and everything worked perfectl!
    I just wanted to signal you a very small detail: when you describe the modifications in the Makefile.posix, you say that for SDK >= 14.0 you
    need to include “/bin” to the path. Actually, it is “/bin/” (an additional slash is required).
    Thanks again!

  9. Avatar John-Paul on January 31, 2018 at

    Hi Mohammad,

    First thing, great tutorial man! Truly appreciate the contribution you made. Second I am encountering an error when I go to debug. app_error_weak.c opens up and NRF_LOG_INFO (line 1040) is highlighted instead of my break point @ log_init() (line 1027). On my terminal I am getting the following:

    Read 4 bytes @ address 0x00009F30 (Data = 0x0104F8D4)
    Read 2 bytes @ address 0x00009F30 (Data = 0xF8D4)
    Read 4 bytes @ address 0x00009EB6 (Data = 0xF008B198)
    Read 2 bytes @ address 0x00009EB6 (Data = 0xB198)
    Read 4 bytes @ address 0x00009EB6 (Data = 0xF008B198)
    Read 2 bytes @ address 0x00009EB6 (Data = 0xB198)
    Read 2 bytes @ address 0x00028692 (Data = 0x2000)
    Read 2 bytes @ address 0x00028A80 (Data = 0x4C27)
    Setting breakpoint @ address 0x00028A80, Size = 2, BPHandle = 0x0001
    Starting target CPU…
    …Breakpoint reached @ address 0x00028A80
    Reading all registers
    Read 4 bytes @ address 0x00028A80 (Data = 0x49284C27)
    Removing breakpoint @ address 0x00028A80, Size = 2
    Reading 64 bytes @ address 0x00028AC0
    Reading 64 bytes @ address 0x00028A80

    I can send you screen shots if you’d like.

    Another thing I am seeing is a case p_ble_evt not being recognized by the compiler… Line 780 case BLE_GAP_… “unable to resolve” any idea why the code assistant / compiler isn’t understanding this case, I’m guessing these are enumerated in a header filer somewhere….

    Thanks Mohammad

    • Mohammad Afaneh Mohammad Afaneh on February 1, 2018 at

      Thanks, John-Paul! I’m glad you’ve found it useful.

      What you’re seeing in regards to the debug mismatch usually happens if the code flashed to the device is not up-to-date with the code you have loaded in the IDE. However, if that’s not the case, it may be that you do not have the right compiler settings in the Makefile (sometimes code optimization could cause such issues to occur). Can you check the compiler flags in Makefile? Try adding the following in the CFLAGS section:

      CFLAGS += -g3 -ggdb

      In the case of the symbol not being recognized by NetBeans, try following these steps:
      – Right-click on the project
      – Go to Code Assistance -> Configure Code Assistance
      – Under “Select Analyzer”, choose “Search file system for C/C++ header files”
      – Click Next
      – Select Browse and point it to the root folder of the SDK
      – Click Next
      – Click Finish
      – Wait for the IDE to reparse the project

      Let me know if this helps fix the issue.

      On another note, I recommend you check out Segger Embedded Studio (SES) instead of NetBeans. I’ve been using NetBeans for a while but looked into SES recently after Nordic and Segger announced their partnership, and have decided to make the switch. I’ll be writing a tutorial in the near future on how to use SES for creating and developing a new project.


  10. Avatar Venkat Krishnan on December 5, 2017 at

    How do you set the run path for NetBeans?

    In the terminal, I added nrfjprog to the PATH variable but when I “run” the program on NetBeans I get the following error: “make: nrfjprog: No such file or directory”.
    Using the nrfjprog from the terminal I was able to successfully flash the softdevice on my nrf52 board.

    However, I still do not understand the reason for the error I got when I used the “run” command on the NetBeans IDE.

    • Mohammad Afaneh Mohammad Afaneh on December 6, 2017 at

      Hi Venkat,

      The run path in NetBeans is set under the menu: NetBeans -> Preferences -> C/C++ -> $PATH (next to the field labeled “Base Directory”) -> Modify Run Command Path.

      I have the path to nrfjprog set there.

      Hope this helps.

  11. Avatar Sai on November 8, 2017 at

    Makefile.posix needs to be updated in the below fashion. I think you need to give the path until -> bin. This worked for me.

    GNU_INSTALL_ROOT := /Users/saic/opt/gcc-arm-none-eabi-6-2017-q2-update/bin/
    GNU_VERSION := 6.3.1
    GNU_PREFIX := arm-none-eabi

    • Mohammad Afaneh Mohammad Afaneh on November 8, 2017 at

      Sai, yes. That’s actually a change that was introduced with nRF SDK version 14.0.0 (and above) – I will update the post to point that out though.

      Thanks for the comment!

  12. Avatar Norbert on November 7, 2017 at

    I have problem with compile ble_peripheral/ble_app_uart. Size of my hex file is only 106,7kB while size of pre-compiled hex file “ble_app_uart_pca10056_s140.hex” in hex folder is 447,6kB. My binary doesn’t work. Should I link some other libs? How to do this?

    • Avatar Norbert on November 7, 2017 at

      I know how to fix it. In project properties at Run Command textbox should be “make flash_softdevice” (without quotes). Size of hex file is no matter – it’s just linker optimizes.

      • Mohammad Afaneh Mohammad Afaneh on November 7, 2017 at

        Glad you found out how to fix it. Was there anything wrong/misleading in the post that led to this?

  13. Avatar Nanditha on November 5, 2017 at

    HI, Thank you very much for a detailed article. It gave a a good start to move from Windows to Mac.
    I was also hoping if you can help me with setting nRFGoStudio on mac, I tried with Wine using PlayOnMac, but could not do so, as PlayOnMac did not support JLink_Windows_V620h nor the nRF5x-Command-Line-Tools_9_7_1_Installer.

  14. Avatar LukaszM on November 4, 2017 at

    Great article, I only have an issue with running debugger. After my JLinkGDBServer starts successfully and I start debugging session, I get this error:
    Debugger Error: \”/user/bin/make\”: not in executable format: File format not recognized

    I am stuck with this ad no sure where to look for and would appreciate any help.
    I use NetBeans 8.2, pca10028 board (nrf51822 chip).
    Few screenshots:

    1. JLinkGBDServer starts: https://ibb.co/bKOzNb
    2. Attaching debugger: https://ibb.co/ichthb
    3. Error 1 (displayed after attaching debugger): https://ibb.co/bP1m2b
    4. Error 2 (after trying to run debug session): https://ibb.co/bH462b

    • Mohammad Afaneh Mohammad Afaneh on November 4, 2017 at

      Thanks, Lukasz.

      I noticed your Target in the Attach Debugger window is missing the “remote” part. Try setting the Target value to this instead:

      remote localhost:2331

      Let me know if this fixes it. It may not be the only problem.

      • Avatar LukaszM on November 4, 2017 at

        Thanks for quick reply but it did not help. Gives me the same error.

        • Mohammad Afaneh Mohammad Afaneh on November 5, 2017 at

          Did you set the Build Result file?

          The instructions are listed under the section “Setting the Build Result file” in my post.

          • Avatar LukaszM on November 5, 2017 at

            It turned out that I forgot about it indeed, I am now able to debug when manually staring JLinkGDBServer and “Attach debugger” but when I try just “Debug” (F5) it gives me
            Degugger Error: \”/usr/bin/make\”: not in executable format: File format not recognised.
            Or it never meant to work that way?

          • Mohammad Afaneh Mohammad Afaneh on November 6, 2017 at

            Ok, glad that resolved the issue.

            Yes, starting/running the debugging session from the IDE (using F5) is meant when debugging local applications, not remote GDB debugging.

  15. Avatar Akshar Vastarpara on November 2, 2017 at

    Thank you for this great tutorial..
    I am gettine an error..
    make: /Users/akshar/Downloads/opt/gcc/arm-none-eabi-gcc: Command not found
    Cannot find: ‘/Users/akshar/Downloads/opt/gcc/arm-none-eabi-gcc’.
    Please set values in: “/Users/akshar/Downloads/opt/nrfsdk/components/toolchain/gcc/Makefile.posix”
    according to the actual configuration of your system.
    ../../../../../../components/toolchain/gcc/Makefile.common:129: *** Cannot continue. Stop.

    i have tried flash softdevice thing also but in there it didn’t work.. i have put the currect location at makefile.posix but that “-gcc” thing comes from somewhere which not in arm gcc..

    • Mohammad Afaneh Mohammad Afaneh on November 4, 2017 at

      Thanks, Akshar.

      What version of the SDK are you using? I just found out that v 14.0.0 and later has changed how the Makefile.posix file behaves. Now it expects the path to gcc but requires adding “/bin” to the path. So if you’re trying this with SDK v 14.0.0 or later, can you try this and report whether this fixes the issue?

      Try this in Makefile.posix:

      GNU_INSTALL_ROOT := /Users/akshar/Downloads/opt/gcc/arm-none-eabi-gcc/bin

      or whatever the correct path is on your system.

  16. Avatar MarcoF on October 27, 2017 at

    I am trying to follow all the directions but I cannot find Right-click on the “Project -> Code Assistance -> Reparse Project”
    I’m using the same OS and machine (13″) and the latest version of NetBeans C++ 8.2 with updates.

    Basically in the seciton: Configuring the NetBeans project , I can only set the C compiler include directories, any other steps :

    Project -> Code Assistance -> Reparse Project IS MISSING
    Code Assistance -> Configure Code Assistance IS ALSO MISSING

    The other difference is that I have a PCA10040 .. but beside the very first build I cannot move forward.

  17. Avatar mdb983 on August 31, 2017 at

    Thanks for the great tutorial.

    There were a few things i needed to change to get it all working correctly, so i’m passing this on in the hope it might help others.

    1. in the Makefile.posix the GNU_INSTALL_ROOT needed to point to the /bin folder. Using the latest GCC Toolchain, this might look something like this: /Users/yournamehere/opt/gcc-arm-none-eabi-6-2017-q2-update/bin/

    2. I used version 14 of the SDK, and seemingly this requires a later version of the command line tools. If you’re using the nRF52840 preview development kit, and the firmware is below 1.1.0, you’ll need to update the firmware. The most important thing is to ensure you have version 9.6 of the command line tools… nRF5x-Command-Line-Tools_9_6_0_OSX.tar. This can be found on the nRF52840 product page, under the download tab: http://www.nordicsemi.com/eng/Products/nRF52840#Downloads

    I made these couple of changes, replaceing the Command-Line_Tool reference in the above post with the later version and was able to build and flash without any problems. There is a post on the Nordic Site in regards to not being able to flash the board to the latest firmware: https://devzone.nordicsemi.com/question/111614/nrf52840-preview-dk-firmware-problems/

  18. Avatar Jonah on August 29, 2017 at

    I did, everything worked fine except line 3 of that. I received the following error message, I’m not sure what went wrong. Should I delete and re-download gcc ?

    tar xjvf ~/Downloads/gcc-arm-none-6-2017-q2-update-mac.tar.bz2
    tar: Error opening archive: Failed to open ‘/Users/jonahweyessa/Downloads/gcc-arm-none-6-2017-q2-update-mac.tar.bz2’

  19. Avatar Jonah on August 27, 2017 at

    Hey Mohammad,

    Thank-you very much that worked perfectly.

    On another note though, I’ve been going through some of the comments above and noticed some people had problems when it comes to building the project and having it run successfully. What worked for them unfortunately isn’t working for me. In the “Set up the development project in NetBeans” part after the final step when i go to build the project, i get the following error message:

    cd ‘/Users/jonahweyessa/OPT/nRF5_SDK_13.0.0/examples/ble_peripheral/ble_app_hrs/pca10056/s140/armgcc’
    /bin/sh: /usr/local/gcc-arm-none-eabi-4_9-2015q3/bin/arm-none-eabi-gcc: No such file or directory
    Cannot find: “/usr/local/gcc-arm-none-eabi-4_9-2015q3/bin/arm-none-eabi-gcc”.
    Please set values in: “/Users/jonahweyessa/OPT/nRF5_SDK_13.0.0/components/toolchain/gcc/Makefile.posix”
    according to the actual configuration of your system.
    ../../../../../../components/toolchain/gcc/Makefile.common:25: *** Cannot continue. Stop.

    Do you have any idea, how i can perhaps fix this ?

    Thanks again in advance as always Mohammad.

    • Mohammad Afaneh Mohammad Afaneh on August 28, 2017 at

      Hey Jonah,

      You’ll need to update the Makefile.posix file to point to the correct version of the gcc toolchain. There’s a step at the beginning of the tutorial under “Setting up the downloaded tools” that describes where to find the file and how to update it. Did you follow that step?

      • Avatar Jonah on August 29, 2017 at

        Actually I tried the other tar commands too, they just don’t seem to be working. The first time though they all worked fine except line 3 but this is the new error messages for the remaining two when I run the command.

        Jonahs-Air:nRF5_SDK_13.0.0 jonahweyessa$ tar xjvc~/Downloads/nRF5_SDK_13.0.0_04a0bfd.zip
        tar: Can’t specify both -c and -x
        Jonahs-Air:nRF5_SDK_13.0.0 jonahweyessa$ tar xjvc ~/Downloads/nRF5x-Command-Line-Tools_9_4_0_OSX.tar
        tar: Can’t specify both -c and -x
        Jonahs-Air:nRF5_SDK_13.0.0 jonahweyessa$

        • Mohammad Afaneh Mohammad Afaneh on September 6, 2017 at

          Jonah, are you still having trouble with the commands?

          For .zip files, you can just extract them by double clicking in macOS.
          For .tar files, these are already uncompressed files, so you can remove the “-c” option (I believe).

  20. Avatar Jonah on August 21, 2017 at

    Hey Mohammad,

    I’m having trouble at the very beginning stages of the process. When I go to compile all the tools into one folder, i am getting an error message. I’m not sure what is wrong but if you could help that would be awesome. Thanks again for this great tutorial, it’s sweet!

    The following is all from the Command + Space –> type “terminal” part of the tutorial all the way at the top, specifically line 3:

    This is the output i’m getting: tar xjvf ~/downloads/gcc-arm-none-eabi-6-2017-q2-update-mac.tar.bz2
    tar: Error opening archive: Failed to open ‘/Users/jonahweyessa/downloads/gcc-arm-none-eabi-6-2017-q2-update-mac.tar.bz2’

    • Mohammad Afaneh Mohammad Afaneh on August 21, 2017 at

      Hey Jonah,

      A couple of things to check:

      – Make sure that the file exists and matches the name you’re passing to ‘tar’.
      – Check the permissions on the file (use ‘ls -l’ to display them and make sure the file is at least readable).

      The ‘tar’ command is used for extracting and uncompressing the archive file in this case, so after you run it, it should create a folder that starts with “gcc-…”

      Hope this helps!

      • Mohammad Afaneh Mohammad Afaneh on August 21, 2017 at

        One thing I noticed is that you have “downloads” all lower case. Usually on macOS, it will be “Downloads” instead, and since names are case sensitive you’ll need to make sure they match.

  21. Avatar Mike on July 19, 2017 at

    Thanks for the great tutorial! I have followed your instructions for setting up the environment on Ubuntu 16.04 running inside Oracle VM VirtualBox. When I tried to flash the ble_app_hrs example, I run into the following errors:

    ERROR: There is no debugger connected to the PC.
    Makefile:243: recipe for target ‘flash_softdevice’ failed
    make: *** [flash_softdevice] Error 41

    RUN FINISHED; exit value 2; real time: 130ms; user: 30ms; system: 50ms

    Do you have any idea regarding to this issue? I greatly appreciate your inputs.

    • Mohammad Afaneh Mohammad Afaneh on July 19, 2017 at

      Mike, glad you found the tutorial useful.

      The only thing I can think of is that the USB port on which the development board is connected is not mounted to the VM.

      Try the following:
      – Unmount the device named JLINK from your host machine (should show up in your mounted drives)
      – Go to “Devices” under the top menu of the VM
      – Navigate to USB
      – Find and click on SEGGER J-LInk and click on
      – Make sure it is now showing with a check next to it

      I’ve seen problems with mounting the dev board to a VM, but it may work for you. Let me know if it works.

      Hope this helps.

      • Avatar Mike on July 24, 2017 at

        Thanks for your quick reply! Once the SEGGER J-link is selected in VM, I am able to flash the example to the development board. However, I still have some problem for debugging. When I insert the breakpoint and start the JLnkGDBServer, the breakpoint line is always red and never become green. Any ideas and suggestions? I really appreciate your great help!

        • Avatar Mohammad Afaneh on July 25, 2017 at

          Hi Mike, can you post the output of JLinkGDBServer? The output should show whether the breakpoint was recognized by the GDB Server or not – it would print out a confirmation of any breakpoints you set.

        • Avatar Krishna on July 27, 2017 at

          Great Tutorial ,Thanks Mohammad Afaneh. I followed your tutorial for my nRF52DK on UBUNTU 16.04 Everything is working well but while debugging i set breakpoint which never become Green .

          Here is the my terminal log on JLinkJDBserver:

          SEGGER J-Link GDB Server V6.16j Command Line Version

          JLinkARM.dll V6.16j (DLL compiled Jul 24 2017 18:54:20)

          Command line: -device nRF52832_xxAA -if swd -endian little -speed 1000 -port 2331 -notimeout
          —–GDB Server start settings—–
          GDBInit file: none
          GDB Server Listening port: 2331
          SWO raw output listening port: 2332
          Terminal I/O port: 2333
          Accept remote connection: yes
          Generate logfile: off
          Verify download: off
          Init regs on start: off
          Silent mode: off
          Single run mode: off
          Target connection timeout: none
          ——J-Link related settings——
          J-Link Host interface: USB
          J-Link script: none
          J-Link settings file: none
          ——Target related settings——
          Target device: nRF52832_xxAA
          Target interface: SWD
          Target interface speed: 1000kHz
          Target endian: little

          Connecting to J-Link…
          J-Link is connected.
          Firmware: J-Link OB-SAM3U128-V2-NordicSemi compiled Jul 24 2017 17:30:12
          Hardware: V1.00
          S/N: 682941412
          Checking target voltage…
          Target voltage: 3.30 V
          Listening on TCP/IP port 2331
          Connecting to target…Connected to target
          Waiting for GDB connection…Connected to
          Reading all registers
          Read 1 bytes @ address 0x00000000 (Data = 0x00)
          Reading 64 bytes @ address 0x00020EC0
          Reading 64 bytes @ address 0x00020F00
          Read 1 bytes @ address 0x00020EFE (Data = 0x00)
          Setting breakpoint @ address 0x00020EFE, Size = 4, BPHandle = 0x0001
          Starting target CPU…
          …Breakpoint reached @ address 0x00020EFE
          Reading all registers
          Read 1 bytes @ address 0x00000000 (Data = 0x00)
          Starting target CPU…
          …Breakpoint reached @ address 0x00020EFE
          Reading all registers
          Read 1 bytes @ address 0x00000000 (Data = 0x00)
          Starting target CPU…
          …Breakpoint reached @ address 0x00020EFE
          Reading all registers
          Read 1 bytes @ address 0x00000000 (Data = 0x00)
          Starting target CPU…
          …Breakpoint reached @ address 0x00020EFE
          Reading all registers
          Read 1 bytes @ address 0x00000000 (Data = 0x00)
          Starting target CPU…
          …Breakpoint reached @ address 0x00020EFE
          Reading all registers
          Read 1 bytes @ address 0x00000000 (Data = 0x00)
          Starting target CPU…
          …Breakpoint reached @ address 0x00020EFE
          Reading all registers
          Read 1 bytes @ address 0x00000000 (Data = 0x00)
          Starting target CPU…

          • Mohammad Afaneh Mohammad Afaneh on July 27, 2017 at



            Looks like the breakpoint gets set correctly (Setting breakpoint @ address 0x00020EFE, Size = 4, BPHandle = 0x0001), and then it hits it as well (…Breakpoint reached @ address 0x00020EFE).

            However, for some reason it is resetting the target right after this. Not sure what’s going on there, but I will try with a Linux installation on my side when I get a chance.

          • Avatar Krishna on July 28, 2017 at

            Thanks For quick reply .I will also try to find reason why the target is getting reseted repeated.

  22. Avatar Ray on July 14, 2017 at

    Hello, I had another question if you can provide some guidance. I am having some trouble with some of the debug steps when active connections are involved as i am facing time-out issues, I was wondering if it is a possibility to put display statements through the Netbeans IDE ( like printf in C/C++). So that i can get variable values or follow execution path without needing to pausing the execution.

    • Mohammad Afaneh Mohammad Afaneh on July 16, 2017 at

      Hi Ray,

      Yes, there’s a way to do that within NetBeans (if you’re running on a Mac or Linux).

      Basically, you can run a terminal within NetBeans and then run “screen” to view the serial output. You run the Terminal by going to Tools -> Open in Terminal. Then you can run the command to connect and view the serial output from the target. For me, the command I run is:

      screen /dev/cu.usbmodem1451 115200 -L

      After that, you’ll be seeing the serial output from within NetBeans rather than in another separate terminal program.

      To make sure you’re connecting to the right serial port, you can look at the devices with a name similar to /dev/cu.*.

      Hope this helps!

  23. Avatar mioip.it on July 13, 2017 at

    I thought others may benefit from this tutorial especially if they’re looking for other options for development on a Mac using open source tools.

  24. Avatar Ray on July 3, 2017 at

    Hi, great tutorial and it helped me set up my environment, I have run into a problem however. I was trying the ble_app_hids_keyboard example and although it compiles and uploads on to the board fine, when i open main.c in the IDE everything after “#if BUTTONS_NUMBER < 2
    #error "Not enough resources on board"
    is greyed out with and a yellow bulb on the left of the line says "Preprocessor stopped at this #error directive"

    Any idea what might be going on? Would greatly appreciate your inputs.

    • Mohammad Afaneh Mohammad Afaneh on July 4, 2017 at

      Ray, thanks! Glad it helped you out.

      Yes, this is merely an error in parsing the file and is not affecting compilation.

      The reason behind this error is the IDE does not recognize some of the macros defined by the project. In this case, there’s a macro that defines the board type called: BOARD_PCA10056.

      The way to fix it is to add this to the project by right-clicking on the Project -> Properties -> Code Assistance -> C Compiler and then add BOARD_PCA10056 to the “Preprocessor Definitions” field. After that, right click on the Project again and select Code Assitance -> Reparse Project. This should fix the issue and the BUTTONS_NUMBER should now show up in Blue and the yellow bubble should disappear.

      You may run into other similar parsing problems, in that case, what you need to do is add each of the processor definitions as you did with BOARD_PCA10056. The preprocessor definitions are defined in the ./pca10056/s140/armgcc/Makefile under: CFLAGS += -DBOARD_PCA10056…etc

      Another (easier) way is to edit the configurations.xml file located under the NetBeans project folder and add all the preprocessors in the preprocessorList section.

      Let me know if you still run into issues.

      • Avatar Ray on July 6, 2017 at

        Thanks a lot for the prompt reply. That did the trick 🙂 There a couple of files for which it says there are unresolved includes inside them, from what i could understand they are happening because of these header files are calling header files which in turn are calling header files which are already explicitly included in main.c . But its not impacting anything in terms of compiling or executing or debugging. Thank you again for such a nice guide. 🙂

  25. Avatar Ambrose on June 8, 2017 at

    Awesome tutorial – many thanks Mohammad!

    • Avatar Mohammad Afaneh on June 8, 2017 at

      Thanks Ambrose! Glad you found it useful.

  26. Avatar Jet on May 31, 2017 at

    Great! It is amazing tutorial! Can I translate this blog into Chinese?

    • Avatar admin on June 6, 2017 at

      Sure, would be appreciated!

  27. Avatar João Neves on May 19, 2017 at

    By the way… you should mention that Xcode is required to be installed on the Mac.

    Anyway…great job man! 😉

    • Mohammad Afaneh Mohammad Afaneh on May 19, 2017 at

      Yes, thanks for letting me know! I had it installed and didn’t think about it until you mentioned it 🙂

      I’ll edit the post and add that as a requirement.


  28. Avatar João Neves on May 19, 2017 at

    First many thanks for this amazing tutorial!

    I’m having one problem. At “Configure the Run command (to flash the target)” step I don’t get what you show, but the Run is finished right after press the button. I did all the previous steps and everything works.

    The message i get in the Output window is this:
    /bin/sh: line 0: exec: make: not found

    RUN FINISHED; exit value 127; real time: 10ms; user: 0ms; system: 0ms

    Can you help me understand what is wrong?

    Many thanks!

    • Mohammad Afaneh Mohammad Afaneh on May 19, 2017 at

      Thanks João! Glad you found it helpful.

      Can you check a couple of things:
      – Make sure the Run directory in the Project Properties is set to “/opt/nRF5_SDK_13.0.0/examples/ble_peripheral/ble_app_hrs/pca10056/s140/armgcc”
      – Under Netbeans -> Preferences -> C/C++ -> “Make Command” is set (for me it’s set to /usr/bin/make)

      Let me know if those suggestions still don’t fix the problem.

      • Avatar João Neves on May 19, 2017 at

        Hi Mohammad! Thanks a lot for the quick answer!

        Yes. I checked both things (first one I even tried to set the path “by hand”) and they are as you say. I still have the error.

        How you have all the properties at the Run directory?


        • Mohammad Afaneh Mohammad Afaneh on May 19, 2017 at

          Ok, I’ve uploaded an image of my Run configuration here (also added in the post): http://www.novelbits.io/wp-content/uploads/2017/05/Screen-Shot-2017-05-19-at-12.01.45-PM.png

          One other thing to try, run the “make flash_softdevice flash” command from the command line at the location “~/opt/nRF5_SDK_13.0.0/examples/ble_peripheral/ble_app_hrs/pca10056/s140/armgcc” and see if it works there. If it does, then it’s definitely a NetBeans configuration issue

          • Avatar João Neves on May 19, 2017 at

            Ok. So my configuration is the same than yours.

            On the second part it doesn’t work as well. It gives me the same kind of error.

            Flashing: s140_nrf52840_5.0.0-2.alpha_softdevice.hex
            nrfjprog –program ../../../../../../components/softdevice/s140/hex/s140_nrf52840_5.0.0-2.alpha_softdevice.hex -f nrf52 –sectorerase
            make: nrfjprog: No such file or directory
            make: *** [flash_softdevice] Error 1

            Looks like some file is missing or with some different name.

            Many thanks once again!

        • Mohammad Afaneh Mohammad Afaneh on May 20, 2017 at

          João, I sent you an email. It’ll be easier to communicate and try to resolve the problem that way.

          • Avatar Andreas on June 5, 2017 at

            I ran into the same error as you, João. My issue was under the section “Configure armgcc toolchain.” I had a misspelling in Modify Run Command Path (adding nrfjprog to PATH). My PATH now looks something like this:


            Hope that helps!

          • Mohammad Afaneh Mohammad Afaneh on June 8, 2017 at

            Thanks for the insight Andreas! João, you may want to check your PATH just one more time to make sure there are no typos.

          • Avatar Daniel on October 12, 2017 at

            I have exactly the same problem now. Is there any solution for this you discussed via mail?

            Great tutorial!
            Thanks alot

          • Mohammad Afaneh Mohammad Afaneh on October 18, 2017 at


            We never got to the bottom of the issue. I think João worked around it by running the command from a terminal instead of within NetBeans. I haven’t run into this issue before. Did you check the Run Command Path (see Andreas’s comment above)?

          • Avatar Jand on November 21, 2017 at

            Thanks for such a great tutorial – it was so easy to follow and it worked very well.

            I also had the problem with nrfjprog not being found and I think it has to do with fast/slow path addressed in this stackoverflow link (https://stackoverflow.com/questions/21708839/problems-setting-path-in-makefile).
            I echoed the value of PATH and it was actually /usr/bin:/bin:/usr/sbin:/sbin:/usr/bin

            I made 2 changes to the makefile that invoked nrfjprog:
            – add PATH := $(PATH):$(HOME)/opt/nRF5x-Command-Line-Tools_9_7_1_OSX/nrfjprog
            – add a semicolon at the end of the nrfjprog command (example: nrfjprog -f nrf52 –reset 😉 to force slow path

            I am using macOS 10.13.1, NetBeans 8.2, nRF5_SDK_14.2.0_17b948a, nRF5x-Command-Line-Tools_9_7_1_OSX, s132, pca10040.

Leave a Comment