@@ -260,11 +260,6 @@ void hal_lfs_config()
260260 lfsConfig [i ].erase = hal_lfs_getEraseHandler (i );
261261 lfsConfig [i ].sync = hal_lfs_getSyncHandler (i );
262262
263- // #ifdef LFS_THREADSAFE
264- // lfsConfig[i].lock = &hal_lfs_lock;
265- // lfsConfig[i].unlock = &hal_lfs_unlock;
266- // #endif
267-
268263 // setup littlefs configurations
269264 lfsConfig [i ].read_size = hal_lfs_getReadSize (i );
270265 lfsConfig [i ].prog_size = hal_lfs_getProgSize (i );
@@ -315,27 +310,22 @@ void hal_lfs_mount()
315310
316311int32_t hal_lfs_mount_partition (int32_t index , bool forceFormat )
317312{
313+ // not used
314+ (void )forceFormat ;
315+
318316 int32_t operationResult = 0 ;
319317
320- // mount the file system
321- operationResult = lfs_mount (& lfs [index ], & lfsConfig [index ]);
318+ operationResult = lfs_format (& lfs [index ], & lfsConfig [index ]);
322319
323- if (operationResult != 0 )
320+ if (operationResult != LFS_ERR_OK )
324321 {
325- // looks like littlefs is not formated (occuring at 1st boot)
326-
327- if (forceFormat )
328- {
329- // wipe out the chip
330- hal_lfs_erase_chip (index );
331- }
332-
333- lfs_format (& lfs [index ], & lfsConfig [index ]);
334-
335- // mount the file system again
336- operationResult = lfs_mount (& lfs [index ], & lfsConfig [index ]);
322+ // failed to format
323+ return operationResult ;
337324 }
338325
326+ // mount the file system
327+ operationResult = lfs_mount (& lfs [index ], & lfsConfig [index ]);
328+
339329 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
340330 // code block to assist testing littlefs
341331 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
0 commit comments