@@ -155,7 +155,7 @@ def _get_board_f_flash(env):
155
155
# SPIFFS
156
156
#
157
157
158
- def _fetch_spiffs_size ( target , source , env ):
158
+ def fetch_spiffs_size ( env ):
159
159
spiffs_re = re .compile (
160
160
r"PROVIDE\s*\(\s*_SPIFFS_(\w+)\s*=\s*(0x[\dA-F]+)\s*\)" )
161
161
with open (env .GetActualLDScript ()) as f :
@@ -179,6 +179,9 @@ def _fetch_spiffs_size(target, source, env):
179
179
180
180
env [k ] = hex (_value )
181
181
182
+
183
+ def __fetch_spiffs_size (target , source , env ):
184
+ fetch_spiffs_size (env )
182
185
return (target , source )
183
186
184
187
@@ -193,7 +196,7 @@ def _fetch_spiffs_size(target, source, env):
193
196
"-s" , "${int(SPIFFS_END, 16) - int(SPIFFS_START, 16)}" ,
194
197
"$TARGET"
195
198
]), "Building SPIFFS image from '$SOURCES' directory to $TARGET" ),
196
- emitter = _fetch_spiffs_size ,
199
+ emitter = __fetch_spiffs_size ,
197
200
source_factory = env .Dir ,
198
201
suffix = ".bin"
199
202
)
@@ -310,9 +313,20 @@ def _fetch_spiffs_size(target, source, env):
310
313
# Target: Build executable and linkable firmware or SPIFFS image
311
314
#
312
315
316
+
317
+ def __tmp_hook_before_pio_3_2 ():
318
+ env .ProcessFlags (env .get ("BUILD_FLAGS" ))
319
+ # append specified LD_SCRIPT
320
+ if ("LDSCRIPT_PATH" in env and
321
+ not any (["-Wl,-T" in f for f in env ['LINKFLAGS' ]])):
322
+ env .Append (LINKFLAGS = ['-Wl,-T"$LDSCRIPT_PATH"' ])
323
+
324
+
313
325
target_elf = None
314
326
if "nobuild" in COMMAND_LINE_TARGETS :
315
327
if set (["uploadfs" , "uploadfsota" ]) & set (COMMAND_LINE_TARGETS ):
328
+ __tmp_hook_before_pio_3_2 ()
329
+ fetch_spiffs_size (env )
316
330
target_firm = join ("$BUILD_DIR" , "spiffs.bin" )
317
331
elif "PIOFRAMEWORK" not in env :
318
332
target_firm = [
@@ -323,14 +337,7 @@ def _fetch_spiffs_size(target, source, env):
323
337
target_firm = join ("$BUILD_DIR" , "firmware.bin" )
324
338
else :
325
339
if set (["buildfs" , "uploadfs" , "uploadfsota" ]) & set (COMMAND_LINE_TARGETS ):
326
- # @TODO, replace with env.ProcessAllFlags() after PIO 3.2 release
327
- env .ProcessFlags (env .get ("BUILD_FLAGS" ))
328
- # append specified LD_SCRIPT
329
- if ("LDSCRIPT_PATH" in env and
330
- not any (["-Wl,-T" in f for f in env ['LINKFLAGS' ]])):
331
- env .Append (LINKFLAGS = ['-Wl,-T"$LDSCRIPT_PATH"' ])
332
- ###
333
-
340
+ __tmp_hook_before_pio_3_2 ()
334
341
target_firm = env .DataToBin (
335
342
join ("$BUILD_DIR" , "spiffs" ), "$PROJECTDATA_DIR" )
336
343
AlwaysBuild (target_firm )
@@ -344,8 +351,8 @@ def _fetch_spiffs_size(target, source, env):
344
351
else :
345
352
target_firm = env .ElfToBin (
346
353
join ("$BUILD_DIR" , "firmware" ), target_elf )
347
- target_buildprog = env .Alias ("buildprog" , target_firm )
348
354
355
+ target_buildprog = env .Alias ("buildprog" , target_firm )
349
356
AlwaysBuild (env .Alias ("nobuild" , target_firm ))
350
357
351
358
#
0 commit comments