@@ -60,8 +60,12 @@ def _parse_ld_sizes(ldscript_path):
60
60
61
61
appsize_re = re .compile (
62
62
r"irom0_0_seg\s*:.+len\s*=\s*(0x[\da-f]+)" , flags = re .I )
63
- spiffs_re = re .compile (
64
- r"PROVIDE\s*\(\s*_SPIFFS_(\w+)\s*=\s*(0x[\da-f]+)\s*\)" , flags = re .I )
63
+ filesystem_re = re .compile (
64
+ r"PROVIDE\s*\(\s*_%s_(\w+)\s*=\s*(0x[\da-f]+)\s*\)" % "FS"
65
+ if "arduino" in env .subst ("$PIOFRAMEWORK" )
66
+ else "SPIFFS" ,
67
+ flags = re .I ,
68
+ )
65
69
with open (ldscript_path ) as fp :
66
70
for line in fp .readlines ():
67
71
line = line .strip ()
@@ -71,9 +75,9 @@ def _parse_ld_sizes(ldscript_path):
71
75
if match :
72
76
result ['app_size' ] = _parse_size (match .group (1 ))
73
77
continue
74
- match = spiffs_re .search (line )
78
+ match = filesystem_re .search (line )
75
79
if match :
76
- result ['spiffs_ %s' % match .group (1 )] = _parse_size (
80
+ result ['fs_ %s' % match .group (1 )] = _parse_size (
77
81
match .group (2 ))
78
82
return result
79
83
@@ -85,19 +89,19 @@ def _get_flash_size(env):
85
89
return "%dM" % (ldsizes ['flash_size' ] / 1048576 )
86
90
87
91
88
- def fetch_spiffs_size (env ):
92
+ def fetch_fs_size (env ):
89
93
ldsizes = _parse_ld_sizes (env .GetActualLDScript ())
90
94
for key in ldsizes :
91
- if key .startswith ("spiffs_ " ):
95
+ if key .startswith ("fs_ " ):
92
96
env [key .upper ()] = ldsizes [key ]
93
97
94
98
assert all ([
95
99
k in env
96
- for k in ["SPIFFS_START " , "SPIFFS_END " , "SPIFFS_PAGE " , "SPIFFS_BLOCK " ]
100
+ for k in ["FS_START " , "FS_END " , "FS_PAGE " , "FS_BLOCK " ]
97
101
])
98
102
99
103
# esptool flash starts from 0
100
- for k in ("SPIFFS_START " , "SPIFFS_END " ):
104
+ for k in ("FS_START " , "FS_END " ):
101
105
_value = 0
102
106
if env [k ] < 0x40300000 :
103
107
_value = env [k ] & 0xFFFFF
@@ -111,8 +115,8 @@ def fetch_spiffs_size(env):
111
115
env [k ] = _value
112
116
113
117
114
- def __fetch_spiffs_size (target , source , env ):
115
- fetch_spiffs_size (env )
118
+ def __fetch_fs_size (target , source , env ):
119
+ fetch_fs_size (env )
116
120
return (target , source )
117
121
118
122
@@ -159,7 +163,7 @@ def get_esptoolpy_reset_flags(resetmethod):
159
163
# Misc
160
164
#
161
165
162
- MKSPIFFSTOOL = "mkspiffs " ,
166
+ MKFSTOOL = "mklittlefs " ,
163
167
164
168
SIZEPROGREGEXP = r"^(?:\.irom0\.text|\.text|\.text1|\.data|\.rodata|)\s+([0-9]+).*" ,
165
169
SIZEDATAREGEXP = r"^(?:\.data|\.rodata|\.bss)\s+([0-9]+).*" ,
@@ -194,14 +198,14 @@ def get_esptoolpy_reset_flags(resetmethod):
194
198
BUILDERS = dict (
195
199
DataToBin = Builder (
196
200
action = env .VerboseAction (" " .join ([
197
- '"$MKSPIFFSTOOL "' ,
201
+ '"$MKFSTOOL "' ,
198
202
"-c" , "$SOURCES" ,
199
- "-p" , "$SPIFFS_PAGE " ,
200
- "-b" , "$SPIFFS_BLOCK " ,
201
- "-s" , "${SPIFFS_END - SPIFFS_START }" ,
203
+ "-p" , "$FS_PAGE " ,
204
+ "-b" , "$FS_BLOCK " ,
205
+ "-s" , "${FS_END - FS_START }" ,
202
206
"$TARGET"
203
- ]), "Building SPIFFS image from '$SOURCES' directory to $TARGET" ),
204
- emitter = __fetch_spiffs_size ,
207
+ ]), "Building file system image from '$SOURCES' directory to $TARGET" ),
208
+ emitter = __fetch_fs_size ,
205
209
source_factory = env .Dir ,
206
210
suffix = ".bin"
207
211
)
@@ -210,21 +214,21 @@ def get_esptoolpy_reset_flags(resetmethod):
210
214
211
215
212
216
#
213
- # Target: Build executable and linkable firmware or SPIFFS image
217
+ # Target: Build executable and linkable firmware or file system image
214
218
#
215
219
216
220
target_elf = env .BuildProgram ()
217
221
if "nobuild" in COMMAND_LINE_TARGETS :
218
222
target_elf = join ("$BUILD_DIR" , "${PROGNAME}.elf" )
219
223
if set (["uploadfs" , "uploadfsota" ]) & set (COMMAND_LINE_TARGETS ):
220
- fetch_spiffs_size (env )
221
- target_firm = join ("$BUILD_DIR" , "%s.bin" % env .get ("SPIFFSNAME " , "spiffs " ))
224
+ fetch_fs_size (env )
225
+ target_firm = join ("$BUILD_DIR" , "%s.bin" % env .get ("FSIMAGENAME " , "fs " ))
222
226
else :
223
227
target_firm = join ("$BUILD_DIR" , "${PROGNAME}.bin" )
224
228
else :
225
229
if set (["buildfs" , "uploadfs" , "uploadfsota" ]) & set (COMMAND_LINE_TARGETS ):
226
230
target_firm = env .DataToBin (
227
- join ("$BUILD_DIR" , env .get ("SPIFFSNAME " , "spiffs " )), "$PROJECTDATA_DIR" )
231
+ join ("$BUILD_DIR" , env .get ("FSIMAGENAME " , "fs " )), "$PROJECTDATA_DIR" )
228
232
AlwaysBuild (target_firm )
229
233
AlwaysBuild (env .Alias ("buildfs" , target_firm ))
230
234
else :
@@ -255,7 +259,7 @@ def get_esptoolpy_reset_flags(resetmethod):
255
259
AlwaysBuild (target_size )
256
260
257
261
#
258
- # Target: Upload firmware or SPIFFS image
262
+ # Target: Upload firmware or filesystem image
259
263
#
260
264
261
265
upload_protocol = env .subst ("$UPLOAD_PROTOCOL" )
@@ -313,7 +317,7 @@ def get_esptoolpy_reset_flags(resetmethod):
313
317
"--port" , '"$UPLOAD_PORT"' ,
314
318
"--baud" , "$UPLOAD_SPEED" ,
315
319
"write_flash" ,
316
- "$SPIFFS_START "
320
+ "$FS_START "
317
321
],
318
322
UPLOADCMD = '"$PYTHONEXE" "$UPLOADER" $UPLOADERFLAGS $SOURCE' ,
319
323
)
0 commit comments