nRF5 SDK allows the development of software for the nRF51 and nRF52 SoCs. Nordic Semiconductor promotes the use of the nRF Connect SDK, but I found it complex to use because it doesn’t allow bare metal (it works with the RTOS Zephyr Project) and force you to use new tools like DeviceTree and CMake that I’m not proficient with. Nordic Semiconductor offers a free license to SEGGER Embedded Studio for development with nRF chips, but if you are like me and prefer to use the eclipse platform, here is a guide for installing it. This guide is for Windows users but it can provide a general direction for other OSs as well.
If you have already installed eclipse, you can go to the next article that explain how to use a SDK example.
If you are already tired of reading => TL;DR.
- Download Node.js LTS and install it.
- Open a CLI and install npm, xpm and the tools by typing the following:
npm install --global npm@latest npm install --global xpm@latest xpm install --global @xpack-dev-tools/windows-build-tools@latest xpm install --global @xpack-dev-tools/arm-none-eabi-gcc@latest xpm install --global @xpack-dev-tools/openocd@latest
We also need the driver for the debug probe, the nRF developpment kit use an On-board SEGGER J-Link debugger. This probe can also be used to debug an external target with the same SoC type. The nRF Command Line Tools provide the probe driver and also nrfjprog for programming our target.
- Download nRF Command Line Tools and install it.
Sometime nRF Command Line Tools fail to install Segger J-Link. It can be downloaded from segger and installed.
Eclipse is based on Java so it needs a JRE.
- Download and Install a Java Runtime Environment.
We can now install eclipse.
- Go to the download page of eclipse and scroll down to “Eclipse IDE for Embedded C/C++ Developers”.
- Click on the OS version you need and download it.
- Go to the nRF5 SDK page.
- Scroll down and right click on the nRF5_SDK.zip to download it.
- Create a folder that will be used as a workspace.
- Extract the nRF5_SDK.zip to the workspace.
- Open “components\toolchain\gcc\Makefile.windows” with a text editor.
- Edit GNU_INSTALL_ROOT to point to something like that “C:/Users/USERNAME/AppData/Roaming/xPacks/@xpack-dev-tools/arm-none-eabi-gcc/10.3.1-2.1.1/.content/bin/”. Replace USERNAME and the version accordingly to your PC. The path should use slash instead of backslash and a final slash is needed.
- Edit GNU_VERSION to the corresponding gcc version pointed by GNU_INSTALL_ROOT.
- Start eclipse IDE.
- Open the menu Windows -> preferences
- In MCU -> Global ARM Toolchains Paths, verify the folder is correctly path
- Do the same for “Global Build Tools Path”, “Global OpenOCD Path” and “Global SEGGER J-Link Path”
- Normally xpack should be able to locate the path of our previously installed tools, if it’s not the case, the path can be manually set. Here is an example where the tools should be located, USERNAME and version should differ:
C:/Users/USERNAME/AppData/Roaming/xPacks/@xpack-dev-tools/arm-none-eabi-gcc/10.3.1-2.1.1/.content/bin C:/Users/USERNAME/AppData/Roaming/xPacks/@xpack-dev-tools/windows-build-tools/4.2.1-2.1/.content/bin C:/Users/USERNAME/AppData/Roaming/xPacks/@xpack-dev-tools/openocd/0.11.0-2.1/.content/bin C:/Program Files (x86)/SEGGER/JLink
- Install Node.js LTS from https://nodejs.org/en/
- Install the xpack-dev-tools with a CLI:
npm install --global npm@latest
npm install --global xpm@latest
xpm install --global @xpack-dev-tools/windows-build-tools@latest
xpm install --global @xpack-dev-tools/arm-none-eabi-gcc@latest
xpm install --global @xpack-dev-tools/openocd@latest
- Install “nRF Command Line Tools” from https://www.nordicsemi.com/Products/Development-tools/nRF-Command-Line-Tools/Download#infotabs
- Install a “Java Runtime Environment” from https://www.java.com/en/download/
- Install “Eclipse IDE for Embedded C/C++ Developers” from https://www.eclipse.org/downloads/packages/
- Install nRF5 SDK from https://www.nordicsemi.com/Products/Development-software/nRF5-SDK/Download#infotabs
- Edit “components\toolchain\gcc\Makefile.windows” from the nRF5_SDK used, Update the 2 first lines with the previously installed GCC (path should look like this C:/Users/username/AppData/Roaming/xPacks/@xpack-dev-tools/arm-none-eabi-gcc/10.3.1-2.1.1/.content/bin/, it shouldn’t use backslash)