Parts

  • JLink
  • GNU ARM Embedded Toolchain
  • nRF5 SDK
  • sudo apt-get install build-essential checkinstall a.k.a GNU make
  • nRF51822

GNU ARM Embedded Toolchain

Download the latest Linux 64-bit tar bz2 from ARM Developer download page and install traditional way.

Or

Add ppa for the gcc arm embedded project and install it packaged:

$ sudo su -
# add-apt-repository ppa:team-gcc-arm-embedded/ppa
# apt-get update
# apt-get install gcc-arm-embedded

Test:

$ arm-none-eabi-gcc --version
arm-none-eabi-gcc (GNU Tools for ARM Embedded Processors 6-2017-q2-update) 6.3.1 20170620 (release) [ARM/embedded-6-branch revision 249437]
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

nRF5 SDK

Download the SDK from Nordic SDK download page.

Eg. nRF5 SDK v12.x.x ( nRF5 SDK 12.3.0 zip | nRF5 SDK offline doc).

Install:

$ sudo su -
~/ # cd /opt
/opt # wget http://developer.nordicsemi.com/nRF5_SDK/nRF5_SDK_v12.x.x/nRF5_SDK_12.3.0_offline_doc.zip
/opt # wget http://developer.nordicsemi.com/nRF5_SDK/nRF5_SDK_v12.x.x/nRF5_SDK_12.3.0_d7731ad.zip
/opt # unzip nRF5_SDK_12.3.0_d7731ad.zip
/opt # nRF5_SDK_12.3.0_d7731ad nRF5_SDK_12.3.0
/opt # unzip nRF5_SDK_12.3.0_offline_doc.zip
/opt # mv nrf5 s* nRF5_SDK_12.3.0/documentation
/opt # rm nRF5_SDK_12.3.0_*
/opt # chown marek:marek nRF5_SDK_12.3.0
/opt # vim nRF5_SDK_12.3.0/components/toolchain/gcc/Makefile.posix

/opt/nRF5_SDK_12.3.0/components/toolchain/gcc/Makefile.posix:

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

nRF51822

Nordic nRF51822 download page.

Files related to embedded developement on Linux:

Install the command line tools:

/opt # tar xvfz nRF5x-Command-Line-Tools_9_6_0_Linux-x86_64.tar
/opt # rm nRF5x-Command-Line-Tools_9_6_0_Linux-x86_64.tar
/opt # ln -s /opt/mergehex/mergehex /usr/bin/mergehex
/opt # ln -s /opt/nrfjprog/nrfjprog /usr/bin/nrfjprog
/opt # ls /usr/bin -l | grep "mergehex\|nrfjprog"
lrwxrwxrwx 1 root   root          22 Jul 15 14:31 mergehex -> /opt/mergehex/mergehex
lrwxrwxrwx 1 root   root          22 Jul 15 14:31 nrfjprog -> /opt/nrfjprog/nrfjprog

Install nrfconnect:

/opt # tar xvfz nrfconnect-2.0.0.tar.gz
root@celine /opt # rm nrfconnect-2.0.0.tar.gz
/opt # ln -s /opt/nrfconnect-2.0.0/nrfconnect /usr/bin
/opt # ls -l /usr/bin|grep nrfconnect
lrwxrwxrwx 1 root   root          32 Jul 15 14:33 nrfconnect -> /opt/nrfconnect-2.0.0/nrfconnect

Install pynrfjprog:

/opt # pip search pynrfjprog
pynrfjprog (9.6.0)  - A simple Python interface for the nrfjprog functionality
/opt # pip install pynrfjprog

Install s130 SoftDevice:

/opt # mkdir nRF5_SDK_12.3.0
/opt # cd nRF5_SDK_12.3.0
/opt # mv /home/marek/Downloads/s130_nrf51_2.0.1.zip .
/opt # unzip s130_nrf51_2.0.1.zip

Playing With The SDK

Put all examples into a local Git repository to track all local changes:

$ cd /opt/nRF5_SDK_12.3.0/examples
$ git init
Initialized empty Git repository in /opt/nRF5_SDK_12.3.0/examples/.git/
$ git add .
$ git commit -m "initial version"

Compiling HEX & Flashing Boards

Blinky example:

$ cd /opt/nRF5_SDK_12.3.0/examples/peripheral/blinky/pca10031/s130/armgcc
$ make

Erase board:

$ nrfjprog --family nRF51 -e
Erasing user available code and UICR flash areas.
Applying system reset.

Flash built hex onto board:

$ nrfjprog --family nRF51 --program _build/nrf51422_xxac.hex
Parsing hex file.
Reading flash area to program to guarantee it is erased.
Checking that the area to write is not protected.
Programing device.

Reset board:

$ nrfjprog --family nRF51 -r
Applying system reset.
Run.