Skip to content

Commit 692f13d

Browse files
committed
Additional target "buildfs" to accompany "uploadfs" // Resolve platformio#6
1 parent 582f8db commit 692f13d

File tree

1 file changed

+24
-25
lines changed

1 file changed

+24
-25
lines changed

builder/main.py

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@
1414

1515
# pylint: disable=redefined-outer-name
1616

17-
"""
18-
Builder for Espressif MCUs
19-
"""
20-
2117
import re
2218
from os.path import join
2319

@@ -311,35 +307,38 @@ def _fetch_spiffs_size(target, source, env):
311307
)
312308

313309
#
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
321311
#
322312

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:
330318
target_firm = [
331319
join("$BUILD_DIR", "firmware_00000.bin"),
332320
join("$BUILD_DIR", "firmware_40000.bin")
333321
]
334322
else:
335323
target_firm = join("$BUILD_DIR", "firmware.bin")
336324
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))
341330
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))
343342

344343
#
345344
# Target: Print binary size
@@ -355,7 +354,7 @@ def _fetch_spiffs_size(target, source, env):
355354
#
356355

357356
target_upload = env.Alias(
358-
["upload", "uploadlazy", "uploadfs"], target_firm,
357+
["upload", "uploadfs"], target_firm,
359358
[env.VerboseAction(env.AutodetectUploadPort, "Looking for upload port..."),
360359
env.VerboseAction("$UPLOADCMD", "Uploading $SOURCE")])
361360
env.AlwaysBuild(target_upload)
@@ -365,4 +364,4 @@ def _fetch_spiffs_size(target, source, env):
365364
# Default targets
366365
#
367366

368-
Default([target_firm, target_size])
367+
Default([target_buildprog, target_size])

0 commit comments

Comments
 (0)