Files
ninlight-w600/test/fake_flash.h
Michael Sauer 91721ac47d 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
2026-09-11 13:24:52 +02:00

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