summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Shawcroft <scott@adafruit.com>2020-08-12 08:14:55 -0700
committerGitHub <noreply@github.com>2020-08-12 08:14:55 -0700
commit3197c579e0acddf7aa962fe805cefd75b584d267 (patch)
tree8c2634c60a57cb1c2177461e98109522d3cec329
parent0e09c26b54643282942405f5a8cabc5e08d145df (diff)
parent8488b31aa0671427f1f2b36b9c41d6a8b7b48ae7 (diff)
Merge pull request #3262 from tannewt/fix_fs_corruption
Fix writing sector 0 as the first write.
-rw-r--r--ports/esp32s2/supervisor/internal_flash.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/ports/esp32s2/supervisor/internal_flash.c b/ports/esp32s2/supervisor/internal_flash.c
index 26774efac..4b216a095 100644
--- a/ports/esp32s2/supervisor/internal_flash.c
+++ b/ports/esp32s2/supervisor/internal_flash.c
@@ -43,6 +43,11 @@
STATIC const esp_partition_t * _partition;
+// TODO: Split the caching out of supervisor/shared/external_flash so we can use it.
+#define SECTOR_SIZE 4096
+STATIC uint8_t _cache[SECTOR_SIZE];
+STATIC uint32_t _cache_lba = 0xffffffff;
+
void supervisor_flash_init(void) {
_partition = esp_partition_find_first(ESP_PARTITION_TYPE_DATA,
ESP_PARTITION_SUBTYPE_DATA_FAT,
@@ -61,11 +66,6 @@ void port_internal_flash_flush(void) {
}
-// TODO: Split the caching out of supervisor/shared/external_flash so we can use it.
-#define SECTOR_SIZE 4096
-STATIC uint8_t _cache[SECTOR_SIZE];
-STATIC uint32_t _cache_lba;
-
mp_uint_t supervisor_flash_read_blocks(uint8_t *dest, uint32_t block, uint32_t num_blocks) {
esp_partition_read(_partition,
block * FILESYSTEM_BLOCK_SIZE,