fix(spiflash): USB storage cannot persist files copied (#7457)

This commit is contained in:
richardclli
2026-07-03 13:05:45 +10:00
committed by GitHub
parent 7b019e969e
commit a6542f9b0e
@@ -91,6 +91,13 @@ static DSTATUS spi_flash_initialize(BYTE lun)
} }
#if defined(USE_FLASH_FTL) #if defined(USE_FLASH_FTL)
if (frftlInitDone) {
// Do flush when trying to reinit spi flash,
// because the frftl only need to be initialized once
if (!ftlSync(&_frftl)) {
return STA_NOINIT;
}
} else {
int flashSize = flashSpiGetSize(); int flashSize = flashSpiGetSize();
int flashSizeMB = flashSize / 1024 / 1024; int flashSizeMB = flashSize / 1024 / 1024;
@@ -98,6 +105,7 @@ static DSTATUS spi_flash_initialize(BYTE lun)
return STA_NOINIT; return STA_NOINIT;
} }
frftlInitDone = true; frftlInitDone = true;
}
#endif #endif
return 0; return 0;