From 9a220b68787dd6af8d4709fbbbda94cd90f355fe Mon Sep 17 00:00:00 2001 From: jaseg Date: Fri, 13 Mar 2020 12:39:11 +0100 Subject: linkmem: Add subdir highlighting --- controller/fw/Makefile | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'controller/fw/Makefile') diff --git a/controller/fw/Makefile b/controller/fw/Makefile index db10868..58acf4c 100644 --- a/controller/fw/Makefile +++ b/controller/fw/Makefile @@ -104,6 +104,7 @@ HOST_OBJCOPY ?= $(HOST_PREFIX)objcopy HOST_OBJDUMP ?= $(HOST_PREFIX)objdump PYTHON3 ?= python3 +DOT ?= dot CMSIS_DIR_ABS := $(abspath $(CMSIS_DIR)) MSPDEBUG_DIR_ABS := $(abspath $(MSPDEBUG_DIR)) @@ -160,6 +161,8 @@ LDFLAGS += $(ARCH_FLAGS) $(SYSTEM_FLAGS) LIBS += -lgcc LDFLAGS += -Wl,--gc-sections +LINKMEM_FLAGS ?= --trim-stubs=startup_stm32f407xx.o --trace-sections .isr_vector --highlight-subdirs $(BUILDDIR) + OBJS := $(addprefix $(BUILDDIR)/,$(C_SOURCES:.c=.o) $(CXX_SOURCES:.cpp=.o)) ALL_OBJS := $(OBJS) @@ -179,7 +182,7 @@ ALL_OBJS += $(BUILDDIR)/generated/dsss_cwt_wavelet.o all: binsize .PHONY: binsize -binsize: $(BUILDDIR)/$(BINARY) +binsize: $(BUILDDIR)/$(BINARY) $(BUILDDIR)/$(BINARY:.elf=-symbol-sizes.pdf) $(LD) -T$(LDSCRIPT) $(LDFLAGS) -Wl,--print-memory-usage -o /dev/null $(ALL_OBJS) $(LIBS) @echo @echo "▐▬▬▬▌ SyMbOL sIzE HiGhScORe LiSt ▐▬▬▬▌" @@ -221,9 +224,11 @@ $(BUILDDIR)/generated: ; mkdir -p $@ $(BUILDDIR)/$(BINARY) $(BUILDDIR)/$(BINARY:.elf=.map) &: $(ALL_OBJS) $(LD) -T$(LDSCRIPT) $(LDFLAGS) -o $@ -Wl,-Map=$(BUILDDIR)/$(BINARY:.elf=.map) $^ $(LIBS) -.PHONY: linktrace -linktrace: $(ALL_OBJS) - $(PYTHON3) tools/linktracer.py $(LD) -T$(LDSCRIPT) $(LDFLAGS) -o $@ $^ $(LIBS) +build/$(BINARY:.elf=-symbol-sizes.dot): $(ALL_OBJS) + $(PYTHON3) tools/linkmem.py $(LINKMEM_FLAGS) $(LD) -T$(LDSCRIPT) $(LDFLAGS) $^ $(LIBS) > $@ + +%.pdf: %.dot + $(DOT) -T pdf $< -o $@ %.dot: %.elf r2 -a arm -qc 'aa;agRd' $< 2>/dev/null >$@ @@ -282,6 +287,8 @@ clean: rm -rf $(BUILDDIR)/src rm -rf $(BUILDDIR)/generated rm -f $(BUILDDIR)/$(BINARY) + rm -f $(BUILDDIR)/$(BINARY:.elf=-symbol-sizes.dot) + rm -f $(BUILDDIR)/$(BINARY:.elf=-symbol-sizes.pdf) rm -f $(BUILDDIR)/tools/freq_meas_test mrproper: clean -- cgit