14
14
15
15
# pylint: disable=redefined-outer-name
16
16
17
- """
18
- Builder for Espressif MCUs
19
- """
20
-
21
17
import re
22
18
from os .path import join
23
19
@@ -311,35 +307,38 @@ def _fetch_spiffs_size(target, source, env):
311
307
)
312
308
313
309
#
314
- # Target: Build executable and linkable firmware
315
- #
316
-
317
- target_elf = env .BuildProgram ()
318
-
319
- #
320
- # Target: Build the .hex or SPIFFS image
310
+ # Target: Build executable and linkable firmware or SPIFFS image
321
311
#
322
312
323
- if set (["uploadfs" , "uploadfsota" ]) & set (COMMAND_LINE_TARGETS ):
324
- target_firm = env .DataToBin (
325
- join ("$BUILD_DIR" , "spiffs" ), "$PROJECTDATA_DIR" )
326
- AlwaysBuild (target_firm )
327
-
328
- elif "uploadlazy" in COMMAND_LINE_TARGETS :
329
- if "PIOFRAMEWORK" not in env :
313
+ target_elf = None
314
+ if "nobuild" in COMMAND_LINE_TARGETS :
315
+ if set (["uploadfs" , "uploadfsota" ]) & set (COMMAND_LINE_TARGETS ):
316
+ target_firm = join ("$BUILD_DIR" , "spiffs.bin" )
317
+ elif "PIOFRAMEWORK" not in env :
330
318
target_firm = [
331
319
join ("$BUILD_DIR" , "firmware_00000.bin" ),
332
320
join ("$BUILD_DIR" , "firmware_40000.bin" )
333
321
]
334
322
else :
335
323
target_firm = join ("$BUILD_DIR" , "firmware.bin" )
336
324
else :
337
- if "PIOFRAMEWORK" not in env :
338
- target_firm = env .ElfToBin (
339
- [join ("$BUILD_DIR" , "firmware_00000" ),
340
- join ("$BUILD_DIR" , "firmware_40000" )], target_elf )
325
+ if set (["buildfs" , "uploadfs" , "uploadfsota" ]) & set (COMMAND_LINE_TARGETS ):
326
+ target_firm = env .DataToBin (
327
+ join ("$BUILD_DIR" , "spiffs" ), "$PROJECTDATA_DIR" )
328
+ AlwaysBuild (target_firm )
329
+ AlwaysBuild (env .Alias ("buildfs" , target_firm ))
341
330
else :
342
- target_firm = env .ElfToBin (join ("$BUILD_DIR" , "firmware" ), target_elf )
331
+ target_elf = env .BuildProgram ()
332
+ if "PIOFRAMEWORK" not in env :
333
+ target_firm = env .ElfToBin ([join ("$BUILD_DIR" , "firmware_00000" ),
334
+ join ("$BUILD_DIR" , "firmware_40000" )],
335
+ target_elf )
336
+ else :
337
+ target_firm = env .ElfToBin (
338
+ join ("$BUILD_DIR" , "firmware" ), target_elf )
339
+ target_buildprog = env .Alias ("buildprog" , target_firm )
340
+
341
+ AlwaysBuild (env .Alias ("nobuild" , target_firm ))
343
342
344
343
#
345
344
# Target: Print binary size
@@ -355,7 +354,7 @@ def _fetch_spiffs_size(target, source, env):
355
354
#
356
355
357
356
target_upload = env .Alias (
358
- ["upload" , "uploadlazy" , " uploadfs" ], target_firm ,
357
+ ["upload" , "uploadfs" ], target_firm ,
359
358
[env .VerboseAction (env .AutodetectUploadPort , "Looking for upload port..." ),
360
359
env .VerboseAction ("$UPLOADCMD" , "Uploading $SOURCE" )])
361
360
env .AlwaysBuild (target_upload )
@@ -365,4 +364,4 @@ def _fetch_spiffs_size(target, source, env):
365
364
# Default targets
366
365
#
367
366
368
- Default ([target_firm , target_size ])
367
+ Default ([target_buildprog , target_size ])
0 commit comments