Program and secure in one step

Is it possible to use the nrfjprog utility to program and secure (from read over the SWD) the nRF52840 in one step? I tried:

nrfjprog -f NRF52 --program abc.hex --chiperase --verify --memwr 0x10001208 --val 0xFFFFFF0
ERROR: Two arguments were provided that cannot be combined. Use --help to read
ERROR: about the valid argument combinations.
NOTE: For additional output, try running again with logging enabled (--log).
NOTE: Any generated log error messages will be displayed.

Doing a separate:

nrfjprog -f NRF52 --program abc.hex --chiperase --verify

and then:

nrfjprog -f NRF52 --memwr 0x10001208 --val 0xFFFFFF0

works, but that could mean it is possible to program the part without securing it from readout if the 2nd step is missed or fails.

Parents
  • Hi Simon, 
    You can do it in one go by preparing  your hex file with the address 0x10001208 already written. 

    What you can do is to flash with 2 steps as above. But don't reset the chip, so that you still have access to the chip. Then save the UICR to a file by using: 
    nrfjprog --readuicr uicr.hex

    You then can merge the uicr.hex with your application.hex do: 
    mergehex.exe -m abc.hex uicr.hex -o merged_uicr.hex 

    With that you only need to flash merged_uicr.hex to have the address 0x10001208 written when you flash the application. 

Reply
  • Hi Simon, 
    You can do it in one go by preparing  your hex file with the address 0x10001208 already written. 

    What you can do is to flash with 2 steps as above. But don't reset the chip, so that you still have access to the chip. Then save the UICR to a file by using: 
    nrfjprog --readuicr uicr.hex

    You then can merge the uicr.hex with your application.hex do: 
    mergehex.exe -m abc.hex uicr.hex -o merged_uicr.hex 

    With that you only need to flash merged_uicr.hex to have the address 0x10001208 written when you flash the application. 

Children
No Data
Related