Hardware, Software & Product Development | Sparx EngineeringHardware, Software & Product Development | Sparx EngineeringHardware, Software & Product Development | Sparx EngineeringHardware, Software & Product Development | Sparx Engineering
  • Home
  • Expertise
    • Software Engineering
    • Electrical Engineering
    • Chemical Products and Services
    • Biomedical Engineering
    • Mechanical Engineering
    • Production Management
    • Automation
    • Industrial Design
  • Blog
  • Careers
  • About Us
NextPrevious

nRF51 Development Environment with Eclipse

By dreynolds | Software | 6 comments | 23 March, 2015 | 1

Nordic nRF51This blog post aims to describe how to setup a fully functional nRF51 development environment using Eclipse and the GCC toolchain.  We are using a Segger JLink GDB server for the debugging portion, but there are OpenOCD plugins which should work (provided that it supports SWD).

The Nordic application note nAN-29 describes the setup using Sourcery CodeBench Lite and the nRF51822, but I will be using GNU Tools for ARM Embedded Processors with the nRF51422.

Necessary Downloads

  • Nordic Application Note nAN-29
  • GNU Tools for ARM
  • Nordic nRF51422 SDK (will need a product key to download)
  • Eclipse IDE for C/C++ developers
  • jLink GDB Server
  • GNU Coreutils
  • Make

Eclipse Plugins

The following plugins will need to be installed within eclipse.  Please refer to this guide for the steps to take to install a new plugin (the Nordic Application note also covers it).

  • EmbSysRegView: http://embsysregview.sourceforge.net/update
  • GNU ARM Eclipse Plugin: http://gnuarmeclipse.sourceforge.net/updates

Current Versions as of this writing

  • GNU Tools for ARM: 4.8-2014-q1
  • Nordic nRF51422 SDK: 5.2.0
  • jLink: 4.84f
  • Core Utils: 5.3.0
  • Make: 3.81
  • EmbSysRegView: 0.2.4
  • Gnu ARM Eclipse Plugin for JLink: 1.5.1

Setting Up Eclipse

Since the application note provides good information in many sections, we will be referring back to it as needed.

Section 1.1 in the application note provides a good overview for installing some necessary plugins.  Use the same technique to add the GNU ARM Eclipse Plugin.

Import and Configure Existing Makefile Project

Section 1.2 in the application note describes the Code Sourcery setup, but since we are using GNU make, we can ignore most of the suggestions, except when it comes to Paths and Symbols.

Eclipse Paths and Includes settings

Eclipse Paths and Includes settings

 

Note that I have added the paths for not only gcc, but app_common and the s210 soft device.  You may need to add other related directories if you want eclipse to not show errors in the UI.

The Symbols shown, BOARD_NRF6310 and NRF51, are necessary to include.

Adding Debugging Support for JLink

Since we have already installed the GNU ARM plugin for eclipse, we can add a new debug configuration for our device.  Note you’ll need to successfully do a build to find the *.out file for the debug configuration.  The corresponding section in the application note is Section 2.

Eclipse Debug Configurations - Main settings

Eclipse Debug Configurations – Main settings

For the debugger, add the path to the arm-non-eabi-gdb.exe binary:

C:\Program Files (x86)\GNU Tools ARM Embedded\4.8 2014q1\bin\arm-none-eabi-gdb.exe

Eclipse Debug Configurations - Debugger settings

Eclipse Debug Configurations – Debugger settings

For startup, you’ll need to add the same options provided in the application note (substituting NRF51422 as needed):

mon speed 10000
mon endian little
mon flash download = 1
mon flash device = NRF51422
mon reset 0

Eclipse Debug Configurations - Startup settings

Eclipse Debug Configurations – Startup settings

Flash Downloading

The application note’s recommendation of using nrfjprog.exe in section 3 is good, but I use ‘make flash’.

Enabling EmbSys Register Viewer

Following the application note’s (nAN-29 Section 4) recommendation will correctly setup the register viewer.

Notes on Folder Paths for Projects

GDB has some problems with spacese in the debugging path for the application source code, so to successfully debug your code on device, make sure that the path to your source directory has no spaces.

