Skip to content

Commit 3197c57

Browse files
authored
Merge pull request #3262 from tannewt/fix_fs_corruption
Fix writing sector 0 as the first write.
2 parents 0e09c26 + 8488b31 commit 3197c57

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

ports/esp32s2/supervisor/internal_flash.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@
4343

4444
STATIC const esp_partition_t * _partition;
4545

46+
// TODO: Split the caching out of supervisor/shared/external_flash so we can use it.
47+
#define SECTOR_SIZE 4096
48+
STATIC uint8_t _cache[SECTOR_SIZE];
49+
STATIC uint32_t _cache_lba = 0xffffffff;
50+
4651
void supervisor_flash_init(void) {
4752
_partition = esp_partition_find_first(ESP_PARTITION_TYPE_DATA,
4853
ESP_PARTITION_SUBTYPE_DATA_FAT,
@@ -61,11 +66,6 @@ void port_internal_flash_flush(void) {
6166

6267
}
6368

64-
// TODO: Split the caching out of supervisor/shared/external_flash so we can use it.
65-
#define SECTOR_SIZE 4096
66-
STATIC uint8_t _cache[SECTOR_SIZE];
67-
STATIC uint32_t _cache_lba;
68-
6969
mp_uint_t supervisor_flash_read_blocks(uint8_t *dest, uint32_t block, uint32_t num_blocks) {
7070
esp_partition_read(_partition,
7171
block * FILESYSTEM_BLOCK_SIZE,

0 commit comments

Comments
 (0)