@@ -334,45 +334,42 @@ int32_t hal_lfs_mount_partition(int32_t index, bool forceFormat)
334
334
335
335
// mount the file system again
336
336
operationResult = lfs_mount (& lfs [index ], & lfsConfig [index ]);
337
-
338
- // create the root directory
339
- lfs_mkdir (& lfs [index ], "/" );
340
337
}
341
338
342
339
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
343
340
// code block to assist testing littlefs
344
341
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
345
- int32_t lfsIndex = 0 ;
346
- char writeBuf [] = {
347
- "Hello! if you get this message, congratulations, that's because littlefs is working on your device!!" };
348
- char readBuf [sizeof (writeBuf )];
349
-
350
- lfs_file_t file ;
351
- lfs_file_open (& lfs [lfsIndex ], & file , "file1.txt" , LFS_O_RDWR | LFS_O_CREAT );
352
-
353
- if (lfs_file_write (& lfs [lfsIndex ], & file , writeBuf , sizeof (writeBuf )) != sizeof (writeBuf ))
354
- {
355
- // something went wrong
356
- return -1 ;
357
- }
358
-
359
- lfs_file_close (& lfs [lfsIndex ], & file );
360
-
361
- // reopen the file and read it
362
- lfs_file_open (& lfs [lfsIndex ], & file , "file1.txt" , LFS_O_RDONLY );
363
- if (lfs_file_read (& lfs [lfsIndex ], & file , readBuf , sizeof (readBuf )) != sizeof (writeBuf ))
364
- {
365
- // something went wrong
366
- return -1 ;
367
- }
368
-
369
- lfs_file_close (& lfs [lfsIndex ], & file );
370
-
371
- if (memcmp (writeBuf , readBuf , sizeof (writeBuf )) != 0 )
372
- {
373
- // content doesn't match
374
- return -1 ;
375
- }
342
+ // int32_t lfsIndex = 0;
343
+ // char writeBuf[] = {
344
+ // "Hello! if you get this message, congratulations, that's because littlefs is working on your device!!"};
345
+ // char readBuf[sizeof(writeBuf)];
346
+
347
+ // lfs_file_t file;
348
+ // lfs_file_open(&lfs[lfsIndex], &file, "file1.txt", LFS_O_RDWR | LFS_O_CREAT);
349
+
350
+ // if (lfs_file_write(&lfs[lfsIndex], &file, writeBuf, sizeof(writeBuf)) != sizeof(writeBuf))
351
+ // {
352
+ // // something went wrong
353
+ // return -1;
354
+ // }
355
+
356
+ // lfs_file_close(&lfs[lfsIndex], &file);
357
+
358
+ //// reopen the file and read it
359
+ // lfs_file_open(&lfs[lfsIndex], &file, "file1.txt", LFS_O_RDONLY);
360
+ // if (lfs_file_read(&lfs[lfsIndex], &file, readBuf, sizeof(readBuf)) != sizeof(writeBuf))
361
+ // {
362
+ // // something went wrong
363
+ // return -1;
364
+ // }
365
+
366
+ // lfs_file_close(&lfs[lfsIndex], &file);
367
+
368
+ // if (memcmp(writeBuf, readBuf, sizeof(writeBuf)) != 0)
369
+ // {
370
+ // // content doesn't match
371
+ // return -1;
372
+ // }
376
373
377
374
return operationResult ;
378
375
}
0 commit comments