Do you want a more efficient way to program your devices than nRFgo Studio? Are you an OS X or Linux user who has struggled setting up a toolchain for nRF5x devices? Maybe you are using JLink.exe or an open source tool to program your devices or maybe you even wrote your own? If this is you READ THIS POST!
If you have already been using nrfjprog, pynrfjprog, mergehex you may want to skip to the 'Multi API' section of this post. This introduces the new feature in pynrfjprog that enables multiple devices to be controlled and selectively programmed from python (great for automated testing, scripting, workflow, etc...).
As developers our goal is to ship a great product. We have time constraints and deadlines to meet and to efficiently build our product we need to have a good workflow in place. It is key to be able to compile, run and debug applications quickly. It is proven a shorter compile & run/debug cycle leads to cleaner, less buggy code. And added efficiency here WILL ultimately lead to a better product and make you a happier developer. If it takes you over 30 seconds to build and run/debug your applications (including erasing the chip, programming soft-device & or bootloader along with your application) then you are not operating at full efficiency. From blinky to production you will do this thousands of times - take a few minutes to get this right!
#What does an ideal toolchain for nRF5x devices look like currently?
#5 minute nrfjprog quick start
nrfjprog is a command line utility that allows you to erase, flash, unlock, read/write memory etc... from the command line.
EDIT (nikolaus's comment): I've added nrfjprog (and mergehex) to Homebrew Cask, meaning they can be installed on OS X using:
brew cask install nrf5x-command-line-tools
This will automatically handle putting them in the right place, so they'll be in your PATH and immediately usable. Thanks!
Note: nrfjprog and pynrfjprog relies on SEGGER's JLinkARM.dll. This means it will only work with a debugger running SEGGER firmware (all our development kits come shipped with SEGGER software so this works by default).
mergehex.exe is in the same folder as nrfjprog.exe so just run mergehex from the command line and read the man page and you will understand how to use it.
The most common nrfjprog commands:
#5 minute pynrfjprog quick start
pynrfjprog has the same functionality of nrfjprog and more in Python! You may want to use shell scripting with nrfjprog to do many things in one command but pynrfjprog gives you finer control of the nRF5x device and gives you options like using Python's Unit Testing Framework and many of the benefits that come along with Python.
Example of pynrfjprog in use:
And most of the functions available from API.py (Just open 'C:\Python27\Lib\site-packages\pynrfjprog\API.py':
#pynrfjprog new feature: Multi API
Just a quick demo of the new feature. Very similar to what you are used to with pynrfjprog - just unlocks new possibilities.
#Where to go from here
What tools do you use? Do you use JLink.exe? Why do you use this instead of nrfjprog? What will you use these tools for? Any suggestions? What do you want to see, what isn't necessary? Official documentation on these tools is currently being edited and will be on the infocenter soon. What other documentation do you need, examples? Do you flash your softdevice/application directly from the IDE? Why not? How is your workflow efficient? done
EDIT: Do you want our tools to be open source? How would this help you?
I had to use this to install via Homebrew:
brew tap caskroom/drivers
brew cask install nordic-nrf5x-command-line-tools
When I use MultiAPI with multi thread
with MultiAPI.MultiAPI("NRF51") as api:
Sometimes an error occurs like below:
I don't know how to edit my previous comment, so you need to install JLink:https://www.segger.com/downloads/jlink/#J-LinkSoftwareAndDocumentationPackThe example in the previous comment is for my case, I am using Linux.