I recently switched from FATFS to LittleFS (LFS) on an STM32 . LittleFS is a fail-safe file system designed for microcontrollers:
The only problem I had with LFS is that I could not edit the file system in a Windows environment because it is not recognized by Windows. There is a FUSE driver for Linux, but I’m developing under Windows, so I needed an interface from where I could format the SD card to LFS, browse, edit, add and remove files. So I decided to write a file explorer for LFS in Windows.
- Automatically detects, mount and unmount LFS formatted disks.
- Mount binary files (See Mounting binary files section).
- Format any accessible disk to LFS.
- Delete a volume (Deletes the table of contents).
- Automatically detects the operating system disk and prevents formatting the operating system disk (Requires elevated rights. See Disk List description).
- Define custom LFS configuration parameters when mounting or formatting a disk.
- Browse folders.
- Drag and drop, single or multiple, files and folders from Windows explorer to LFSE.
- Create new folders.
- Rename and delete files and folders.
- View and edit files with the default associated Windows program.
- View and edit files with a specific Windows program.
- Grid view or detail view (file size).
Following is a list of features that I still want to implement:
- Migrate from a previous version of LFS (LFS_MIGRATE).
- Drag and drop, single or multiple, files and folders from LFSE to Windows explorer.
- Folder and file search.
- Cut, copy and paste folders and files inside LFSE.
The toolbar has 4 buttons:
- Refresh – This will refresh the disk list. If an LFS formatted disk is selected, it will refresh the contents of the current directory of the LFS formatted disk.
- New folder – It will create a new folder in the current directory of the LFS formatted disk. This button is enabled when an LFS formatted disk is selected.
- Delete – It will delete the selected item from the LFS formatted disk. This cannot be undone. This button is enabled when an item is selected from an LFS formatted disk. You cannot delete the current “.” or parent “..” directories.
- Detail view/Icon view – Switch between detail and icon view for the disk contents. This button is enabled when an LFS formatted disk is selected.
2. Disk list
The disk list will contain all the detected logical disks.
This icon indicates that the disk is accessible and LFS formatted. Click on this icon to display the disk contents. Right click on this icon to display its popup menu.
This icon indicates that the disk is either not accessible or not LFS formatted. Right click on this icon to display its popup menu.
This icon indicates that the disk is the operating system disk and cannot be formatted to LFS. LFSE needs elevated rights (administrator) to detect the operating system disk.
The Format dialog
The format dialog makes provision for all the LFS configuration parameters. It will display the detected disk size and automatically calculate the block count based on the disk size and block size. You can also save the current configuration parameters as the default, which will be loaded the next you you format a disk.
3. Disk contents
The contents of the selected LFS formatted disk will be displayed here.
Double click on a folder to view it’s contents. Double click on the current (“.”) or parent (“..”) folder to browse to the current or parent folder. Right click on this icon to display its popup menu.
Double click on a file to open it with the default Windows program. LFS is not recognised by Windows and therefore it cannot access the file directly from the LFS formatted drive. A temporary file, with the same name, is created in the application directory (temp) from where it is launched in Windows. LFSE will automatically update any changes to the temporary file to the original file. Right click on this icon to display its popup menu.
The shortcut keys apply to the contents area only:
- Ctrl+A = Select all
- Shift+Del = Delete selected
- Del = Delete selected
Mounting binary files
You will need a tool that is capable of mounting a binary file as a virtual logical drive. I’ve tested it with OSFMount:
- Download and install OSFMount.
- Go to “File”->”Mount new virtual disk…” and select your binary file containing the LFS data and click “Next”.
- Select “Mount entire image as virtual disk” and click “Next”.
- Uncheck the “Read-only drive” checkbox and set “Write mode” to “Direct” if you would like to write to the FS.
- Set the “Drive emulation” to “Logical Drive Emulation”, set the “Drive type” to “HDD” and set the “Drive letter” to “Auto”.
- Click “Mount”.
- Your binary should now be mounted as a logical drive.
- Open LFSE (you might need to run LFSE as administrator) and proceed as normal.
I will add the option to load binary files directly from LFSE at a later stage.
LFS supports the following debug information:
A log file is created, inside the application directory, for each debug item. The log files are overwritten whenever an LFS formatted disk is selected (mounted). In addition to the LFS debug information, LFSE creates its own log file, also inside the application directory, with warnings and errors. The LFSE log file is overwritten every time the application is started.
I initially wrote the LittleFS Explorer (LFSE) in Qt. But I am more familiar with Delphi VCL controls, and although the Qt version is fully functional, I decided to switch to Delphi for further development.
Now you might be asking: “Delphi?”
Well, Delphi Community Edition is free (so is QT and C# community edition and…) and once again I am more familiar with Delphi VCL controls. Especially in an application like this where I need to take control of visual controls and override the enforced Windows manifest. I’m proficient in C# but would not want to implement low level disk access in C# with all its managed memory restrictions.
For the Delphi version, I compiled the LittleFS C source into a C DLL using CodeBlocks and MinGW and called the DLL functions from the Delphi application. I’ve added a couple of my own functions to the DLL to assist in the implementation. I’ve also basically completed a File System Driver (FSD) for LittleFS in Windows. If time allows, I will upload the Qt version, FSD and sources.
Version info and testing
The revision history of LFSE and its DLL can be found on the GitHub repository.
The version of the LFS source used in the DLL can be seen in the about dialog.
LFSE and its DLL was compiled for 32-bit platforms only, but can be used on a 64-bit platform.
I’ve tested LFSE with an SD card on a 64-bit platform running Windows 10 Professional. I will appreciate your feedback on other platforms and Windows operating systems.
11 thoughts on “LittleFS Explorer (LFSE) for Windows”
Good work on this! I tried to use it on a project Im currently working on. When I connect my device which has a littlefs file system I see the drive appearing and dont see any content. Also I cant format it if I try to. Any help would be appreciated. Thanks
LikeLiked by 1 person
Hi Jon, Could you try and run LFSE with admin rights. If that does not solve your problem, please mail me all your log files (trace.log, error.log, lfse.log, warn.log) to email@example.com
Great job, please add ability to view/edit binary file with Little FS content.
LikeLiked by 1 person
Hi Nikolay. Thanks! You can view/edit any type of file on LFS with LFSE. If you have a binary file on your memory device, view the contents with LFSE and double click on the binary file. This should open the binary file with the default associated Windows program or open a dialog to select the program with which you would like to view/edit the file.
I can’t use the LFSE to see the contents of the bin file. I have an SPI flash, part of which is reserved for LFS, I can save this part on Windows as bin file, but not able to view/edit that image. I tried drag annd drop bin file in to LFSE, double click with LFSE but without sucess…
Hi Nikolay, Interesting request, but LFSE is a file system (FS) explorer in Windows. This means the FS must be on a logical disk detected by Windows. I propose you try and mount your BIN file as a virtual logical disk with something like Virtual Clone Drive. It might require that you convert the BIN file to some other format like ISO (WinISO). From there you can use LFSE.
Hi MC Potgieter, no luck with bin->iso (WinISO)… Seems like the easiest way -> make HW device, which will write BIN data on SD, then it can be possible to mounth it in LFSE
It should work if all the parameters are correct. Does your board have USB? Another alternative is to mount your device as a mass storage device over USB.
unfortunately my board does not have USB, grab bin data with LFS area from SPI flash – is the only one way for me
Have a look at the “Mounting binary files” section
This might be of interest: No-OS, Non-Blocking LittleFS