pw_toolchain_size_report template
This change adds a GN template which creates a size report card across
a set of different toolchains. The toolchains are defined in a build
variable, each with an optional linker script and Bloaty config. The
size report template builds a base and diff executable with each of the
toolchains and compares the size difference of each.
Example output for the host target:
simple_bloat_toolchain
──────────────────────
┌───────────┬─────────┬────────┬───────┬───────┐
│ Label │ Segment │ Before │ Delta │ After │
├═══════════┼═════════┼════════┼═══════┼═══════┤
│ gcc -Og │ CODE │ 413 │ +32 │ 445 │
│ │ RAM │ 576 │ +8 │ 584 │
├───────────┼─────────┼────────┼───────┼───────┤
│ gcc -Os │ CODE │ 429 │ +16 │ 445 │
│ │ RAM │ 576 │ +8 │ 584 │
├───────────┼─────────┼────────┼───────┼───────┤
│ gcc -O2 │ CODE │ 429 │ +32 │ 461 │
│ │ RAM │ 576 │ +8 │ 584 │
├───────────┼─────────┼────────┼───────┼───────┤
│ clang -Og │ CODE │ 448 │ +32 │ 480 │
│ │ RAM │ 113 │ +15 │ 128 │
├───────────┼─────────┼────────┼───────┼───────┤
│ clang -Os │ CODE │ 432 │ +16 │ 448 │
│ │ RAM │ 113 │ +15 │ 128 │
├───────────┼─────────┼────────┼───────┼───────┤
│ clang -O2 │ CODE │ 448 │ +80 │ 528 │
│ │ RAM │ 113 │ +15 │ 128 │
└───────────┴─────────┴────────┴───────┴───────┘
Change-Id: I2c65f4d4f61354b9779628f207297eacd04470b9
diff --git a/pw_vars_default.gni b/pw_vars_default.gni
index 8bb758a..db202a8 100644
--- a/pw_vars_default.gni
+++ b/pw_vars_default.gni
@@ -46,6 +46,20 @@
# the previous toolchain's build before building again.
pw_target_toolchain = ""
+# List of toolchains to use in pw_toolchain_size_report templates.
+#
+# Each entry is a scope containing the following variables:
+#
+# name: Human-readable toolchain name.
+# target: GN target that defines the toolchain.
+# linker_script: Optional path to a linker script file to build for the
+# toolchain's target.
+# bloaty_config: Optional Bloaty confirugation file defining the memory
+# layout of the binaries as specified in the linker script.
+#
+# If this list is empty, pw_toolchain_size_report targets become no-ops.
+pw_size_report_toolchains = []
+
# Implementation of a main function for "pw_test" unit test binaries.
pw_unit_test_main = "$dir_pw_unit_test:main"