Open paulreimer opened 6 years ago
I'm running into this issue, too. There seems to be a v2 (https://github.com/espressif/esp-idf/commit/a6d6c58ecadb9759a0bacf35cd7332ac641e598d#diff-56bcb985916387b5e0fcebb24c6b0c7c) of the wear leveling algorithm which is incompatible with the v1 wear leveling storage format. Although there is code to transition v1 wear leveling storage to v2 wear leveling storage it fails to update fat filesystems created via ESP32_mkfatfs to the new wear leveling format.
@paulreimer I've created a new tool with a much cleaner code base at https://github.com/TobleMiner/mk_esp32fat . It works great with the latest esp-idf master branch. Please feel free to check it out.
The only donwside is that my tool does currently not support 512 byte sector size.
@TobleMiner regretfully I am using 512 byte sector size at this time. If you add support for that (or maybe there's another way I wouldn't need it -- for long file names / verified writes), please let me know!
I'll note that this recent esp-idf commit: https://github.com/espressif/esp-idf/commit/cd38970ef9bb501d1f20c5ccf76b0b86416a499b
Appears to have partially addressed this issue. Reboots on a valid V1 filesystem (after V2 conversion) are no longer an issue. If the filesystem boots the first time, it seems to upgrade V1->V2 and works on subsequent V2 reboots. Great!
But, now it seems a little flaky when flashing the FATFS the first time. I've had a couple times where it didn't flash successfully, and no initial mount happened (so before the V1->V2 conversion, I think). Re-flashing it seems to work, but I can't explain why it wouldn't work 100%.
Noticed that
esp-idf
has made some updates to VFS, or at least this component now behaves differently with the latestesp-idf
master.The filesystem seems to work (all files read as expected) after a fresh
erase_flash
and then flashing the fatfs image to the partition offset. But it does not persist a reboot (e.g. it cannot be mounted after reset button is toggled, or after a software triggered reboot)There is some new logging here on the first boot here:
Upon reboot I get the following error when mounting:
This makes me think
esp-idf
has changed upstream, and this repo should update theesp-idf
components to be generating images in this new "V2" format? At least, in my case I do not need to support both formats -- preferably only the latest one.