nrfjprog is a command-line tool which can program the nrf51822 using J-Link Commander in the same way RKNRFGO does.
Usage: nrfjprog wipe | program | list | update
[ -c,--code <codepath> ]
[ -s,--softdevice <softdevice> ]
[ -S,--softdeviceversion <softdevice version> ]
[ -b,--bootloader <bootloader> ]
[ --serial <segger serial> ]
[ -j,--jlinkexe <JLinkExe> ]
[ -v,--verbose ]
[ -q,--quiet ]
[ -V, --version ]
The arguments can be in any order and you can use either the single or double hyphen options interchangeably.
There must be one, and only one, command, either wipe
, program
, list
or update
wipe - wipes the device
program - programs the device with code, optional soft device and boot loader
list - lists the serial numbers of attached Seggers
update - checks for and if necessary updates the internal database of known softdevices
If you are program
-ing you must at least provide code and optionally a softdevice, and if you provide a softdevice, optionally a bootloader. For wipe
, list
and update
they are ignored.
nrfjprog keeps an internal list of known softdevices. If you supply a softdevice file whos signature is recognised, there's no need to provide a softdevice version with -S
or --softdeviceversion
on the command line. If it's not recognised, then you need to supply that argument so the executable can check code start address etc.
The update
command checks for a more recent softdevice info database and updates if necessary, so if your softdevice image isn't recognised, try that. If the database is updated, it's saved in preferences for the next time you run nrfjprog.
-c or --code - path to .hex file containing the code to flash
-s or --softdevice - path to .hex file containing the softdevice if used
-S or --softdeviceversion - the softdevice version, required if programming an unknown
softdevice
(nrfjprog -V prints a list of known versions)
-b or --bootloader - path to .hex file containing the bootloader if used
If you have only one connected segger, that one will be used, if you have more than one, you need to specify the serial number. You can get a list of currently connected devices with the list
command. You can also specify it if you only have one connected and it will be used only if the serial number matches.
-serial - the segger serial number
You must have the J-Link Commander software installed, the tool uses it to actually communicate with the device. A standard install places it in /usr/local/bin/JLinkExe. If you have installed it elsewhere, you need to tell nrfjprog where to find it.
-j or --jlinkexe - path to JLinkExe
To show what nrfjprog is doing, specify verbose. If you want the version of the software, the version option will print it out and then immediately exit.
-v or --verbose - show a log of commands called by nrfjprog
-V or --version - print a version string plus the list of known softdevices and exit