This is currently a brain dump of all steps taken, will be cleaned up asap
Install eclipse neon
Before we begin
Before we start setting up Eclipse we need to install some software components required to build source code, and also software to load it to the target device. These components enables us to test the SDK examples from the command line in addition to Eclipse.
GNU toolchain for ARM Cortex-M
GNU toolchain including compiler and GDB debugger can be downloaded using the following link. Download and install the latest version. Then make sure to add the path to your toolchain to your OS PATH environment variable:
<path to install directory>/GNU Tools ARM Embedded/4.9 2015q3/bin
Adding the path makes it possible to run the toolchain executables from any directory using the terminal. To verify that the path is set correctly, type the following in your terminal:
This will return the version of the C compiler if the executable is found in your path.
Now with the toolchain installed we can build object files from source code, but to build projects based on makefiles, which can be seen as a recipes for the builds, we need to have GNU make installed on the system.
On windows it can be obtained by installing the GNU ARM Eclipse Windows Build Tools package from the GNU ARM Eclipse plug-in project. This package also adds support for shell commands such as rm and mkdir that are used by our Makefiles.
Nordic nRF5x SDK
Download SDK 11.0.0 from http://developer.nordicsemi.com/, or SDK 10.0.0 if s110 is to be used on the nRF51.
To build an example in the 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 OS X. These files are located in
Open the file in a text editor, and make sure that the GNU_INSTALL_ROOT variable is pointing to your Gnu tools for ARM embedded Processors install directory.
Correct values for my current setup:
GNU_INSTALL_ROOT := $(PROGFILES)/GNU Tools ARM Embedded/6.2 2016q4 // Toolchain path GNU_VERSION := 6.2.1 GNU_PREFIX := arm-none-eabi
Now you can try to build one of the example projects. Will use the blinky example here to keep it simple:
Open terminal and change directory to
cd <SDK>/examples/peripheral/blinky/<board name>/blank/armgcc/
Connecting STLINK-V2 to NRF51
Install latest version of openocd
add openocd to path
C:\Program Files (x86)\OpenOCD-20160901\bin
Flashing the device
cd C:\Program Files (x86)\OpenOCD-20160901\share\openocd\scripts
openocd –f interface/stlink–v2.cfg –f target/nrf51.cfg
open new shell telnet 127.0.0.1 4444 halt nrf51 mass_erase flash write_image erase "<path relative to starting openocd>../ble_app_hrs.hex" 0 reset Incase you get the the following error:
"Unknown device (HWID 0x0000008f)"
Get your self a Linux machine or virutal box
But first, let’s update the package database:
- sudo apt-get update
Now let’s install Docker. Add the GPG key for the official Docker repository to the system:
- sudo apt-key adv –keyserver hkp://p80.pool.sks-keyservers.net:80 –recv-keys 58118E89F3A912897C070ADBF76221572C52609D
Add the Docker repository to APT sources:
- sudo apt-add-repository ‘deb https://apt.dockerproject.org/repo ubuntu-xenial main’
Update the package database with the Docker packages from the newly added repo:
- sudo apt-get update
Make sure you are about to install from the Docker repo instead of the default Ubuntu 16.04 repo:
- apt-cache policy docker-engine
You should see output similar to the follow:
docker-engine: Installed: (none) Candidate: 1.11.1-0~xenial Version table: 1.11.1-0~xenial 500 500 https://apt.dockerproject.org/repo ubuntu-xenial/main amd64 Packages 1.11.0-0~xenial 500 500 https://apt.dockerproject.org/repo ubuntu-xenial/main amd64 Packages
docker-engine is not installed, but the candidate for installation is from the Docker repository for Ubuntu 16.04. The
docker-engine version number might be different.
Finally, install Docker:
- sudo apt-get install -y docker-engine
Get your self my dockerfile https://github.com/flitjes/Experiments.git cd Experiments/docker/nrf51_dev Build docker image sudo docker build -t nrf51_dev . Create docker container and starting ing sudo docker run --device=/dev/bus/usb -it nrf51_dev openocd -f /usr/local/share/openocd/scripts/interface/stlink-v2.cfg -f /usr/local/share/openocd/scripts/target/nrf51.cfg For reuse of the same docker container sudo docker ps -a and get the hash from the first column sudo docker start -ia <hash> sudo docker stop <hash>