Implementiert: - Flash HAL (nl_flash_read/write/erase_sector) Interfaces - Flash Layout mit A/B-Settings Slots und weiteren Regions - Test-Fake für Flash mit Fehlerinjection (Stromausfall-Simulation) - Settings-Store mit CRC32 Recovery und Slot-Alternierung - Vollständige Test-Suite mit Corruption/Power-Loss-Tests
20 lines
559 B
C
20 lines
559 B
C
#ifndef FAKE_FLASH_H
|
|
#define FAKE_FLASH_H
|
|
|
|
#include <stdint.h>
|
|
|
|
#include "config/nl_flash.h"
|
|
|
|
#define FAKE_FLASH_SECTORS 8u
|
|
#define FAKE_FLASH_SIZE (FAKE_FLASH_SECTORS * NL_FLASH_SECTOR_SIZE)
|
|
|
|
extern uint8_t fake_flash_mem[FAKE_FLASH_SIZE];
|
|
extern unsigned fake_flash_erases[FAKE_FLASH_SECTORS];
|
|
extern unsigned fake_flash_dirty_writes; /* writes onto non-erased bytes (store bug) */
|
|
|
|
void fake_flash_reset(void);
|
|
/* Simulate power loss: after `bytes` more written bytes every write/erase fails. -1 = never. */
|
|
void fake_flash_fail_after(long bytes);
|
|
|
|
#endif
|