nrfjprog offers a variety of commands for programming Nordic Semiconductor SoCs with different options and executing other operations on the SoCs.
There are shorthand forms for the most commonly used commands. Some commands will only function together with other commands.
| Shorthand form | Command | Description |
|---|---|---|
-q |
--quiet |
Reduces the stdout info. Must be combined with another command. |
-h |
--help |
Displays this help. |
-v |
--version |
Displays the nrfjprog and DLL versions. |
--force |
Bypasses all questions to continue. Use this flag when scripting. | |
--log [<path>] |
Enables logging. The default output file is log.log. Specify a file path to modify the output file name and/or location. If the parent folder of the specified file does not exist, nrfjprog attempts to create it. Logger output is appended to the file. Must be combined with another command. | |
--jdll <file> |
Specifies the file path of the JLinkARM DLL that should be used. If this
command is omitted, nrfjprog searches for the latest version of
SEGGER's JLinkARM DLL. Must be combined with another command. Note the following
limitation:
|
|
--config <file> |
--config | Uses the nrfjprog settings file specified in the given file path instead of searching for the default config.toml file in the installation folder. TOML configuration files may contain both QSPI and nrfjprog target settings. Must be combined with another command. |
--storeconfig <file> |
--storeconfig | Stores the nrfjprog settings loaded from --config / --ini / --qspiini and command line to file in TOML formatting. This option can be used to translate old INI files to TOML files for example. |
--ini <file> |
Deprecated: Use a TOML file with |
|
--qspiini <file> |
Deprecated: Use a TOML file with --memrd, --memwr,
--program, --verify,
--erasepage, or --qspieraseall.Note the
following limitation:
|
|
--qspicustominit |
Deprecated. This operation does nothing. | |
-i |
--ids |
Displays the serial numbers of all the debuggers connected to the computer. |
--expand |
Expands the information printed by --ids. This is useful for seeing addition information on network connected debug probes. |
|
--com |
Displays a list of the serial ports associated with all connected debuggers. If
combined with --snr, this option displays all serial ports
associated with the given debugger. |
|
--deviceversion |
Displays the type of the device that is connected. If combined with
--snr, this option displays the type of the device that is
associated with the given debugger. |
|
-f |
--family <family> |
Selects the device family for the operation. Valid argument options are NRF51,
NRF52, NRF53, NRF91, and UNKNOWN. If UNKNOWN family is given, an automatic detection
of the device family is performed. Note that providing the actual family is faster
than performing the automatic family detection. If the --family
option is not given, the default is taken from nrfjprog.ini.
Must be combined with another command. |
-s |
--snr <serial_number> |
Selects the debugger with the given serial number among all debuggers connected to the computer for the operation. Must be combined with another command. |
--ip [<hostname>|<ip>|<tunnel>] |
Provide a network connection string for target debugger. This string can be an
IPv4 address or a hostname. The port to connect to can be specified with the
--port option. Passing --ip without any
arguments is equivalent to passing --iface ip. It is possible to
connect to a debugger running in tunneling mode. Shortened tunnel connection string
format is not supported. An example of a tunnel mode connection string is:
tunnel:123456789:pwd:jlink-europe.segger.com. Read more about
J-Link connection types at SEGGER J-Link Remote Server. Must be
combined with another command. |
|
--port <port> |
Selects which port to use when establishing a network connection to a debugger. Must be used
together with the --ip option.
Default port is 19020. |
|
-c |
--clockspeed <speed> |
Sets the debugger SWD clock speed in kHz resolution for the operation. The
valid clock speed arguments go from 4 kHz to 50000 kHz. If the given clock speed
is above the maximum clock speed supported by the emulator, its maximum will be used
instead. If the --clockspeed option is not given, the default is
taken from nrfjprog.ini. Must be combined with another command. |
--iface <USB|IP> [USB|IP] |
Sets which interfaces to use when searching for and connecting to debuggers.
Both USB and IP can be listed at the same time.
By default, only USB connected debuggers are targeted unless the --ip option is present.
This option is mainly intended to be used together with --snr and --ids.
Must be combined with another command. |
|
--recover |
Erases all user flash memory and disables the readback protection mechanism if enabled. | |
--rbp <level> |
Enables the readback protection mechanism. Valid argument options are CR0 and
ALL. Note the following limitation:
Note: After an
--rbp operation is performed, the
available operations are reduced. For nRF51 devices, and if argument option ALL is
used, --pinreset will not work on certain older devices. For
nRF52 devices, only --pinreset or --recover
operations are available after --rbp. |
|
--pinresetenable |
Enables pin reset by using the UICR PSELRESET registers. Note the following
limitation:
|
|
-p |
--pinreset |
Performs a pin reset. Core will run after the operation. Can be combined with the --program
operation. If combined, the reset will occur after the
flashing has occurred to start execution. |
--hardreset |
Performs a hard reset. Core will run after the operation. Can be combined with the --program operation.
If combined with the --program operation, the reset will occur after the flashing has occurred to start execution.
Note the following limitation:
|
|
-r |
--reset |
Performs a soft reset by setting the SysResetReq bit of the AIRCR register of
the core. The core will run after the operation. Can be combined with the
--program operation. If combined with the
--program operation, the reset will occur after the flashing has
occurred to start execution. |
-d |
--debugreset |
Performs a soft reset by use of the CTRL-AP. The core will run after the
operation. Can be combined with the --program operation. If
combined with the --program operation, the debug reset will occur
after the flashing has occurred to start execution.Note the following
limitations:
|
-e |
--eraseall |
Erases all user available program flash memory and the UICR page. Can be
combined with the --qspieraseall operation.Note the following
limitation:
|
--qspieraseall |
Erases all flash of the external memory device with help of the QSPI
peripheral. Note that depending on the external memory device's erase speed, the
operation might take several minutes. Can be combined with the
--eraseall operation.Note the following limitations:
|
|
--eraseuicr |
Erases the UICR page. Note the following limitations:
|
|
--erasepage <start[-end]> |
Erases the flash pages starting at the given start address and ending at the
given end address (not included in the erase). If no end address is given, only one
flash page will be erased. If your device is equipped with a QSPI peripheral, the
pages to erase belong to the XIP region of the device, and an external memory device
is present, this command erases 4 kB pages from the external memory device. The first address of the region is considered as address 0 of
the external memory device.
To determine if an external memory device is
present, nrfjprog checks the MemSize parameter from the
QspiDefault.ini file or from the QSPI configuration
ini file that is given with the --qspiini option.Note the
following limitation:
|
|
--program <image_file> [--sectorerase | --chiperase |
--sectoranduicrerase][--qspisectorerase | --qspichiperase] |
Programs the specified image_file into the device. Supported
file formats are HEX, IHEX, ELF, AXF, and BIN. A valid format must be specified by the filename extension.
If the
target area to program is not erased, the --program operation
will fail, unless an erase option is given. Valid erase operations for the
internal flash memory are --recover, --sectorerase,
--sectoranduicrerase, and --chiperase. If
Note that the If
your device is equipped with a QSPI peripheral and an external memory device is
present, data targeting the XIP region will be written to the external memory
device. The first address of the region is considered as address 0 of
the external memory device.
To determine if an external memory device is
present, nrfjprog checks the MemSize parameter from the
QspiDefault.ini file or from the QSPI configuration
ini file that is given with the If the
target area to program is not erased, the If Note the
following limitations:
|
|
--memwr <addr> --val <val> [--verify] |
Writes to the provided address in memory with the help of the NVM Controller
or, if your device is equipped with a QSPI peripheral and the address to write
belongs to the XIP region, with the help of the QSPI peripheral to an external
memory device. To determine if an external memory device is
present, nrfjprog checks the MemSize parameter from the
QspiDefault.ini file or from the QSPI configuration
ini file that is given with the --qspiini option.
The first address of the region is considered as address 0 of
the external memory device. If the target address is
within flash memory (either internal or external) and not erased prior to the
writing, the memory may end up with incorrect values after the write. This command
can be combined with the --verify operation to check for these
cases. |
|
--ramwr <addr> --val <val> [--verify] |
Writes to memory without help of the NVM Controller to the provided address.
If the target address is in non-volatile
memory, --ramwr will have no effect unless the
non-volatile memory controller (NVMC) has been
previously configured by the user for a write
operation. This command can be combined with the --verify operation. |
|
--verify [<image_file>][--fast] |
Compares the provided image_file contents with the contents in
the device code flash, RAM, UICR, and XIP regions (for devices that are equipped
with a QSPI peripheral and connected to an external memory device) and fails if
there is a mismatch. Supported
file formats are HEX, IHEX, ELF, AXF, and BIN. A valid format must be specified by the filename extension. To determine if an external memory device is
present, nrfjprog checks the MemSize parameter from the
QspiDefault.ini file or from the QSPI configuration
ini file that is given with the --qspiini option. If the optional
--fast parameter is given, nrfjprog will calculate a hash of the
flash target area using a SHA-256 algorithm and compare it to the expected hash
instead of reading back the actual contents of the device flash in order to speed
the operation. This command can be combined with the --program,
--memwr, and --ramwr operations if provided
without the hex_file parameter.Note the following limitation:
|
|
--memrd <addr> [--w <width>] [--n <n>] |
Reads n bytes from the provided address. If
width is not given, 32-bit words are read if
addr is word aligned, 16-bit words if addr is
half word aligned, and 8-bit words otherwise. If n is not given,
one word of size width is read. The address and n must be aligned
to the width parameter. The maximum number of bytes that can be read is 1 MB. The
width must be 8, 16, or 32. If your device is equipped with a QSPI peripheral and
the addresses to read belong to the XIP region, the QSPI peripheral is used to read
from the external memory device if present. To determine if an external memory device is
present, nrfjprog checks the MemSize parameter from the
QspiDefault.ini file or from the QSPI configuration
ini file that is given with the --qspiini option.
The first address of the region is considered as address 0 of
the external memory device.Note the following
limitation:
|
|
--halt |
Halts the CPU core. | |
--run [--pc <pc_addr> --sp <sp_addr>] |
Starts the CPU. If --pc and --sp options are
given, the pc_addr and sp_addr are used as initial
PC and stack pointer. For pc_addr to be valid, its last bit must be
one. For sp_addr to be valid, it must be word aligned. |
|
--readuicr <file> |
Reads the device UICR and stores it in the given file name.
Can be combined with --readram, --readcode, and
--readqspi. If combined, only one instruction can provide a
file name. Supported
file formats are HEX, IHEX, ELF, AXF, and BIN. A valid format must be specified by the filename extension. |
|
--readcode <file> |
Reads the device flash and stores it in the given file name.
Can be combined with --readuicr, --readram, and
--readqspi. If combined, only one instruction can provide a
file name. Supported
file formats are HEX, IHEX, ELF, AXF, and BIN. A valid format must be specified by the filename extension. |
|
--readram <file> |
Reads the device RAM and stores it in the given file name. Can
be combined with --readuicr, --readcode, and
--readqspi. If combined, only one instruction can provide a
file name. Supported
file formats are HEX, IHEX, ELF, AXF, and BIN. A valid format must be specified by the filename extension. |
|
--readqspi <file> |
Reads the QSPI-connected external memory and stores it in the given file name. Can be combined with --readuicr,
--readcode, and --readram. If combined, only one
instruction can provide a file name. Supported
file formats are HEX, IHEX, ELF, AXF, and BIN. A valid format must be specified by the filename extension. |
|
--readregs [--pc <pc_addr> --sp <sp_addr>] |
Reads the CPU registers. | |
--readregs [<first_register>] [<second_register>] |
Reads the CPU registers. If no optional arguments are specified, all CPU registers in the selected core are printed. If the optional argument first_register is specified, only that register is printed. If both first_register and second_register are specified, the registers between and including first_register and second_register are printed. |
|
--readficr <file> |
Reads the device FICR and stores it into the provided file name. Can be combined with --readuicr, --readram and --readcode. If combined, only one instruction can provide a file name. Supported
file formats are HEX, IHEX, ELF, AXF, and BIN. A valid format must be specified by the filename extension. |
|
--coprocessor <coprocessor> |
Connects the device to the selected coprocessor. Valid arguments are
CP_APPLICATION, CP_MODEM, CP_NETWORK,
CP_PPR, and CP_FLPR. If --coprocessor option
is not used, CP_APPLICATION is used as target. Must be combined with another
command. |