ESP32_Explorer icon indicating copy to clipboard operation
ESP32_Explorer copied to clipboard

fatfs

Open snahmad opened this issue 7 years ago • 3 comments

These make are not working for

make: *** No rule to make target 'makefatfs'. Stop

make makefatfs make flashfatfs

Also

Flash mount is failing.

D (2699) wl_flash: initSections - result=00000000 D (2699) wl_flash: recoverPos - this->state.pos=0x00000000, result=00000000 D (2709) vfs_fat_spiflash: using pdrv=0 W (2709) vfs_fat_spiflash: f_mount failed (13) I (2719) vfs_fat_spiflash: Formatting FATFS partition, allocation unit size=52 4288 E (2719) vfs_fat_spiflash: f_mkfs failed (14) ESP_ERROR_CHECK failed: esp_err_t 0xffffffff at 0x4011454a file: "C:/Work/LibDev/esp32/esp-idf/components/cpp_utils/FATFS_VFS.cpp" line 4 9 func: void FATFS_VFS::mount() expression: esp_vfs_fat_spiflash_mount(m_mountPath.c_str(), m_partitionName.c_ str(), &mountConfig, &m_wl_handle)

Backtrace: 0x4008e85f:0x3ffd6c10 0x4008ecd5:0x3ffd6c30 0x4011454a:0x3ffd6c50 0 x400d4fbb:0x3ffd6c80 0x400d45b9:0x3ffd6ce0 0x4010de80:0x3ffd6d00

snahmad avatar Jun 01 '18 09:06 snahmad

This example works https://github.com/espressif/esp-idf/tree/master/examples/storage/wear_levelling

but not ESP32 explorer example.

Any idea?

snahmad avatar Jun 01 '18 14:06 snahmad

Fix by specifying allocation_unit_size

void FATFS_VFS::mount() { esp_vfs_fat_mount_config_t mountConfig; mountConfig.max_files = m_maxFiles; mountConfig.format_if_mount_failed = true; mountConfig.allocation_unit_size = 4096;

ESP_LOGD(LOG_TAG, "FATFS_VFS::mount(%s,%s)", m_mountPath.c_str(), m_partitionName.c_str());
ESP_ERROR_CHECK(esp_vfs_fat_spiflash_mount(m_mountPath.c_str(), m_partitionName.c_str(), &mountConfig, &m_wl_handle));

} // mount

snahmad avatar Jun 01 '18 15:06 snahmad

Very NICE catch. It appears that the allocation_unit_size field was added 5 months (ago - Jan 2018) and that the library/code base in this project pre-dates that addition.

https://github.com/espressif/esp-idf/blame/363c096f2b4d518f5d423718973f76aa5e009fbc/components/fatfs/src/esp_vfs_fat.h#L110

This is a maintenance issue that we will fix by exposing the ability (or default) to set that value.

nkolban avatar Jun 01 '18 16:06 nkolban