From edde28594fbbf44a25f0fb4229353137bca35a3e Mon Sep 17 00:00:00 2001 From: jaseg Date: Fri, 13 Mar 2020 11:48:43 +0100 Subject: prettify linkmem --- controller/fw/Makefile | 42 +++++++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 19 deletions(-) (limited to 'controller/fw/Makefile') diff --git a/controller/fw/Makefile b/controller/fw/Makefile index 27fd9ba..db10868 100644 --- a/controller/fw/Makefile +++ b/controller/fw/Makefile @@ -156,11 +156,21 @@ CXXFLAGS += -Wall -Wextra -Wshadow -Wundef -Wredundant-decls CXXFLAGS += -I. LDFLAGS += $(ARCH_FLAGS) $(SYSTEM_FLAGS) -LDFLAGS += -Wl,--cre -LDFLAGS += --trace LIBS += -lgcc -LDFLAGS += -Wl,--gc-sections -Wl,--trace-symbol=twiddleCoef_4096 -Wl,--trace-symbol=arm_cfft_sR_f32_len4096 +LDFLAGS += -Wl,--gc-sections + +OBJS := $(addprefix $(BUILDDIR)/,$(C_SOURCES:.c=.o) $(CXX_SOURCES:.cpp=.o)) + +ALL_OBJS := $(OBJS) +ALL_OBJS += $(BUILDDIR)/src/startup_stm32f407xx.o +ALL_OBJS += $(BUILDDIR)/src/system_stm32f4xx.o +ALL_OBJS += $(BUILDDIR)/libsodium/src/libsodium/.libs/libsodium.a +ALL_OBJS += $(BUILDDIR)/tinyaes/aes.o +ALL_OBJS += $(BUILDDIR)/levmarq/levmarq.o +ALL_OBJS += $(BUILDDIR)/generated/gold_code_$(DSSS_GOLD_CODE_NBITS).o +ALL_OBJS += $(BUILDDIR)/generated/fmeas_fft_window.o +ALL_OBJS += $(BUILDDIR)/generated/dsss_cwt_wavelet.o ######################################################################################################################## # Rules @@ -170,11 +180,10 @@ all: binsize .PHONY: binsize binsize: $(BUILDDIR)/$(BINARY) + $(LD) -T$(LDSCRIPT) $(LDFLAGS) -Wl,--print-memory-usage -o /dev/null $(ALL_OBJS) $(LIBS) + @echo @echo "▐▬▬▬▌ SyMbOL sIzE HiGhScORe LiSt ▐▬▬▬▌" $(NM) --print-size --size-sort --radix=d $< | tail -n 20 - @echo - @echo "===== Binary size =====" - $(SIZE) $< src/dsss_demod.c: $(BUILDDIR)/generated/dsss_gold_code.h $(BUILDDIR)/generated/dsss_butter_filter.h @@ -208,21 +217,16 @@ $(PRESIG_KEYFILE): $(BUILDDIR)/generated: ; mkdir -p $@ -OBJS := $(addprefix $(BUILDDIR)/,$(C_SOURCES:.c=.o) $(CXX_SOURCES:.cpp=.o)) +.PRECIOUS: $(BUILDDIR)/$(BINARY) +$(BUILDDIR)/$(BINARY) $(BUILDDIR)/$(BINARY:.elf=.map) &: $(ALL_OBJS) + $(LD) -T$(LDSCRIPT) $(LDFLAGS) -o $@ -Wl,-Map=$(BUILDDIR)/$(BINARY:.elf=.map) $^ $(LIBS) -ALL_OBJS := $(OBJS) -ALL_OBJS += $(BUILDDIR)/src/startup_stm32f407xx.o -ALL_OBJS += $(BUILDDIR)/src/system_stm32f4xx.o -ALL_OBJS += $(BUILDDIR)/libsodium/src/libsodium/.libs/libsodium.a -ALL_OBJS += $(BUILDDIR)/tinyaes/aes.o -ALL_OBJS += $(BUILDDIR)/levmarq/levmarq.o -ALL_OBJS += $(BUILDDIR)/generated/gold_code_$(DSSS_GOLD_CODE_NBITS).o -ALL_OBJS += $(BUILDDIR)/generated/fmeas_fft_window.o -ALL_OBJS += $(BUILDDIR)/generated/dsss_cwt_wavelet.o +.PHONY: linktrace +linktrace: $(ALL_OBJS) + $(PYTHON3) tools/linktracer.py $(LD) -T$(LDSCRIPT) $(LDFLAGS) -o $@ $^ $(LIBS) -.PRECIOUS: $(BUILDDIR)/$(BINARY) -$(BUILDDIR)/$(BINARY): $(ALL_OBJS) - $(LD) -T$(LDSCRIPT) $(LDFLAGS) -o $@ -Wl,-Map=$(BUILDDIR)/src/$*.map $^ $(LIBS) +%.dot: %.elf + r2 -a arm -qc 'aa;agRd' $< 2>/dev/null >$@ tools: $(BUILDDIR)/tools/freq_meas_test $(BUILDDIR)/tools/freq_meas_test: tools/freq_meas_test.c src/freq_meas.c levmarq/levmarq.c $(BUILDDIR)/generated/fmeas_fft_window.c $(CMSIS_SOURCES) -- cgit