Skip to content

NRF5 SDK rebulid environment

20lives edited this page Aug 29, 2017 · 2 revisions

NRF5 SDK rebulid environment

Using premade environment

This tutorial will explain how to create the NRF5 environment with rebuild, to only use the NRF5 sdk you can skip it and use the premade environment on dockerhub with only few simple steps (you might want read how to use it in 'running an example' below):

rbld search
rbld deploy nrf5:13 #replace with search result version
rbld run nrf5:13 -- make

Setting up the environment

First, we are going to download the latest SDK from here: https://developer.nordicsemi.com/nRF5_SDK/

wget https://developer.nordicsemi.com/nRF5_SDK/nRF5_SDK_v13.x.x/nRF5_SDK_13.1.0_7ca7556.zip

now we will create a rebuild environment based on ubuntu

rbld create --base ubuntu:16.04 nrf5

let's check that the process succeeded by listing the rebuild environments:

 rbld list

we now should find it in the result

nrf5:initial

now we will install the needed dependencies, we can do this through the interactive mode:

rbld modify nrf5:initial

we should now see something like this:

myuser@nrf5-initial-M ~]$

now we have an interactive shell of the environment, we need unzip, arm toolchain and a text editor:

sudo apt-get update
sudo apt-get install -y make unzip gcc-arm-none-eabi vim

now we extract the sdk to the root folder

sudo unzip nRF5_SDK_13.1.0_7ca7556.zip -d /nRF5_SDK_13.1.0_7ca7556

we need to point the sdk to the right location of the gcc-arm-none-eabi:

sudo vim /nRF5_SDK_13.1.0_7ca7556/components/toolchain/gcc/Makefile.posix

it should look like this:

GNU_INSTALL_ROOT := /usr
GNU_VERSION := 4.9.3
GNU_PREFIX := arm-none-eabi

we want to keep the environment variable with the path to the sdk for using it in the makefile:

echo -e 'export NRF5_SDK_ROOT=/nRF5_SDK_13.1.0_7ca7556' | sudo tee -a /rebuild/rebuild.rc

we are done with the environment, exit the interactive shell with CTRL-D. let's commit the changes and delete the initial environment:

rbld commit nrf5:initial --tag 13
rbld rm nrf5:initial

Running an example

Inside the sdk we will find many examples to start with, lets try 'simple timer' inside: peripheral/simple_timer/pca10040/blank/armgcc we need to edit the Makefile with the sd path variable we have.

SDK_ROOT := $(NRF5_SDK_ROOT)
PROJ_DIR := ../../../

now we can run 'make' with rebulid on the evnironment:

rbld run nrf5:13 make

if nothing went wrong a '_build' directory should be created with one hex file and one bin file.