This post is a quick tutorial on how to set up a GUI for debugging NRF51 code
2015-11-22
Previous article
#Introduction
Currently, CLion does not support remote debugging, but they promised to consider it if enough votes were collected - so vote here! I am sure it’s going to be seamless once they implement it, so I’m awaiting eagerly.
Modifying XCode to use ARM tools is a big challenge and support documentation seems to stop at XCode 6. I have it in mind to try to write a plugin to support toolchain switching as well as code templates, so watch this space...
I also tried configuring CodeLite as there were romours that it was possible. Unfortunately it never worked for me (user error, I assume) but I intend to pursue this as I’d like to support this open source effort.
Conscious of my mental well-being, I am avoiding Eclipse and will not refer to it again in this post.
So which shall we use? NetBeans. While not the most modern and the least flexible of above-mentioned IDEs, it actually manages to debug cross-compiled code running on a remote device.
Here’s how
Step 1: Download the C/C++ enabled version of NetBeans from here.
![]()
Step 2: Create a new project
![]()
Follow the wizard’s path and select to open your project’s root directory.
Step 3: Create a new configuration for the ARM toolchain
![]()
Step 4: Set up the toolchain
Enter the path of your ARM toolchain, usually in /usr/local and fill in the rest of the form
![]()
You can access this form in the future by clicking on the “Services” tab on the left hand side of the project explorer
![]()
Then right click on the configuration name and select “Properties"
![]()
This will bring up a similar window as was shown the first time when you configued the toolchain
![]()
At this stage, you’ve set up a configuration to use the ARM toolchain.
Step 5: Connect the config to our project.
This is done by selecting “Set Project Configuration” from the Run menu
![]()
Step 6: Verify that the project is set to use the ARM config.
This is done by selecting “File/Project Properties” and making sure that “Tool Collection” is set to “ARM"
![]()
Step 7: Set up debugging session parameters
![]()
You should now be ready!
Let’s build the application by using your makefile
![]()
To debug, we must first launch the “jlinkgdbserver” executable, as described in my previous blog.
Unfortunately, I have not found a way to automatically do this from within NetBeans as it does not appear to have a pre-debugging hook where we would have been able to run the server. If anyone is aware of doing so, please alert me and I will update this post.
Open a terminal window and run the following command:
jlinkgdbserver -device nrf51822 -if swd -speed 4000 -noir -port 2331
The result should look something like this:
![]()
We can now start our debugger session by selecting “Debug/Attach Debugger” in NetBeans
![]()
This will open a dialog that you should fill in as shown here
![]()
If everything went well, you should be able to see the code in NetBeans and use their debugger fully!
![]()
I hope you found this tutorial helpful! See you next time, hopefully with a solution for CLion and XCode.
Happy hacking!
Previous article
Filed under
BLE
Embedded
nrf51
Other Tags
API GW
AWS
- Programming ESP32 using MQTT with AWS and FreeRTOS
- Quick AWS IoT Setup and test
- Set up AWS API GW with a Typescript authorizer and logging
- Use AWS CodePipline to execute CloudFormation templates
- Use GitHub Actions to deploy your SPA hosted on Amazon S3
- Use an AWS CloudFormation script to create and host an SPA on S3 with SSL and apex/subdomain redirection using CloudFront
- Writing an Alexa skill using Ruby and AWS Lambda (Part 0)
ActiveRecord
Agile
- A review of software development metrics
- Agile programme management brief
- An alternative to current product development metrics
- An alternative to the current product development governance model
- Command & Control Management - The Party Killer
- Document Driven Development
- Inceptions revisited
- Managing multiple stakeholders
- Returns Driven Development
- The tip of the (good) iceberg
Alexa
Analysis
Ansible
BDD
BLE
C
CAB
CloudFormation
- Set up AWS API GW with a Typescript authorizer and logging
- Use AWS CodePipline to execute CloudFormation templates
- Use GitHub Actions to deploy your SPA hosted on Amazon S3
- Use an AWS CloudFormation script to create and host an SPA on S3 with SSL and apex/subdomain redirection using CloudFront
- Writing an Alexa skill using Ruby and AWS Lambda (Part 0)
CloudFront
CloudWatch
Cross-compile
Cucumber
DevOps
Devops
DotNet
Embedded
Fitbit
GNU
GitHub Actions
Governance
How-to
Inception
IoT
Javascript
Jest
Lambda
Mac OS X
- Bluetooth Low Energy (BLE) Implementing a peripheral on Mac OS X
- Cross-compiling for Raspberry Pi on a Mac and debugging using NetBeans
- Drobo will not mount in Finder
- Quickie - ssh dynamic port forwarding to avoid unsecured public networks
- Remote compilation, execution and debugging Raspberry Pi from a Mac using NetBeans
- Weekend warrior - MacRuby and rSpec, Mac OS X Lion, Xcode V4.3.2
MacRuby
Metrics
MySQL
NetBeans
Objective-C
PMO
Product Management
- A path to accelerating value realization
- A review of software development metrics
- Agile programme management brief
- An alternative to current product development metrics
- An alternative to the current product development governance model
- Express initiative kickoff formula
- Inceptions revisited
- Managing multiple stakeholders
- Plan for value delivery
- Pre-prod activity - Futurespective
- Value Stream Mapping
- When planning, it's not only about relative complexity
Programme management
Project Management
- A path to accelerating value realization
- A review of software development metrics
- Agile programme management brief
- An alternative to current product development metrics
- An alternative to the current product development governance model
- Command & Control Management - The Party Killer
- Express initiative kickoff formula
- Inceptions revisited
- Managing multiple stakeholders
- Plan for value delivery
- Pre-prod activity - Futurespective
- Value Stream Mapping
- When planning, it's not only about relative complexity
Quality Assurance
Rails
Raspberry Pi
Remote compilation
Remote debugging
Remote execution
Risk Assessment
Route 53
Ruby
- Alexa on Rails - how to develop and test Alexa skills using Rails
- Arduino programming using Ruby, Cucumber & rSpec
- How to reconnect to a database when its connection was lost
- Oh, the places you'll go...
- Quick AWS IoT Setup and test
- Weekend warrior - MacRuby and rSpec, Mac OS X Lion, Xcode V4.3.2
- Writing an Alexa skill using Ruby and AWS Lambda (Part 0)
Some helpful links regarding the subject:
- ARM toolchain: GCC ARM Embedded in Launchpad
- Blog entry on setting up an NRF51 dev environment manually: Nordic NRF51 up and running | InContext, by Itamar Hassin
- Setting up an NRF51 dev environment on your mac: ihassin/fruitymesh-mac-osx · GitHub
- Setting up an NRF51 dev environment using Ansible (VirtualBox and Parallels): ihassin/fruitymesh-ubuntu-vm · GitHub
- Compiling an example using Make and CMake : ihassin/nrf51-blinky-cmake · GitHub
- FruityMesh example module: ihassin/fruitymesh-ping · GitHub
- FruityMesh example on official FruityMesh site: fruitymesh/Readme.md at master · mwaylabs/fruitymesh · GitHub
- Debugging NRF51 code using NetBeans GUI: NRF51 full-screen debugging | InContext, by Itamar Hassin