feat: Flash-HAL-Interface und Settings-Store mit A/B-Slots

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
This commit is contained in:
Michael Sauer
2026-09-11 13:24:52 +02:00
parent e0bde7bee3
commit 91721ac47d
8 changed files with 360 additions and 0 deletions
+19
View File
@@ -0,0 +1,19 @@
#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