From e75bdd00e71c08b0ceef3ea8a6c4703b55723cc9 Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Tue, 24 Nov 2015 13:08:12 +0000 Subject: [PATCH] Remove duplicate block and define the argument of -a using $(shell) --- platform/cc2538dk/Makefile.cc2538dk | 7 +++++-- platform/remote/Makefile.remote | 12 ++++-------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/platform/cc2538dk/Makefile.cc2538dk b/platform/cc2538dk/Makefile.cc2538dk index dfce1f375..4dbeb6d03 100644 --- a/platform/cc2538dk/Makefile.cc2538dk +++ b/platform/cc2538dk/Makefile.cc2538dk @@ -29,7 +29,7 @@ MODULES += core/net core/net/mac \ core/net/llsec PYTHON = python -BSL_FLAGS += -e -w -v -a $$($(OBJDUMP) -h $*.elf | grep -B1 LOAD | grep -Ev 'LOAD|\-\-' | awk '{print "0x" $$5}' | sort -g | head -1) +BSL_FLAGS += -e -w -v ifdef PORT BSL_FLAGS += -p $(PORT) @@ -41,5 +41,8 @@ BSL = $(CONTIKI)/tools/cc2538-bsl/cc2538-bsl.py ifeq ($(wildcard $(BSL)), ) @echo "ERROR: Could not find the cc2538-bsl script. Did you run 'git submodule update --init' ?" else - $(PYTHON) $(BSL) $(BSL_FLAGS) $< + $(eval BSL_ADDRESS_ARG := -a $(shell $(OBJDUMP) -h $*.elf | grep -B1 LOAD | \ + grep -Ev 'LOAD|\-\-' | awk '{print "0x" $$5}' | \ + sort -g | head -1)) + $(PYTHON) $(BSL) $(BSL_FLAGS) $(BSL_ADDRESS_ARG) $< endif diff --git a/platform/remote/Makefile.remote b/platform/remote/Makefile.remote index b91183b1e..a261cb686 100644 --- a/platform/remote/Makefile.remote +++ b/platform/remote/Makefile.remote @@ -36,18 +36,14 @@ MODULES += core/net core/net/mac \ core/net/mac/contikimac \ core/net/llsec -PYTHON = python -BSL_FLAGS += -e -w -v -a $$($(OBJDUMP) -h $*.elf | grep -B1 LOAD | grep -Ev 'LOAD|\-\-' | awk '{print "0x" $$5}' | sort -g | head -1) - -ifdef PORT - BSL_FLAGS += -p $(PORT) -endif - BSL = $(CONTIKI)/tools/cc2538-bsl/cc2538-bsl.py %.upload: %.bin %.elf ifeq ($(wildcard $(BSL)), ) @echo "ERROR: Could not find the cc2538-bsl script. Did you run 'git submodule update --init' ?" else - $(PYTHON) $(BSL) $(BSL_FLAGS) $< + $(eval BSL_ADDRESS_ARG := -a $(shell $(OBJDUMP) -h $*.elf | grep -B1 LOAD | \ + grep -Ev 'LOAD|\-\-' | awk '{print "0x" $$5}' | \ + sort -g | head -1)) + $(PYTHON) $(BSL) $(BSL_FLAGS) $(BSL_ADDRESS_ARG) $< endif