summaryrefslogtreecommitdiff
path: root/controller/fw/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'controller/fw/Makefile')
-rw-r--r--controller/fw/Makefile15
1 files changed, 11 insertions, 4 deletions
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