
Embedded Flash memory (FLASH)
RM0453
104/1454
RM0453 Rev 2
are saved in a current buffer. The CPU2 pipeline is consequently stalled until the requested
literal pool is provided.
No data cache is available on CPU2.
4.3.6
Flash program and erase operations
The embedded Flash memory can be programmed using in-circuit programming or in-
application programming.
The in-circuit programming (ICP) method is used to update the entire contents of the Flash
memory using the JTAG, SWD protocol or the supported interfaces by the system
bootloader, to load the user application for CPU1 and CPU2, into the microcontroller. ICP
offers quick and efficient design iterations and eliminates unnecessary package handling or
socketing of devices.
In contrast to the ICP method, in-application programming (IAP) can use any
communication interface supported by the microcontroller (such as I/Os, UART, I
2
C or SPI)
to download programming data into memory. IAP allows the user to re-program the Flash
memory while the application is running. Nevertheless, part of the application must have
been previously programmed in the Flash memory using ICP.
The contents of the Flash memory are not guaranteed if a device reset occurs during a
Flash memory operation.
During a program/erase operation to the Flash memory, any attempt to read the Flash
memory stalls the bus. The read operation proceeds correctly once the program/erase
operation is completed.
Note:
In a multi CPU system, it is good practice to use semaphores to manage Flash program and
erase operations, and prevent simultaneous operations by the CPUs.
Secure Flash programming
When the system is secure (ESE=1), the secure CPU2 application can only be programmed
by in-circuit programming (ICP) using SFI/RSS or in-application programming (IAP) running
on the secure CPU2. Only the secure CPU2 is able to download programming data into
secure part of the memory. Secure IAP allows the user to re-program the Flash memory
while the application is running. Nevertheless, part of the application must have been
previously programmed in the Flash memory using ICP.
Unlocking the Flash memory
After a reset, write is not allowed in FLASH_CR or FLASH_C2CR to protect the Flash
memory against possible unwanted operations (for example, electric disturbances).
The following sequence is used to unlock these registers:
1.
Write KEY1 = 0x4567 0123 in FLASH_KEYR.
2. Write KEY2 = 0xCDEF 89AB in FLASH_KEYR.
Any wrong sequence locks up FLASH_CR and FLASH_C2CR until the next system reset.
In the case of a wrong key sequence, a bus error is detected and a hard fault interrupt is
generated.
FLASH_CR and FLASH_C2CR can be locked again by software by setting their respective
LOCK bit.