Getting started with Nordic nRF51822 Development on Mac OS X

The [nRF51822] (https://www.nordicsemi.com/eng/Products/Bluetooth-Smart-Bluetooth-low -energy/nRF51822) by Nordic Semiconductor us a multiprotocol SoC with a 2.4Ghz transceiver that is ideal for any Bluetooth Low Energy (Bluetooth Smart) application. The toolchain and documentation provided by Nordic is very much Windows centered. There are some tutorials that provide some hints for Linux (e.g., [1], [2], [3] )

As I use Mac OS X as my main developing platform, I have setup the Nordic toolchain there. In the following I describe some of the necessary steps. Currently I am using VIM as editor together with GDB (GNU Project Debugger) and SEGGER J-Link that runs a local JLinkGDBServer. This setup works with the s110 Softdevice v7.1.0 (s110_nrf51822_7.1.0_softdevice) and with SDKv6.1.0. The GCC setup is based on the great work in [3]. The startdebug target requires iTerm as terminal.

Install requirements:

  1. Install Homebrew: http://brew.sh

  2. Install Command Line Tools for Xcode:

    xcode-select --install
    
  3. Install GNU ARM Embedded Toolchain 4.9:

    brew install gcc-arm-none-eabi-49
    
  4. Download Nordic SDK v6.1.0 and extract it at location of choice.

  5. Download Nordic Softdevice v7.1.0 and put at location of choice.

  6. Download Segger J-Link Software and install the .DMG

  7. Clone my slightly modified nrf51-pure-gcc-setup repo (based on [3]):

    git clone https://github.com/jf87/nrf51-pure-gcc-setup
    

    And add iTermExecute.sh in PATH (e.g., place in usr/local/bin)

Build and flash the sample iBeacon application:

  1. Copy the pure-gcc folder from examples/s110/ble_app_beacon next to the other folders in the example iBeacon application by Nordic in the downloaded SDK (nrf51_sdk_v6_1_0/nrf51822/Board/pca10001/s110/ble_app_beacon).

  2. Edit the pure-gcc makefile and change SDK_PATH and TENPLATE_PATH according to their location.

  3. Flash the softdevice if needed.

    export SOFTDEVICE=/path/to/softdevice/s110_nrf51822_7.1.0_softdevice.hex
    
  4. Build and flash the iBeacon application:

    make flash
    

The application can be debugged when running make with CFLAGS -0s -g, which is done when running make with debug target (make debug). The JLinkGDBServer and GDB is then started in two new iTerm tabs with make startdebug.

[1] https://devzone.nordicsemi.com/tutorials/7/development-with-gcc-and-eclipse/ [2] https://devzone.nordicsemi.com/blogs/18/development-with-eclipse-and-gcc/ [3] https://github.com/hlnd/nrf51-pure-gcc-setup

Avatar
Jonathan Fürst
Computer Science Researcher

I am a Computer Science researcher at NEC Labs Europe.

Related