
RM0453 Rev 2
99/1454
RM0453
Embedded Flash memory (FLASH)
153
boot from. It prevents the system to boot from the Flash main memory area when, for
example, no user code is programmed.
The Flash main memory empty check status can be read from the EMPTY bit in the
FLASH_ACR register. Software can modify the Flash main memory empty status by writing
to the EMPTY bit.
The internal empty check flag (EMPTY bit in FLASH_ACR) is implemented to allow easy
programming of virgin devices by the bootloader. This flag is used when the BOOT0 pin
defines the main Flash memory as target boot area. When this flag is set, the device is
considered as empty and the system memory (bootloader) is selected instead of the main
Flash memory as a boot area, to allow the user to program the Flash memory. Therefore,
some of the GPIOs are reconfigured from the High-Z state. Refer to the application note
AN2606 for more details concerning the bootloader and GPIO configuration in system
memory boot mode. This feature can be disabled by configuring the option bytes to force a
boot from the main Flash memory (nSWBOOT0 = 0, nBOOT0 = 1).
This empty check flag is updated only during the loading of option bytes: it is set when the
content of the address 0x08000 0000 is read as 0xFFFF FFFF, otherwise it is cleared. A
power reset or setting of OBL_LAUNCH bit in FLASH_CR is needed to clear this flag after
programming of a virgin device to execute user code after a system reset. The EMPTY bit
can also directly be written by software.
4.3.3
Error code correction (ECC)
Data in Flash memory words are 72-bit wide: eight bits are added per each double-word
(64 bits).
The ECC mechanism supports the following modes:
•
one error detection and correction
•
two errors detection
When one error is detected and corrected, the flag ECCC (ECC correction) is set in
FLASH_ECCR. If ECCCIE is set, an interrupt is generated.
When two errors are detected, the flag ECCD (ECC detection) is set in FLASH_ECCR. In
this case, an NMI is generated.
When an ECC error is detected, the address of the failing double-word is saved in
ADDR_ECC[16:0] in FLASH_ECCR. ADDR_ECC[2:0] bits are always cleared. The bus-ID
of the CPU accessing the address is saved in CPUID[2:0].
While ECCC or ECCD is set, FLASH_ECCR is not updated if a new ECC error occurs.
FLASH_ECCR is updated only when ECC flags are cleared.
Note:
For a virgin data (0xFF FFFF FFFF FFFF FFFF), one error is detected and corrected, but
the two errors detection mode is not supported.
When an ECC error is reported, a new read at the failing address may not generate an ECC
error if the data is still present in the current buffer, even if ECCC and ECCD are cleared. If
this is not the desired behavior, the user must reset the cache.
4.3.4 Read
access
latency
To correctly read data from the Flash memory, the number of wait states (LATENCY[2:0])
must be correctly programmed in FLASH_ACR according to the frequency of the Flash