From f7b24ecf96a1e8255b67a896b853c51d2f3b6f10 Mon Sep 17 00:00:00 2001 From: Matthijs Kooijman Date: Wed, 4 Mar 2020 16:37:34 +0100 Subject: [PATCH 1/2] Fix flash size regex This regex would only look at the .text section, but the .data section (initialization values for global variables) also takes up space in flash. The regex is changed to match both sections. arduino-builder will then add together the values and show the sum to the user (this summing seems to have been supported at least since the introduction of arduino-builder, see: https://github.com/arduino/arduino-builder/commit/0802e27 The regex format is copied from the AVR core, which already did the same (though AVR also includes a .bootloader section, which is not relevant here it seems, any bootloader is included in .text). This also copies the start-of-line ^ anchor to the regex, making the matching more accurate. --- platform.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform.txt b/platform.txt index 3aa88ef48..8abd2d06d 100644 --- a/platform.txt +++ b/platform.txt @@ -117,7 +117,7 @@ recipe.output.save_file={build.project_name}.{build.variant}.{build.preferred_ou ## Compute size recipe.size.pattern="{compiler.path}{compiler.size.cmd}" -A "{build.path}/{build.project_name}.elf" -recipe.size.regex=\.text\s+([0-9]+).* +recipe.size.regex=^(?:\.text|\.data|)\s+([0-9]+).* # Upload/Debug tools # ------------------ From 1857ccee92d81e632392c7e875c74b4b35aba4ed Mon Sep 17 00:00:00 2001 From: Matthijs Kooijman Date: Wed, 4 Mar 2020 18:05:44 +0100 Subject: [PATCH 2/2] Add size regex for used RAM This was previously omitted, causing arduino-builder to not report the amount of RAM used. This adds the regex, based on the regex used by AVR (omitting the .noinit section, which is not supported by the SAMD linker scripts). --- platform.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/platform.txt b/platform.txt index 8abd2d06d..0a860df33 100644 --- a/platform.txt +++ b/platform.txt @@ -118,6 +118,7 @@ recipe.output.save_file={build.project_name}.{build.variant}.{build.preferred_ou ## Compute size recipe.size.pattern="{compiler.path}{compiler.size.cmd}" -A "{build.path}/{build.project_name}.elf" recipe.size.regex=^(?:\.text|\.data|)\s+([0-9]+).* +recipe.size.regex.data=^(?:\.data|\.bss)\s+([0-9]+).* # Upload/Debug tools # ------------------