|
|
|
## Overview
|
|
|
|
The STM32F2/F4 microcontrollers provide a backup domain that includes 4 Kbytes of backup SRAM. This region can be considered as an internal EEPROM when VBAT is present: its content is preserved upon reset if VBAT is connected. This means that it can be used as a safe-guard memory (SGM).
|
|
|
|
|
|
|
|
> :information_source: **INFO: Of course you can connect VBAT to the board's power supply, but it would not provide the same reliability level as having a backup battery or a different power supply.**
|
|
|
|
> :warning: **Of course you can connect VBAT to the board's power supply, but it would not provide the same reliability level as having a backup battery or a different power supply.**
|
|
|
|
|
|
|
|
> :information_source: **If you are using a Discovery board, check its schematic to know if VBAT is connected. For example the STM32F407VG Discovery VBAT pin is directly connected to the board's main power supply, which can simplify testing the backup SRAM usage.**
|
|
|
|
|
|
|
|
The backup region also includes twenty 32-bit registers that can be used store a total of 80 bytes (word-aligned). Backup registers are not reset by a system, a power reset, or when the device wakes up from the standby mode.
|
|
|
|
|
| ... | ... | @@ -34,6 +36,10 @@ uint8_t myvar PRESERVE; |
|
|
|
// same as
|
|
|
|
uint8_t myvar __attribute__((section(".preserve")));
|
|
|
|
```
|
|
|
|
It is also possible to specify the exact address at which we want the variable to be allocated:
|
|
|
|
```cpp
|
|
|
|
uint8_t myvar __attribute__((section(".preserve__at_0x40024055")));
|
|
|
|
```
|
|
|
|
|
|
|
|
## Example
|
|
|
|
These basic examples show how you can write to the backup SRAM using the Miosix SGM driver.
|
| ... | ... | |