RM0444 Rev 5 95/1390
RM0444 Embedded Flash memory (FLASH)
118
The protected area is execute-only: it can only be reached by the STM32 CPU, with an
instruction code, while all other accesses (DMA, debug and CPU data read, write and
erase) are strictly prohibited. The PCROP areas have subpage (512-byte) granularity. An
additional option bit (PCROP_RDP) allows to select if the PCROP area is erased or not
when the RDP protection is changed from Level 1 to Level 0 (refer to Changing the read
protection level).
Each PCROP area is defined by a start subpage offset and an end subpage offset into the
Flash memory. These offsets are defined with the corresponding bitfields of the PCROP
address registers FLASH PCROP area A start address register (FLASH_PCROP1ASR),
FLASH PCROP area A end address register (FLASH_PCROP1AER), FLASH PCROP area
B start address register (FLASH_PCROP1BSR), and FLASH PCROP area B end address
register (FLASH_PCROP1BER) for single-bank devices or for Bank 1 of dual-bank devices,
and in FLASH PCROP2 area A start address register (FLASH_PCROP2ASR), FLASH
PCROP2 area A end address register (FLASH_PCROP2AER), FLASH PCROP2 area B
start address register (FLASH_PCROP2BSR), and FLASH PCROP2 area B end address
register (FLASH_PCROP2BER) for Bank 2 of dual-bank devices.
A PCROP area x (A or B) of Flash memory Bank y (1 or 2) is defined from the address:
Flash memory base address + [PCROPyx_STRT x 0x200] (included)
to the address:
Flash memory base address + [(PCROPyx_END + 1) x 0x200] (excluded).
The minimum PCROP area size is two PCROP subpages (2 x 512 bytes):
PCROPyx_END = PCROPyx_STRT + 1.
When
PCROPyx_END = PCROPyx_STRT,
the full Flash memory (or bank y for dual-bank devices) is PCROP-protected.
For example, to PCROP-protect the address area from 0x0800 0800 to 0x0800 13FF, set
the PCROP start subpage bitfield of the FLASH_PCROP1xSR register and the PCROP end
subpage bitfield of the FLASH_PCROP1xER register (x = A or B) as follows:
– PCROP1x_STRT = 0x04 (PCROP area start address 0x0800 0800)
– PCROP1x_END = 0x09 (PCROP area end address 0x0800 13FF)
Data read access to a PCROP-protected address raises the RDERR flag.
PCROP-protected addresses are also write protected. Write access to a PCROP-protected
address raises the WRPERR flag.
PCROP-protected areas are also erase protected. Attempts to erase a page including at
least one PCROP-protected subpage fails. Moreover, software mass erase cannot be
performed if a PCROP-protected area is defined.
Deactivation of PCROP can only occur upon the RDP change from Level 1 to Level 0.
Modification of user options to clear PCROP or to decrease the size of a PCROP-protected
area do not have any effect to the PCROP areas. On the contrary
, it is possible to increase
the size of the PCROP-protected areas.
With the option bit PCROP_RDP cleared, the change of RDP from Level 1 to Level 0
triggers a partial mass erase that preserves the contents of the Flash memory pages
overlapping with PCROP-protected areas. Refer to section Changing the read protection
level for details.