NVM integrity is assured through use of multiple levels of protection. Protection mechanisms can be configured to allow or block certain operations.
The table below shows the different status of protection bits, and which operations are allowed or blocked.
| Protection bit status | NVMC protection | |||
|---|---|---|---|---|
| SECUREAPPROTECT | APPROTECT | ERASEPROTECT | CTRL-AP ERASEALL | NVMC ERASEALL |
| 0 | 0 | 0 | Available | Available |
| 1 | X | 0 | Available | Blocked |
| X | 1 | 0 | Available | Blocked |
| X | X | 1 | Blocked | Blocked |
| 1 - Enabled, 0 - Disabled, X - Don't care | ||||
Uploading code with secure debugging blocked
Non-secure code can program non-secure flash regions. To perform these operations, the NVMC has the following non-secure registers: CONFIGNS, READY, and READYNEXT.
CONFIGNS works as the CONFIG register but it is used only for non-secure transactions. Both page erase and writing inside the flash require a write transaction (see Erasing a secure page in flash or Erasing a non-secure page in flash). Because of this, the SPU — System protection unit will guarantee that the non-secure code cannot write inside a secure page, since the transaction will never reach the NVMC controller.