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

How to set nrf51 Read Back Protection using OpenOCD?

Looking for the OpenOCD equivalent of ""nrfjprog --rbp all"

Looking at the commands for OpenOCD they have a "flash protect" command, but it doesn't appear that's quite the same thing (requests regions of flash).

Any assistance for a OpenOCD newbie would be appreciated!

Parents
  • Hi Jerod,

    Simply write 0xFFFF00FF to UICR->RBCONF register which resides on address 0x100010004. To be precise you should read it out and mask with that value (to preserve PR0 register part on the least significant byte of the register in case it is used). Also make sure what endian OpenOCD use to code raw 32-bit hexadecimal values when writing to the memory. In the end reset the target and memory should be protected.

    Btw. you can easily do this from within the FW code to be sure that you don't forget this in production and also note that nRF51 has major security hole in read-back protection and debugging interface so doing RBALL is rather cosmetic thing which saves you against people who cannot use Google search.

    Cheers Jan

    Edit 10-Feb-2017

    Here is HEX file which writes RBALL to UICR->RBCONF on any nRF51 variant. It can be flashed by any tool including OpenOCD. Can be stripped down to single register write (with little bit of work with GCC tools or similar) but normally it isn't needed.

    Cheers Jan

    nrf51822_UICR_lock.hex

  • You can use the IDAP-Link. It will do all that for without needing to do any concatenation of hex and multiboards in parallel

Reply Children
No Data
Related