This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nrfjprog --programs <hex_file> [--dfu]

Hi there,

I am using the nrfjprog to flash the nrf51822 via a J-Tag programmer. Here is the command I used in the command prompt:

nrfjprog --eraseall --programs softdevice.hex --program application.hex bootloader.hex --verify --reset

During the programming process, it prompts me this warning message:

"WARNING: Since the option "--dfu" was not given, the SoftDevice will include UICR settings. Please be aware that Device Firmware Update of the SoftDevice will not be possible with these settings."

Then, I included the "--dfu" in the command

nrfjprog --eraseall --programs softdevice.hex --dfu --program application.hex bootloader.hex --verify --reset

The SoftDevice (in Region 0 when the "--dfu" was not given) became in Region 1. I tested these two configuration on my device. They both worked. Is there any difference when SoftDevice is sitting at Region 1?

I tried to look for some information on the "--dfu" option. But I found no clear information.

--programs "hex_file" [--dfu] Programs the specified hex into the device. In addition, checks that the hex file is a well constructed SoftDevice: It contains a the FWID either in the UICR or the SoftDevice itself, it contains a valid value for the length of the SoftDevice, does not contain any data above the afore mentioned length, and only writes into SoftDevice reserved space in UICR. Can be combined with the erase operations, the reset operations and the other programming operations. If dfu option is given and the SoftDevice allows it, the device will not be run time protected. otherwise, the UICR.CLENR0 will be written. It will automatically disable the MPU NVM protection regions if enabled and enable it again after the program operation.

Thanks so much in advance for your help.

Cheers, Rocky

Parents
  • Hi Rocky,

    First of all please update your nrfjprog tool as you seems to be using outdated version.

    regarding your question, below is the text from Series Reference Manual from chapter UICR "The code area can be divided into two regions, code region 0 (CR0) and code region 1 (CR1). Code region 0 starts at address 0x00000000 and stretches into the code area as specified in the CLENR0 register. The area above CLENR0 will then be defined as code region 1. If CLENR0 is not configured, that is, has the value 0xFFFFFFFF, the whole code area will be defined as code region 1 (CR1).

    Code running from code region 1 will not be able to write to code region 0. Additionally, the content of code region 0 cannot be read from code running in code region 1 or through the SWD interface if code region 0 is readback protected, see PR0 in RBPCONF.

    The main readback protection mechanism that will protect the whole code, that is, both code region 0 and code region 1, is also configured through the UICR."

    softdevice running as CR1 does not effect anything except that that application which is also in CR1 can modify softdevice code, also if you want readback protection enabled,it wont work if softdevice is located in CR1.

Reply
  • Hi Rocky,

    First of all please update your nrfjprog tool as you seems to be using outdated version.

    regarding your question, below is the text from Series Reference Manual from chapter UICR "The code area can be divided into two regions, code region 0 (CR0) and code region 1 (CR1). Code region 0 starts at address 0x00000000 and stretches into the code area as specified in the CLENR0 register. The area above CLENR0 will then be defined as code region 1. If CLENR0 is not configured, that is, has the value 0xFFFFFFFF, the whole code area will be defined as code region 1 (CR1).

    Code running from code region 1 will not be able to write to code region 0. Additionally, the content of code region 0 cannot be read from code running in code region 1 or through the SWD interface if code region 0 is readback protected, see PR0 in RBPCONF.

    The main readback protection mechanism that will protect the whole code, that is, both code region 0 and code region 1, is also configured through the UICR."

    softdevice running as CR1 does not effect anything except that that application which is also in CR1 can modify softdevice code, also if you want readback protection enabled,it wont work if softdevice is located in CR1.

Children
Related