mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-18 18:33:36 +08:00
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:
committed by
Lorenz Meier
parent
75e7cfcbe8
commit
e2aae04c95
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user