Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
esp32: make use of wear levelling from IDF #4999
Thanks for the contribution.
But I guess this will no longer work if #5027 is merged. Because that patch removes calls to the
Do you know how to make wear levelling work with the IDF partition interface?
Actually, looking at the high level API, https://docs.espressif.com/projects/esp-idf/en/latest/api-reference/storage/wear-levelling.html#high-level-api-reference, it seems this is very much supported. Should be able to implement wear levelling as a Partition object that uses the high level API provided here as a middleware.
WL doesn't explicitly mention anything about Flash Encryption. Its my assumption that it would be handled transparently if the partition table for a fatfs partition was tagged with
It would be my preference that wear levelling just works and just happens whenever a read/write partition is mounted.
Yes, a partition must be "mounted as wearlevel partition".
The problem here is that we DO NOT use the highlevel API / espressif's vfs but instead build on our own fatfs and vfs implementation. This means no, we can not use that. The partitions must be mounted explicitely through the mid level API (wl*). @dpgeorge's code uses
Wear levelling is completely transparent, as is encryption. You can mount an unencrypted or an encrypted partition as wearlevelling partition:
spi flash <- partition (encrypted or unencrypted) <- wear levelling <- <mapped blocks / partition> <- filesystem
This is NOT possible with wear levelling currently as esptool writes directly to flash. You must create a wear levelling partition image and flash that. There's a tool for this: https://github.com/TobleMiner/mk_esp32fat
The right way would be dropping our own vfs and fatfs and instead build on espressif's vfs and fatfs which both natively support encryption and wear levelling. This would even make it possible to easily use spiffs or anything else that is getting added to esp-idf in later versions.