Commit c0761da
authored
Fix LittleFS formatting freeze bug
LittleFileSystem::reformat() on the SD Card block device internally runs LittleFileSystem::format() and then LittleFileSystem::mount() in a sequence. After LittleFileSystem::format()'s main job is performed using the LittleFS file system driver one level below it, it runs deinit() on the block device. That leads, after a series of calls, to a call to the Renesas FSP function R_SDHI_Close(), which sets the initialized field of the ctrl structure to false. LittleFileSystem::mount() runs next, and begins by running init() on the block device, but because it's still in a state where card_inserted and initialized are true, full initialization doesn't occur - only parts of it. This leaves the initialized field of the ctrl structure being false, which leads to the FSP-internal function r_sdhi_common_error_check() returning an error when it's called by the FSP function R_SDHI_Read() from SDCardBlockDevice::read(), which is, in turn, called from LittleFileSystem::mount(). This is caught by the LittleFS file system driver function lfs_bd_read() at the layer directly over the SDCardBlockDevice::read() function, which, in turn, sends the board into an infinite loop and the format freezes.1 parent 1c9b086 commit c0761da
1 file changed
+2
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
346 | 346 | | |
347 | 347 | | |
348 | 348 | | |
| 349 | + | |
| 350 | + | |
349 | 351 | | |
350 | 352 | | |
351 | 353 | | |
| |||
0 commit comments