Flashing and Debugging the firmware on the ProMotion kit

Motsai's Neblina ProMotion kit is a demonstrative kit for developers who want to prototype wearable electronics products that contain motion analysis features. Many developers will want to do more with their ProMotion kits than to build mobile apps around the stock firmware present on the production board. What if I want change the Bluetooth profile? What if I only want to send pure accelerometer data? Whatever the need on the Nordic side, there's usually a way to do it.

Let's face it, eclipse isn't perfect. But it gets the job done. Eclipse is basically the base IDE where you plug in everything you need depending on the work you want to get done. Some chip manufacturers use eclipse for their go-to IDE for chip development. In our particular case, we will use vanilla eclipse and add plugins for it to be practical for ARM firmware development.

The gist of it

Being able to compile, run and debug firmware on the ProMotion kit, you only need to follow a list of steps:
1. Download and set up eclipse CDT.
2. Set-up the openocd and GCC eclipse plugins.
3. Install the build and debugging tools and set up the eclipse paths accordingly.
4. Clone the github repository and compile.

The rest of the blog explains the steps in more detail.

Download and setup of eclipse

Download and install the latest C/C++ Eclipse IDE. Actually installing it is pretty simple. Make sure that you have your JDK installed first though. If not, you have to download and install that first. For Windows users, you can download and run the installer from the eclipse website. Make sure you select the C/C++ version of eclipse when you install. This process actually took a few minutes because it had fetch and update all of the C/C++ specific stuff.

Eclipse installer

For Mac/Linux users, it might be a bit different. As opposed to most downloaded programs that come in the form of an installer, eclipse is basically an executable file in a folder. I suggest moving the folder to your home folder to not to call sudo every time you run the program.

When you run eclipse for the first time, it is recommended to make a separate workspace for nRF51822 programming because some workspace variables can interfere with other projects. In this example, I call it workspace.nrf

workspacenrf

Setting up the plugins

Help -> Install new Software.
Help Dropdown

  1. In the Install window, click the Add... button
  2. fill in the Name: dialog with GNU ARM Eclipse Plug-ins
  3. fill in the Location: dialog with http://gnuarmeclipse.sourceforge.net/updates:
    URL:
  4. Click OK button

Add new software

At this point a list of GNU ARM C/C++ Cross Development Tools should appear.

  1. Checkmark the first item in the list and click Next.
  2. Click Next/Agree/Finish a few more times until you see that it start downloading and installing the plugins.

Installing plugins

There might be a warning pop-up that says that unsigned content is being installed. Ignore his and click Yes.

  1. Restart eclipse when the pop-up asks you to.

Download and install the build tools

Download the latest version of the gcc compiler on the GCC ARM Embedded website.

Windows users

With Windows, the environment is not as well suited for the GNU build tools as with a POSIX environment like Mac OSX or Linux.

  • Double-click on the gcc installer .exe file to run it.
  • Next/Agree/Install/Finish the installer. Don't specify a different install path than the default one, since eclipse will automatically look in the default install path for the compiler binary. Do not add the toolchain path to the environment.
  • Go to the GNU build tools from GNUArmEclipse website and run the executable.
  • Next/Agree/Install/Finish the installer
  • Check the version of the make tool by opening a command shell and going to the folder where you installed the tool to run the make command.
make --version

The output of running the program should look something like this:
make output

  • You should now make eclipse link with the build tools in the preferences menu by going to: Windows -> Preferences. Look under C/C++ -> Build -> Global Tools Path.
  • Make sure the path to the build tools and to the compiler is correct.

Build Tools Path

Cloning the repository

Clone the repository on your computer:

git clone https://github.com/Motsai/colibri.git  

Set up eclipse to work with the repo.

Window -> Preferences

C/C++ => Build => Build Variables
nrf51sdkloc ; directory ; /path/to/colibri/Nordic/nrf51/nrf51sdk

src

Program the Nordic softdevice

Linux

openocd -f interface/cmsis-dap.cfg -f target/nrf51.cfg -c "program s130_nrf51_1.0.0_softdevice.hex verify"  

You should see the following output:
OpenOCD output

Windows

Download and install the IDAP firmware:

Once installed, perform the CMSIS-IDAP command to flash the hex file:

IDAPnRFProg s130_nrf51_1.0.0_softdevice.hex  

References

Most of what is needed to do is explained on this excellent blog called GnuARMeclipse. Follow the instructions with in mind the intention of programming the nRF51822.

http://gnuarmeclipse.github.io/plugins/install/

This post was written by our former employee Alexander Courtemanche.


Motsai designs and builds innovative embedded systems, and is the leading Canadian developer of miniature low-power, wireless devices used in wearables and human motion analysis. Please feel free to send us an email at info@motsai.com or drop us a line at +1-888 -849-6956. Don't forget to signup for blog updates below.

Motsai Research

Read more posts by this author.

Subscribe to Motsai Musings

Get the latest posts delivered right to your inbox.

or subscribe via RSS with Feedly!
Motsai Inc
1395 rue Marie-Victorin
Saint Bruno-de-Montaville, Quebec J3V 6B7
Canada
Email: info@motsai.com
Toll free: 1.888.849.6956