Skip to content

Commit f2fc68f

Browse files
GDB + mklittlefs can expand on-device filesystems (earlephilhower#2666)
1 parent 34e02aa commit f2fc68f

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

docs/fs.rst

+19
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,25 @@ directory into a new LittleFS flash file system.
135135
- Double check the Serial Monitor is closed. Uploads will fail if the Serial Monitor has control of the serial port.
136136
- Enter ``[Ctrl]`` + ``[Shift]`` + ``[P]`` to bring up the command palette, then select/type ``Upload LittleFS to Pico/ESP8266``
137137

138+
Downloading Files from a LittleFS System
139+
----------------------------------------
140+
141+
Using ``gdb`` it is possible to dump the flash data making up the filesystem and then extract
142+
it using the ``mklittlefs`` tool. A working ``OpenOCD`` setup, DebugProbe, and ``gdb`` are required.
143+
To download the raw filesystem, from within ``GDB`` run:
144+
145+
.. code::
146+
^C (break)
147+
(gdb) dump binary memory littlefs.bin &_FS_start &_FS_end
148+
It may take a few seconds as ``GDB`` reads out the flash to the file. Once the raw file is downloaded it can be extracted using the ``mklittlefs`` tool from the BASH/Powershell/command line
149+
150+
.. code::
151+
$ <path-to-mklittlefs>/mklittlefs -u output-dir littlefs.bin
152+
Directory <output-dir> does not exists. Try to create it.
153+
gmon.out > <output-dir>/gmon.out size: 24518 Bytes
154+
gmon.bak > <output-dir>/gmon.bak size: 1 Bytes
155+
The defaults built into ``mklittlefs`` should be appropriate for normal LittleFS filesystems built on the device or using the upload tool.
156+
138157
SD Library Information
139158
----------------------
140159
The included ``SD`` library is the Arduino standard one. Please refer to

0 commit comments

Comments
 (0)