Setup the nRF5 SDK Development Environment¶
This section describes how to set up the nRF5 SDK development environment on your system.
Set up the toolchain¶
To build the nRF5 SDK applications, GNU ARM Embedded Toolchain is required. Follow one of the following guides for your host operating system:
macOS¶
-
GNU make is bundled with Xcode tools. Verify by running:
make --v
-
Download and install the GNU ARM Embedded Toolchain. The
6-2017-q2-update
version is recommended. Then ensure the path is added to your OS PATH environment variable.Type the following in your terminal to verify if the path is set correctly:# in ~/.bash_profile, add the following script export PATH="<path to install directory>/gcc-arm-none-eabi-6-2017-q2-update/bin:${PATH}"
arm-none-eabi-gcc --version
-
Download the nRF5x-Command-Line-Tools-OSX, then extract the
.tar
archive anywhere on your filesystem. Ensure the extracted directory is added to your OS PATH environment variable.# in ~/.bash_profile, add the following script export PATH="<the path to the extracted directory>:${PATH}"
Type the following in your terminal to verify if
mergehex
works:mergehex --version
-
(Optional) Install the latest stable version of pyOCD via
pip
as follows:pip install -U pyocd
Type the following in your terminal to verify if
pyocd
works:pyocd --version
Tip
pyOCD is an open source Python package for programming and debugging Arm Cortex-M microcontrollers using multiple supported types of USB debug probes. If you have a CMSIS-DAP debug probe, it's recommended to install pyOCD.
Windows¶
On Windows the easiest way to install the dependencies is to use the MSYS2. You can do so by performing the following steps:
-
Download and run the installer - "x86_64" for 64-bit, "i686" for 32-bit Windows.
-
Start MSYS2. Update the package database and core system packages with:
pacman -Syu
-
If needed, close MSYS2, run it again from Start menu. Update the rest with:
pacman -Su
-
Install dependencies:
pacman -S git make python2
-
Download and install the GNU ARM Embedded Toolchain. The
6-2017-q2-update
version is recommended. Run the installer and follow the given instructions. Upon completion, check the Add path to environment variable option. Then verify if the compiler works:arm-none-eabi-gcc --version
-
Download the nRF5x-Command-Line-Tools for Win32. Run the installer and follow the given instructions. Then verify if
mergehex
works:mergehex --version
-
(Optional) Install the latest stable version of pyOCD via
pip
as follows:Type the following in your terminal to verify ifpip install -U pyocd
pyocd
works:pyocd --version
Linux¶
Here we describe how to set up the toolchain on Ubuntu. The steps should be similar for other Linux distributions.
-
Ensure your host system is up to date before proceeding.
sudo apt-get update
sudo apt-get upgrade
-
Install the following packages using your system’s package manager.
sudo apt-get install build-essential checkinstall
-
Download and install the GNU ARM Embedded Toolchain. The
6-2017-q2-update
version is recommended. Then ensure the path is added to your OS PATH environment variable.Type the following in your terminal to verify if the path is set correctly:# in ~/.bash_profile, add the following script export PATH="<path to install directory>/gcc-arm-none-eabi-6-2017-q2-update/bin:${PATH}"
arm-none-eabi-gcc --version
-
Download the nRF5x-Command-Line-Tools-Linux-xxx, then extract the
.tar
archive anywhere on your filesystem. Ensure the extracted directory is added to your OS PATH environment variable.# in ~/.bash_profile, add the following script export PATH="<the path to the extracted directory>:${PATH}"
Type the following in your terminal to verify if
mergehex
works:mergehex --version
-
(Optional) Install the latest stable version of pyOCD via
pip
as follows:pip install -U pyocd
Type the following in your terminal to verify if
pyocd
works:pyocd --version
Clone the repository¶
Clone the pitaya-go
repository from GitHub:
git clone --recursive https://github.com/makerdiary/pitaya-go
Or if you have already cloned the project, you may update the submodule:
git submodule update --init
Install the nRF5 SDK¶
Download the SDK file nRF5_SDK_v15.2.0_9412b96 from www.nordicsemi.com. Note that the current version is 15.2.0
.
Extract the zip file to the pitaya-go/nrf_sdks
directory. This should give you the following folder structure:
./pitaya-go/ ├── LICENSE ├── README.md ├── certs ├── config ├── docs ├── examples ├── external ├── firmware ├── material ├── mkdocs.yml ├── nrf_sdks │ ├── README.md │ └── nRF5_SDK_15.2.0_9412b96 └── utils
To use the nRF5 SDK you first need to set the toolchain path in makefile.windows
or makefile.posix
depending on platform you are using. That is, the .posix
should be edited if your are working on either Linux or macOS. These files are located in:
<nRF5 SDK>/components/toolchain/gcc
Open the file in a text editor (Sublime Text is recommended), and make sure that the GNU_INSTALL_ROOT
variable is pointing to your GNU Arm Embedded Toolchain install directory.
GNU_INSTALL_ROOT ?= $(HOME)/gcc-arm-none-eabi/gcc-arm-none-eabi-6-2017-q2-update/bin/ GNU_VERSION ?= 6.3.1 GNU_PREFIX ?= arm-none-eabi
Next Step¶
If everything works as expected, it's ready to build and run the examples to verify the development environment setup.
The steps that are described in Build & Run a first example will walk you through verifying your setup with the Hello World example.
Create an Issue¶
Interested in contributing to this project? Want to report a bug? Feel free to click here: