summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Bettis <jbettis@google.com>2022-03-16 10:17:06 -0600
committerCommit Bot <commit-bot@chromium.org>2022-03-16 23:21:47 +0000
commitd28900b02762ad70d884d2b6c55584d6957a5bac (patch)
treee512fd0d60b15ef305def0c75a41293f0b307b32
parent22a187557d35440ea0d4d30d06ea320e44810e99 (diff)
downloadchrome-ec-d28900b02762ad70d884d2b6c55584d6957a5bac.tar.gz
ec: Write memory usage report to file
Change the linker command for all board builds to pass the --print-memory-usage flag and save the results to a file. BRANCH=None BUG=b:223846977 TEST=make buildall_only -j16 Signed-off-by: Jeremy Bettis <jbettis@google.com> Change-Id: I63733ce205a5453e7dc16809f7fd033873d67d07 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3530150 Tested-by: Jeremy Bettis <jbettis@chromium.org> Commit-Queue: Jeremy Bettis <jbettis@chromium.org> Auto-Submit: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Yuval Peress <peress@google.com> Commit-Queue: Yuval Peress <peress@google.com>
-rw-r--r--Makefile.rules4
-rw-r--r--Makefile.toolchain1
2 files changed, 5 insertions, 0 deletions
diff --git a/Makefile.rules b/Makefile.rules
index a9adf629fc..3d79a5a65f 100644
--- a/Makefile.rules
+++ b/Makefile.rules
@@ -91,6 +91,10 @@ cmd_elf = $(CC) $(objs) $(libsharedobjs_elf-y) $(LDFLAGS) \
ifeq ($(cc-name),gcc)
cmd_elf+= -flto-partition=one
endif
+ifneq ($(MEMSIZE_FLAGS),)
+cmd_elf+= $(MEMSIZE_FLAGS) >$@.memsize.txt
+endif
+
cmd_fuzz_exe = $(CXX) $^ $(HOST_TEST_LDFLAGS) $(LDFLAGS_EXTRA) -o $@
cmd_run_fuzz = build/host/$*/$*.exe -seed=1 -runs=1 $(silent) \
$(silent_err) || (echo "Test $* failed!" && false)
diff --git a/Makefile.toolchain b/Makefile.toolchain
index ddb6e82ffa..f0345907a7 100644
--- a/Makefile.toolchain
+++ b/Makefile.toolchain
@@ -170,6 +170,7 @@ ifneq (${SYSROOT},)
endif
LDFLAGS=-nostdlib -g -Wl,-X -Wl,--gc-sections -Wl,--build-id=none \
$(LDFLAGS_EXTRA) $(CFLAGS_CPU)
+MEMSIZE_FLAGS=-Wl,--print-memory-usage
BUILD_LDFLAGS=$(LIBFTDIUSB_LDLIBS)
HOST_LDFLAGS=$(LIBFTDIUSB_LDLIBS)
HOST_TEST_LDFLAGS=-Wl,-T core/host/host_exe.lds -lrt -pthread -rdynamic -lm\