diff --git a/builder/main.py b/builder/main.py index e11e9587d..9b0b7867e 100644 --- a/builder/main.py +++ b/builder/main.py @@ -128,6 +128,7 @@ def __fetch_spiffs_size(target, source, env): env.Replace( __get_board_f_flash=_get_board_f_flash, __get_board_flash_mode=_get_board_flash_mode, + AR="xtensa-esp32-elf-ar", AS="xtensa-esp32-elf-as", CC="xtensa-esp32-elf-gcc", @@ -137,6 +138,7 @@ def __fetch_spiffs_size(target, source, env): platform.get_package_dir("tool-esptoolpy") or "", "esptool.py"), RANLIB="xtensa-esp32-elf-ranlib", SIZETOOL="xtensa-esp32-elf-size", + ARFLAGS=["rc"], ASFLAGS=["-x", "assembler-with-cpp"], CFLAGS=["-std=gnu99"], @@ -155,9 +157,15 @@ def __fetch_spiffs_size(target, source, env): "-nostdlib", "-Wl,-static", "-u", "call_user_start_cpu0", "-Wl,--undefined=uxTopUsedPriority", "-Wl,--gc-sections" ], + + SIZEPROGREGEXP=r"^(?:\.iram0\.text|\.dram0\.text|\.flash\.text|\.dram0\.data|\.flash\.rodata|)\s+(\d+).*", + SIZEDATAREGEXP=r"^(?:\.dram0\.data|\.dram0\.bss)\s+(\d+).*", + SIZECHECKCMD="$SIZETOOL -A -d $SOURCES", + SIZEPRINTCMD="$SIZETOOL -B -d $SOURCES", + MKSPIFFSTOOL="mkspiffs_${PIOPLATFORM}_${PIOFRAMEWORK}", - SIZEPRINTCMD='$SIZETOOL -B -d $SOURCES', - PROGSUFFIX=".elf") + PROGSUFFIX=".elf" +) # Allow user to override via pre:script if env.get("PROGNAME", "program") == "program": @@ -210,7 +218,14 @@ def __fetch_spiffs_size(target, source, env): target_buildprog = env.Alias("buildprog", target_firm, target_firm) # update max upload size based on CSV file -if "upload" in COMMAND_LINE_TARGETS: +if env.get("PIOMAINPROG"): + env.AddPreAction( + "checkprogsize", + env.VerboseAction( + lambda source, target, env: _update_max_upload_size(env), + "Retrieving maximum program size $SOURCES")) +# remove after PIO Core 3.6 release +elif set(["checkprogsize", "upload"]) & set(COMMAND_LINE_TARGETS): _update_max_upload_size(env) # diff --git a/platform.json b/platform.json index b109632ea..48a133bf3 100644 --- a/platform.json +++ b/platform.json @@ -12,7 +12,7 @@ "type": "git", "url": "https://github.com/platformio/platform-espressif32.git" }, - "version": "1.0.1", + "version": "1.0.2", "packageRepositories": [ "https://dl.bintray.com/platformio/dl-packages/manifest.json", "http://dl.platformio.org/packages/manifest.json",