Embedded Flash memory (FLASH) RM0444
96/1390 RM0444 Rev 5
Note: With PCROP_RDP cleared, it is recommended to either define the PCROP area start and
end onto Flash memory page boundaries (2-Kbyte granularity), or to keep reserved and
empty the PCROP-unprotected memory space of the PCROP area boundary pages (pages
inside which the PCROP area starts and ends).
3.5.3 FLASH write protection (WRP)
The user area in Flash memory can be protected against unwanted write operations. Two
write-protected (WRP) areas can be defined, with page (2-Kbyte) granularity. Each area is
defined by a start page offset and an end page offset related to the physical Flash memory
base address. These offsets are defined in the WRP address registers FLASH WRP area A
address register (FLASH_WRP1AR) and FLASH WRP area B address register
(FLASH_WRP1BR), and, for dual-bank devices, also FLASH WRP2 area A address
register (FLASH_WRP2AR) and FLASH WRP2 area B address register
(FLASH_WRP2BR).
The WRP x area (x = A, B) of bank y (y = 1 or 2) is defined from the address
Flash memory Base address + [WRPyx_STRT x 0x0800] (included)
to the address
Flash memory Base address + [(WRPyx_END+1) x 0x0800] (excluded).
The minimum WRP area size is one WRP page (2 Kbytes):
WRPyx_END = WRPyx_STRT.
For example, to protect the Bank 1 of Flash memory by WRP from the address 0x0800 1000
(included) to the address 0x0800 3FFF (included):
If boot in Flash memory is selected, FLASH_WRP1AR register must be programmed
with:
– WRP1A_STRT = 0x02.
– WRP1A_END = 0x07.
WRP1B_STRT and WRP1B_END in FLASH_WRP1BR can be used instead (area B in
Flash memory).
When WRP is active, it cannot be erased or programmed. Consequently, a software mass
erase cannot be performed if one area is write-protected.
Table 20: PCROP protection
PCROP register values
(x=A or B, y=1or2)
PCROP-protected area
PCROPyx_STRT = PCROPyx_END Full Flash memory
PCROPyx_STRT > PCROPyx_END None (unprotected)
PCROPyx_STRT < PCROPyx_END
Subpages from PCROPyx_STRT to PCROPyx_END
(read-, write-, and erase-protected);
PCROP area boundary pages (erase-protected).