Another interesting note is that Segger JLink will breakpoint your processor at the hard fault handler if you have allocated too many breakpoints while using a Segger JLink lite (4 breakpoint limit).

Conclusion

With these recommendations combined with Nordic’s application note nAN-29, we can have an eclipse development environment with GDB debugging from within eclipse, using a full GCC toolchain. When I followed the original application note I ran into areas where GDB entered unknown territory (GDB couldn’t find the source code).  With these modifications GDB works flawlessly.

ARM, eclipse, embedded, gcc, nrf51

dreynolds

More posts by dreynolds

Related Posts

  • Reading line-by-line from a serial port (or other byte-oriented stream)

    By Ben Voigt | 10 comments

    With many .NET developers moving from the traditional (and broken) System.IO.Ports.SerialPort DataReceived event handling to either the correct and more efficient BaseStream.BeginRead / BaseStream.EndRead pair I promoted in my last post or the newer BaseStream.ReadAsyncRead more

  • How to Model NPT Threads in Solidworks

    By rmontifar | 2 comments

    National Pipe Thread Taper or NPT threaded pipes and fittings are deployed in a variety of fields where transportation or containment of liquids, gases, steam, or hydraulic fluid is required. The NPT geometry allows internalRead more

  • Multi-Tiered Linux Backup System – Part I

    By dreynolds | 0 comment

    Backing up important data and memories is an important task that should not be neglected. Just as important as performing Linux backups is verifying that the backups made are good and can be used toRead more

  • Clojure: An improved workflow

    By dfohl | 0 comment

    Like many beginning Clojure programmers, I started off following Stuart Sierra’s “Reloaded” workflow guide. While it was a great starting point, there were a number of things that I wanted to change. If the projectRead more

  • Start Zoneminder Recordings with Vera Events

    By dsmoot | 4 comments

    In a previous post I explained how you could configure the security DVR software Zoneminder to trigger recordings from a network connection. While a neat trick, I never really explained why I set this up.Read more

6 comments

  • john Reply May 29, 2015 at 4:28 am

    nAN-29 is removed from Nordic site since Nordic thinks it is no longer valid. Anyway to repost it here? or make steps in details without reference to nAN-29. Thanks.

    • Dustin Reynolds Reply May 29, 2015 at 8:05 am

      Since Nordic has removed the application note 29, I will need to update the post so that it stands alone from the application note. Thanks for posting a note about the application note removal, a tutorial isn’t very useful if the links it refers to is missing.

  • Ernie Reply September 14, 2015 at 9:08 am

    Have you tried using VisualGDB for Visual Studio. It has worked great for me on an embedded project using GDB and GCC.

    • Dustin Reynolds Reply September 14, 2015 at 9:27 am

      I haven’t specifically tried VisualGDB for Visual Studio, but it looks good. It may be the subject of a followup blog post if I get some time to work on it. I generally like Eclipse since it is an open source project and with GNU ARM Eclipse plugins I can develop and test firmware changes quickly within Eclipse.

  • Rebelbot Reply April 6, 2016 at 11:24 pm

    I had the same problem finding nAN-29. But I used archive.org with the bad link for it and it was there.

    Thanks, Way Back Machine!

  • Nicolás Fernandez Reply June 9, 2016 at 3:56 pm

    Hi guys

    I am having the following error when start the debugging session.

    No source available for “0xffffffff”

    Do you have any idea?

    Thanks in advance

Leave a Comment

Cancel reply

Your email address will not be published. Required fields are marked *

NextPrevious
  • Home
  • Expertise
  • Blog
  • Careers
  • About Us
Sparx Technologies, LLC. dba Sparx Engineering © 2009 - 2022 | All Rights Reserved
  • Home
  • Expertise
    • Software Engineering
    • Electrical Engineering
    • Chemical Products and Services
    • Biomedical Engineering
    • Mechanical Engineering
    • Production Management
    • Automation
    • Industrial Design
  • Blog
  • Careers
  • About Us
Hardware, Software & Product Development | Sparx Engineering