Skip to content

Commit b521c45

Browse files
filesystem example tested and working
1 parent d376e2d commit b521c45

File tree

3 files changed

+796
-7
lines changed

3 files changed

+796
-7
lines changed

libraries/QSPI/examples/QSPIFilesystem.ino

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
2-
QSPI Filesystem Example
2+
QSPI Filesystem Example with LittleFS
33
4-
This example demonstrates how to use the QSPI library with LittleFS
4+
This example demonstrates how to use the QSPI library with Zephyr's LittleFS
55
filesystem to store and retrieve files on external QSPI flash memory.
66
77
Features:
@@ -10,15 +10,34 @@
1010
- List directory contents
1111
- Check filesystem statistics
1212
13+
IMPORTANT CONFIGURATION REQUIRED:
14+
===================================
15+
This example requires LittleFS support to be enabled in your Zephyr build.
16+
17+
1. Add to your board's prj.conf file:
18+
CONFIG_FILE_SYSTEM=y
19+
CONFIG_FILE_SYSTEM_LITTLEFS=y
20+
CONFIG_FILE_SYSTEM_MAX_FILE_NAME=128
21+
22+
2. If using a custom board, ensure your device tree has flash partitions defined.
23+
24+
3. Alternative: If you don't want to configure LittleFS, use the QSPISimpleFS.ino
25+
example instead, which implements a simple filesystem without dependencies.
26+
1327
Note:
1428
- QSPI flash must be configured in the board's device tree overlay
15-
- Zephyr CONFIG_FILE_SYSTEM=y and CONFIG_FILE_SYSTEM_LITTLEFS=y must be enabled
16-
- Add to prj.conf:
17-
CONFIG_FILE_SYSTEM=y
18-
CONFIG_FILE_SYSTEM_LITTLEFS=y
19-
CONFIG_FILE_SYSTEM_MAX_FILE_NAME=128
29+
- Build will fail if LittleFS is not enabled (missing lfs.h header)
2030
*/
2131

32+
// Check if filesystem support is available
33+
#ifndef CONFIG_FILE_SYSTEM
34+
#error "This example requires CONFIG_FILE_SYSTEM=y in prj.conf"
35+
#endif
36+
37+
#ifndef CONFIG_FILE_SYSTEM_LITTLEFS
38+
#error "This example requires CONFIG_FILE_SYSTEM_LITTLEFS=y in prj.conf. Use QSPISimpleFS.ino if you don't want to enable LittleFS."
39+
#endif
40+
2241
#include <QSPI.h>
2342
#include <zephyr/fs/fs.h>
2443
#include <zephyr/fs/littlefs.h>

0 commit comments

Comments
 (0)