1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-18 12:52:44 +01:00

Merge pull request #13646 from benpicco/BACKUP_RAM

cpu: add BACKUP_RAM attribute
This commit is contained in:
Gunar Schorcht 2020-03-19 15:09:30 +01:00 committed by GitHub
commit 4ac8f8df4c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 39 additions and 2 deletions

View File

@ -73,6 +73,20 @@ extern "C" {
*/
#define PUF_SRAM_ATTRIBUTES __attribute__((used, section(".puf")))
#if CPU_HAS_BACKUP_RAM || DOXYGEN
/**
* @brief Memory marked with this attribute is retained during deep sleep
* and initialized with 0 on cold boot.
*/
#define BACKUP_RAM __attribute__((section(".backup.bss")))
/**
* @brief Memory marked with this attribute is retained during deep sleep
* and initialized with user provided data on cold boot.
*/
#define BACKUP_RAM_DATA __attribute__((section(".backup.data")))
#endif /* CPU_HAS_BACKUP_RAM */
#ifdef __cplusplus
}
#endif

View File

@ -51,6 +51,18 @@ extern "C" {
*/
#define PRINTF_BUFSIZ 256
/**
* @brief Memory marked with this attribute is retained during deep sleep
* and initialized with 0 on cold boot.
*/
#define BACKUP_RAM __attribute__((section(".rtc.bss")))
/**
* @brief Memory marked with this attribute is retained during deep sleep
* and initialized with user provided data on cold boot.
*/
#define BACKUP_RAM_DATA __attribute__((section(".rtc.data")))
#ifdef __cplusplus
}
#endif /* CPU_CONF_H */

View File

@ -6,7 +6,6 @@
* directory for more details.
*/
#ifndef CPU_CONF_H
#define CPU_CONF_H
@ -127,6 +126,18 @@ extern "C" {
*/
#define NUM_HEAPS (4)
/**
* @brief Memory marked with this attribute is retained during deep sleep
* and initialized with 0 on cold boot.
*/
#define BACKUP_RAM __attribute__((section(".backup.bss")))
/**
* @brief Memory marked with this attribute is retained during deep sleep
* and initialized with user provided data on cold boot.
*/
#define BACKUP_RAM_DATA __attribute__((section(".backup.data")))
#ifdef __cplusplus
}
#endif

View File

@ -39,7 +39,7 @@ int main(void)
* counter anyway after wakeup, we did not sleep properly.
*/
static int counter_noinit __attribute__((section(".noinit")));
static int counter __attribute__((section(".backup.bss")));
static int counter BACKUP_RAM;
if (counter == 0) {
puts("\nBackup RAM test\n");