30.6.12.4 Lock Regions

The NVMCTRL has the ability to lock regions with respect to the IDAU memory mapping:

  • FLASH Boot Secure and Non-Secure Callable regions
  • FLASH Boot Non-Secure region
  • FLASH Application secure region
  • FLASH Application non-Secure and Non-Secure Callable regions
  • Data FLASH Secure region
  • Data FLASH Non-Secure region

When a region is locked, all modify commands (i.e. write or erase) directed to this region are discarded. A LOCKE error is reported in the INTFLAG register and can generate an interrupt.

To lock or unlock a region, write a one to the corresponding bitfield in SULCK and NSULCK registers Writes to these registers are silently discarded if the key is not correct. Writing these registers with the correct key will temporarily lock or unlock the corresponding regions. The new lock setting will stay in effect until the next reset, or until the setting is changed again while writing SULCK and NSULCK.

Note: Writes to these registers are silently discarded if the key is not correct.

The current status of the lock can be determined by reading the SULCK and NSULCK registers. To change the default lock/unlock setting for a region, the NVM User Row (UROW) must be written using the Write Page command. Writing to the NVM User Row (UROW) will take effect after the next Reset. Therefore, a boot of the device is needed for changes in the lock/unlock setting to take effect. Refer to the Physical Memory Map for NVM User Row (UROW) space address mapping.

SULCK is a Write-Secure register:
  • This register can only be written by secure hosts from the secure alias
  • This register is always readable by secure or non-secure hosts from their respective alias
NSULCK is a Write-Mix-Secure register:
  • This register can always be written by a secure host from the secure alias
  • Or, by a non-secure host from the non-secure alias only if NONSEC.WRITE is set
  • This register is always readable by secure or non-secure hosts in their respective alias