modules: dataman: Add a ram_flash backend

This backend will keep all updated data in RAM and
persist the data between reboots using flash memory.

Using only flash memory would result in a slow backend that
would decrease the lifetime of the flash memory, using both
we can reduce the several cycles of erase & write into flash
and keep the performance of the backend almost as fast
as the RAM only backend.

Note: Do not use this backend on a sector from the same flash memory
bank as the memory bank that STM32 read instructions or it can block
the CPU from fetching instructions from flash during the erase and
write operations and cause your drone crash.
This commit is contained in:
José Roberto de Souza
2017-03-10 11:31:07 +01:00
committed by Lorenz Meier
parent 75e7cfcbe8
commit e2aae04c95
2 changed files with 345 additions and 13 deletions
+20
View File
@@ -173,6 +173,26 @@ dm_restart(
dm_reset_reason restart_type /* The last reset type */
);
#if defined(FLASH_BASED_DATAMAN)
typedef struct dm_sector_descriptor_t {
uint8_t page;
uint32_t size;
uint32_t address;
} dm_sector_descriptor_t;
/**
* Set the flash sector description were data should persist data
*
* Important: do not use a Flash sector from the same bank that STM32 read
* instructions or the CPU will held for sometime during Flash erase and write
* and this could cause your drone to fall.
*/
__EXPORT int
dm_flash_sector_description_set(
const dm_sector_descriptor_t *description
);
#endif
#ifdef __cplusplus
}
#endif