machine/esp32c3: implement BlockDevice for esp32c3 flash

- Add `machine_esp32c3_flash.go` to implement the `BlockDevice` interface for ESP32-C3.
- Map internal ESP ROM SPI flash and cache invalidation functions via CGo.
- Update `targets/esp32c3.ld` to expose `__flash_data_start` and `__flash_data_end` linker variables.
- Add `esp32c3` to build tags in `src/machine/flash.go`.
- Ensure atomic flash operations by disabling interrupts and invalidating cache to prevent stale reads.

Signed-off-by: deadprogram <ron@hybridgroup.com>
This commit is contained in:
deadprogram
2026-03-29 10:47:33 +02:00
parent f748dc6fd8
commit c2a04e1a45
3 changed files with 142 additions and 1 deletions
+4
View File
@@ -161,8 +161,12 @@ SECTIONS
*(.text.exception_vectors)
. = ALIGN (4);
*(.text .text.*)
_irom_end = .;
} >IROM
PROVIDE(__flash_data_start = ALIGN(_irom_end - 0x42000000 + 0x3C000000, 4096));
PROVIDE(__flash_data_end = 0x3C000000 + 4M);
/DISCARD/ :
{
*(.eh_frame) /* causes 'no memory region specified' error in lld */