feat(firmware): add SD/FAT spike (Spike 3)

Standalone bench program (src/bin/sd_fat.rs, `just flash-sd`) that mounts
FAT over the EPD's shared SPI2 bus and proves the persistence module's
atomic save: write .tmp, fsync, rename, read back and compare.

Runs SD-only: the EPD's SpiBusDriver holds an exclusive bus lock for its
lifetime, so an arbitrated SD device can't be live alongside it yet. Keeps
CRC required and maps a card that rejects CMD59 to a clear "use a genuine
card" message rather than running the user's notes over an unchecked bus.

sdkconfig gains CONFIG_FATFS_LFN_HEAP (the atomic-save .tmp name isn't valid
8.3) and, temporarily, CONFIG_LOG_MAXIMUM_LEVEL_DEBUG to read the drivers'
per-command R1 bytes during bring-up.
This commit is contained in:
Julien Calixte
2026-07-05 18:16:42 +02:00
parent f77f6697d1
commit 9fc21568e7
4 changed files with 321 additions and 0 deletions

View File

@@ -13,6 +13,17 @@ CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=4096
# `std::thread::Builder::new().stack_size(XXX)` for spawning
CONFIG_PTHREAD_TASK_STACK_SIZE_DEFAULT=4096
# Raise the compile-time log ceiling so the sdmmc/sdspi drivers' per-command
# DEBUG logs (the raw R1 response bytes) are built in. Runtime level stays INFO
# by default; the SD spike bumps just the sdmmc/sdspi tags to DEBUG so we can see
# exactly what each init command returns. (Diagnostic for Spike 3 init failures.)
CONFIG_LOG_MAXIMUM_LEVEL_DEBUG=y
# FatFS long filenames (Spike 3 — SD). Default is 8.3-only, which rejects the
# persistence module's atomic-save temp name (`notes.md.tmp` has two dots).
# LFN on the heap keeps the working buffer off the (small) task stack.
CONFIG_FATFS_LFN_HEAP=y
# TLS trust store (Spike 6 — Wi-Fi + TLS, the gate for Spike 7 gitoxide push).
# The certificate bundle backs esp_crt_bundle_attach so an HTTPS GET to
# api.github.com validates against real roots. FULL rather than the common