SD driver: follow the upstream report, and drop our copy when it's fixed #39

Open
opened 2026-10-05 21:16:17 +00:00 by twisla · 0 comments
Owner

What

Follow the report made to Arduino-ESP32 about its SD driver, and drop our copy of the library when the fix is in a release we use.

Upstream: https://github.com/espressif/arduino-esp32/issues/12970 (filed 2026-10-05)

Why

Fixing #21 meant taking a copy of the framework's SD library into the project (lib/SD, ADR 0007), with two bytes added to sd_diskio.cpp and a record of why a write fails. A copy of a framework library has to be kept in step with the framework by hand; the clean end is for the fix to land upstream.

Done so far (in v0.6.1)

  • lib/SD: Arduino-ESP32 3.3.12's SD library as it comes (3ee7ae1), then our change on top (3f2650c), so the difference is one readable commit.
  • sd card: the card's type, size and identity register, read by our driver and decoded by a host-tested parser (370f067). Added because the upstream report needed the card's make and nothing else here could read it: a Samsung 8 GB SDHC from June 2013 (manufacturer 0x1B, OEM "SM", product "00000").
  • The upstream report, with the measurements, the two-line fix, and a second defect read in the code but not observed (the data response token compared with 0x0A and 0x0C, values it can't take).

To do

  1. Answer the maintainers. They may ask for a standalone sketch that reproduces it: writing 1.7 MB files in 1 KB pieces with the stock driver and counting short writes. It has to be tested on the device with lib/SD taken out of the build.
  2. If they want a pull request, send the two lines.
  3. Each time the platform is updated (pioarduino in platformio.ini): compare lib/SD with the new libraries/SD/src, and carry the roro: changes over.
  4. When a release has the fix: delete lib/SD, keep or drop the fault record depending on whether upstream logs failures by then, and update ADR 0007.
  5. If info ever shows write faults again, read the step from put's log first: a DataToken fault would be the second defect, live.

Related

#21, docs/adr/0007-own-copy-of-the-sd-driver.md, lib/SD/src/sd_diskio.cpp, lib/SD/src/sd_fault.h, lib/storage_model/src/sd_card_id.h.

## What Follow the report made to Arduino-ESP32 about its SD driver, and drop our copy of the library when the fix is in a release we use. **Upstream:** https://github.com/espressif/arduino-esp32/issues/12970 (filed 2026-10-05) ## Why Fixing #21 meant taking a copy of the framework's `SD` library into the project (`lib/SD`, ADR 0007), with two bytes added to `sd_diskio.cpp` and a record of why a write fails. A copy of a framework library has to be kept in step with the framework by hand; the clean end is for the fix to land upstream. ## Done so far (in v0.6.1) - `lib/SD`: Arduino-ESP32 3.3.12's SD library as it comes (`3ee7ae1`), then our change on top (`3f2650c`), so the difference is one readable commit. - `sd card`: the card's type, size and identity register, read by our driver and decoded by a host-tested parser (`370f067`). Added because the upstream report needed the card's make and nothing else here could read it: a Samsung 8 GB SDHC from June 2013 (manufacturer 0x1B, OEM "SM", product "00000"). - The upstream report, with the measurements, the two-line fix, and a second defect read in the code but not observed (the data response token compared with 0x0A and 0x0C, values it can't take). ## To do 1. Answer the maintainers. They may ask for a standalone sketch that reproduces it: writing 1.7 MB files in 1 KB pieces with the stock driver and counting short writes. It has to be tested on the device with `lib/SD` taken out of the build. 2. If they want a pull request, send the two lines. 3. **Each time the platform is updated** (pioarduino in `platformio.ini`): compare `lib/SD` with the new `libraries/SD/src`, and carry the `roro:` changes over. 4. When a release has the fix: delete `lib/SD`, keep or drop the fault record depending on whether upstream logs failures by then, and update ADR 0007. 5. If `info` ever shows write faults again, read the step from `put`'s log first: a `DataToken` fault would be the second defect, live. ## Related #21, `docs/adr/0007-own-copy-of-the-sd-driver.md`, `lib/SD/src/sd_diskio.cpp`, `lib/SD/src/sd_fault.h`, `lib/storage_model/src/sd_card_id.h`.
twisla added this to the S1 System basics milestone 2026-10-05 21:16:17 +00:00
twisla added the
kind
chore
area/storagearea/build
status
blocked
priority
low
labels 2026-10-05 21:16:17 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: twisla/roro9stack#39