Skip to content

Commit 1c1ee17

Browse files
committed
Merge branch 'develop' into feature/stage
* develop: Use upcoming "checkprogsize" target from PIO Core 3.6 to update max upload size Declare command for checking memory usage Update maximum allowed upload size for "checkprogsize" target
2 parents 77cb4bc + 99270f8 commit 1c1ee17

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

builder/main.py

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ def __fetch_spiffs_size(target, source, env):
128128
env.Replace(
129129
__get_board_f_flash=_get_board_f_flash,
130130
__get_board_flash_mode=_get_board_flash_mode,
131+
131132
AR="xtensa-esp32-elf-ar",
132133
AS="xtensa-esp32-elf-as",
133134
CC="xtensa-esp32-elf-gcc",
@@ -137,6 +138,7 @@ def __fetch_spiffs_size(target, source, env):
137138
platform.get_package_dir("tool-esptoolpy") or "", "esptool.py"),
138139
RANLIB="xtensa-esp32-elf-ranlib",
139140
SIZETOOL="xtensa-esp32-elf-size",
141+
140142
ARFLAGS=["rc"],
141143
ASFLAGS=["-x", "assembler-with-cpp"],
142144
CFLAGS=["-std=gnu99"],
@@ -155,9 +157,15 @@ def __fetch_spiffs_size(target, source, env):
155157
"-nostdlib", "-Wl,-static", "-u", "call_user_start_cpu0",
156158
"-Wl,--undefined=uxTopUsedPriority", "-Wl,--gc-sections"
157159
],
160+
161+
SIZEPROGREGEXP=r"^(?:\.iram0\.text|\.dram0\.text|\.flash\.text|\.dram0\.data|\.flash\.rodata|)\s+(\d+).*",
162+
SIZEDATAREGEXP=r"^(?:\.dram0\.data|\.dram0\.bss)\s+(\d+).*",
163+
SIZECHECKCMD="$SIZETOOL -A -d $SOURCES",
164+
SIZEPRINTCMD="$SIZETOOL -B -d $SOURCES",
165+
158166
MKSPIFFSTOOL="mkspiffs_${PIOPLATFORM}_${PIOFRAMEWORK}",
159-
SIZEPRINTCMD='$SIZETOOL -B -d $SOURCES',
160-
PROGSUFFIX=".elf")
167+
PROGSUFFIX=".elf"
168+
)
161169

162170
# Allow user to override via pre:script
163171
if env.get("PROGNAME", "program") == "program":
@@ -210,7 +218,14 @@ def __fetch_spiffs_size(target, source, env):
210218
target_buildprog = env.Alias("buildprog", target_firm, target_firm)
211219

212220
# update max upload size based on CSV file
213-
if "upload" in COMMAND_LINE_TARGETS:
221+
if env.get("PIOMAINPROG"):
222+
env.AddPreAction(
223+
"checkprogsize",
224+
env.VerboseAction(
225+
lambda source, target, env: _update_max_upload_size(env),
226+
"Retrieving maximum program size $SOURCES"))
227+
# remove after PIO Core 3.6 release
228+
elif set(["checkprogsize", "upload"]) & set(COMMAND_LINE_TARGETS):
214229
_update_max_upload_size(env)
215230

216231
#

0 commit comments

Comments
 (0)