From 04e76f323db629aedad73392eb230d7f742dd330 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Harter?= Date: Mon, 20 May 2019 19:49:12 +0200 Subject: [PATCH 01/10] dist/tools/buildsystem_sanity_check: handle vars exported in vars.inc.mk Handle differently variables that are exported in `vars.inc.mk` from the ones that should not. This is needed for the upcoming variables change that should also be removed from `vars.inc.mk` right now. Keeping the old behavior will help migrating other variables more easily by keeping them only exported in vars.inc.mk in the first time. --- dist/tools/buildsystem_sanity_check/check.sh | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/dist/tools/buildsystem_sanity_check/check.sh b/dist/tools/buildsystem_sanity_check/check.sh index 52f6c85fad..05f84b6c28 100755 --- a/dist/tools/buildsystem_sanity_check/check.sh +++ b/dist/tools/buildsystem_sanity_check/check.sh @@ -50,6 +50,8 @@ check_not_parsing_features() { UNEXPORTED_VARIABLES=() UNEXPORTED_VARIABLES+=('FLASHFILE') UNEXPORTED_VARIABLES+=('TERMPROG' 'TERMFLAGS') + +EXPORTED_VARIABLES_ONLY_IN_VARS=() check_not_exporting_variables() { local patterns=() local pathspec=() @@ -58,13 +60,22 @@ check_not_exporting_variables() { patterns+=(-e "export[[:blank:]]\+${variable}") done - pathspec+=('*') + git -C "${RIOTBASE}" grep "${patterns[@]}" - # Ignore `makefiles/vars.inc.mk` as it currently is the only place that - # should export common variables. + # Some variables may still be exported in 'makefiles/vars.inc.mk' as the + # only place that should export commont variables + pathspec+=('*') pathspec+=(':!makefiles/vars.inc.mk') - git -C "${RIOTBASE}" grep "${patterns[@]}" -- "${pathspec[@]}" + patterns=() + for variable in "${EXPORTED_VARIABLES_ONLY_IN_VARS[@]}"; do + patterns+=(-e "export[[:blank:]]\+${variable}") + done + + # Only run if there are patterns, otherwise it matches everything + if [ ${#patterns[@]} -ne 0 ]; then + git -C "${RIOTBASE}" grep "${patterns[@]}" -- "${pathspec[@]}" + fi } From ac113ca2f8bd537d8c7e728c6ac8817e0df717d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Harter?= Date: Fri, 17 May 2019 13:52:34 +0200 Subject: [PATCH 02/10] boards/tools: remove exporting FLASHER/FFLAGS FLASHER and FFLAGS are evaluated by the main Makefile.include or by file included by it. Their value does not need to be exported. This will also prevent evaluating 'PORT' for FFLAGS when not needed. Testing ------- `git diff --word-diff` only reports `export` being removed. `git show --stat` reports `84 insertions(+), 84 deletions(-)` Which is the same amount as lines that where matching `export[[:blank::]]\+VARIABLE`. --- boards/calliope-mini/Makefile.include | 4 +-- boards/cc2538dk/Makefile.include | 8 ++--- boards/chronos/Makefile.include | 4 +-- boards/common/msb-430/Makefile.include | 4 +-- boards/common/remote/Makefile.include | 8 ++--- boards/common/stm32f103c8/Makefile.include | 6 ++-- boards/common/wsn430/Makefile.include | 4 +-- boards/f4vi1/Makefile.include | 4 +-- boards/hifive1/Makefile.include | 2 +- boards/mbed_lpc1768/Makefile.include | 4 +-- boards/microbit/Makefile.include | 4 +-- boards/native/Makefile.include | 2 +- boards/nz32-sc151/Makefile.include | 4 +-- boards/opencm904/Makefile.include | 4 +-- boards/openmote-b/Makefile.include | 8 ++--- boards/openmote-cc2538/Makefile.include | 4 +-- boards/spark-core/Makefile.include | 4 +-- boards/telosb/Makefile.include | 4 +-- boards/z1/Makefile.include | 4 +-- cpu/esp32/Makefile.include | 36 +++++++++++----------- cpu/esp8266/Makefile.include | 18 +++++------ makefiles/tools/bossa.inc.mk | 4 +-- makefiles/tools/jlink.inc.mk | 4 +-- makefiles/tools/openocd.inc.mk | 4 +-- makefiles/tools/pyocd.inc.mk | 4 +-- makefiles/tools/uniflash.inc.mk | 8 ++--- makefiles/vars.inc.mk | 4 +-- 27 files changed, 84 insertions(+), 84 deletions(-) diff --git a/boards/calliope-mini/Makefile.include b/boards/calliope-mini/Makefile.include index 35575ba53e..abc3cd143f 100644 --- a/boards/calliope-mini/Makefile.include +++ b/boards/calliope-mini/Makefile.include @@ -10,10 +10,10 @@ PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*))) PROGRAMMER ?= fscopy ifeq (fscopy,$(PROGRAMMER)) - export FFLAGS = $(HEXFILE) + FFLAGS = $(HEXFILE) export DEBUGGER_FLAGS = - export FLASHER = $(RIOTBOARD)/$(BOARD)/dist/flash.sh + FLASHER = $(RIOTBOARD)/$(BOARD)/dist/flash.sh export DEBUGGER = export DEBUGSERVER = else ifeq (openocd,$(PROGRAMMER)) diff --git a/boards/cc2538dk/Makefile.include b/boards/cc2538dk/Makefile.include index 58e495ad87..f0df568dbd 100644 --- a/boards/cc2538dk/Makefile.include +++ b/boards/cc2538dk/Makefile.include @@ -23,11 +23,11 @@ export RESET = $(RIOTBOARD)/$(BOARD)/dist/reset.sh export PROGRAMMER ?= cc2538-bsl ifeq ($(PROGRAMMER),cc2538-bsl) - export FLASHER = $(RIOTTOOLS)/cc2538-bsl/cc2538-bsl.py - export FFLAGS = -p "$(PORT)" -e -w -v $(FLASHFILE) + FLASHER = $(RIOTTOOLS)/cc2538-bsl/cc2538-bsl.py + FFLAGS = -p "$(PORT)" -e -w -v $(FLASHFILE) else ifeq ($(PROGRAMMER),jlink) - export FLASHER = $(RIOTBOARD)/$(BOARD)/dist/flash.sh - export FFLAGS = $(BINDIR) $(FLASHFILE) + FLASHER = $(RIOTBOARD)/$(BOARD)/dist/flash.sh + FFLAGS = $(BINDIR) $(FLASHFILE) endif OFLAGS = --gap-fill 0xff diff --git a/boards/chronos/Makefile.include b/boards/chronos/Makefile.include index 12321d761c..c13f7c5b8f 100644 --- a/boards/chronos/Makefile.include +++ b/boards/chronos/Makefile.include @@ -3,8 +3,8 @@ export CPU = cc430 export CPU_MODEL = cc430f6137 # flasher configuration -export FLASHER = mspdebug -export FFLAGS = rf2500 "prog $(HEXFILE)" +FLASHER = mspdebug +FFLAGS = rf2500 "prog $(HEXFILE)" INCLUDES += -I$(RIOTBOARD)/$(BOARD)/drivers/include diff --git a/boards/common/msb-430/Makefile.include b/boards/common/msb-430/Makefile.include index 5c054c4c66..38d87f9b9f 100644 --- a/boards/common/msb-430/Makefile.include +++ b/boards/common/msb-430/Makefile.include @@ -14,8 +14,8 @@ export MSPDEBUGFLAGS += -j $(PROGRAMMER) ifeq ($(strip $(PROGRAMMER)),uif) export MSPDEBUGFLAGS += -d $(PORT) endif -export FLASHER ?= mspdebug -export FFLAGS = $(MSPDEBUGFLAGS) "prog $(HEXFILE)" +FLASHER ?= mspdebug +FFLAGS = $(MSPDEBUGFLAGS) "prog $(HEXFILE)" # setup debugger export DEBUGSERVER = $(FLASHER) diff --git a/boards/common/remote/Makefile.include b/boards/common/remote/Makefile.include index aeccff4ca8..36f226285d 100644 --- a/boards/common/remote/Makefile.include +++ b/boards/common/remote/Makefile.include @@ -13,11 +13,11 @@ ifeq ($(PROGRAMMER),cc2538-bsl) PORT_BSL ?= $(PORT_DARWIN) endif export RESET = $(RIOTTOOLS)/cc2538-bsl/cc2538-bsl.py -p "$(PORT_BSL)" - export FLASHER = $(RIOTTOOLS)/cc2538-bsl/cc2538-bsl.py - export FFLAGS = -p "$(PORT_BSL)" -e -w -v -b 115200 $(FLASHFILE) + FLASHER = $(RIOTTOOLS)/cc2538-bsl/cc2538-bsl.py + FFLAGS = -p "$(PORT_BSL)" -e -w -v -b 115200 $(FLASHFILE) else ifeq ($(PROGRAMMER),jlink) - export FLASHER = $(RIOTBOARD)/common/remote/dist/flash.sh - export FFLAGS = $(BINDIR) $(FLASHFILE) + FLASHER = $(RIOTBOARD)/common/remote/dist/flash.sh + FFLAGS = $(BINDIR) $(FLASHFILE) export DEBUGGER = $(RIOTBOARD)/common/remote/dist/debug.sh export DEBUGSERVER = JLinkGDBServer -device CC2538SF53 export RESET = $(RIOTBOARD)/common/remote/dist/reset.sh diff --git a/boards/common/stm32f103c8/Makefile.include b/boards/common/stm32f103c8/Makefile.include index 40997dc0ce..682b144dc9 100644 --- a/boards/common/stm32f103c8/Makefile.include +++ b/boards/common/stm32f103c8/Makefile.include @@ -23,14 +23,14 @@ include $(RIOTMAKE)/tools/serial.inc.mk # (ground) GPIO B1. ifeq ($(PROGRAMMER),dfu-util) export ROM_OFFSET ?= 0x2000 # Skip the space needed by the embedded bootloader - export FLASHER = dfu-util + FLASHER = dfu-util export DEBUGGER = # no debugger export RESET = # dfu-util has no support for resetting the device HEXFILE = $(BINFILE) - export FFLAGS = -d 1eaf:0003 -a 2 -D "$(HEXFILE)" + FFLAGS = -d 1eaf:0003 -a 2 -D "$(HEXFILE)" # for older bootloader versions use this: - #export FFLAGS = -d 1d50:6017 -s 0x08002000:leave -D "$(HEXFILE)" + # FFLAGS = -d 1d50:6017 -s 0x08002000:leave -D "$(HEXFILE)" else # this board uses openocd by default diff --git a/boards/common/wsn430/Makefile.include b/boards/common/wsn430/Makefile.include index 8987fe0958..9853cc8cf0 100644 --- a/boards/common/wsn430/Makefile.include +++ b/boards/common/wsn430/Makefile.include @@ -13,8 +13,8 @@ PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.SLAB_USBtoUART*))) include $(RIOTMAKE)/tools/serial.inc.mk # configure the flash tool -export FLASHER = mspdebug -export FFLAGS = -d $(PORT) -j uif "prog $(HEXFILE)" +FLASHER = mspdebug +FFLAGS = -d $(PORT) -j uif "prog $(HEXFILE)" # Use the HEXFILE when using iot-lab.single.inc.mk IOTLAB_FLASHFILE = $(HEXFILE) diff --git a/boards/f4vi1/Makefile.include b/boards/f4vi1/Makefile.include index 4ac58f2318..5850db4e94 100644 --- a/boards/f4vi1/Makefile.include +++ b/boards/f4vi1/Makefile.include @@ -13,11 +13,11 @@ PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.SLAB_USBtoUART*))) include $(RIOTMAKE)/tools/serial.inc.mk # st-flash -export FLASHER = st-flash +FLASHER = st-flash export DEBUGGER = $(RIOTBOARD)/$(BOARD)/dist/debug.sh export DEBUGSERVER = st-util # define st-flash parameters HEXFILE = $(BINFILE) -export FFLAGS = write $(HEXFILE) 0x8000000 +FFLAGS = write $(HEXFILE) 0x8000000 export DEBUGGER_FLAGS = $(RIOTBOARD)/$(BOARD)/dist/gdb.conf $(ELFFILE) diff --git a/boards/hifive1/Makefile.include b/boards/hifive1/Makefile.include index a3abd6fe0d..258cc562e9 100644 --- a/boards/hifive1/Makefile.include +++ b/boards/hifive1/Makefile.include @@ -17,4 +17,4 @@ export OPENOCD_CMD_RESET_RUN=-c _reset include $(RIOTMAKE)/tools/openocd.inc.mk # use our own openocd script to flash since HiFive1 has reset problems. -export FLASHER = $(RIOTBASE)/boards/hifive1/dist/flasher.sh +FLASHER = $(RIOTBASE)/boards/hifive1/dist/flasher.sh diff --git a/boards/mbed_lpc1768/Makefile.include b/boards/mbed_lpc1768/Makefile.include index e5511e48d7..e3cb716df8 100644 --- a/boards/mbed_lpc1768/Makefile.include +++ b/boards/mbed_lpc1768/Makefile.include @@ -1,12 +1,12 @@ # define the cpu used by the mbed_lpx1768 board export CPU = lpc1768 -export FLASHER = $(RIOTBOARD)/$(BOARD)/dist/flash.sh +FLASHER = $(RIOTBOARD)/$(BOARD)/dist/flash.sh export DEBUGGER = export DEBUGSERVER = HEXFILE = $(BINFILE) -export FFLAGS = $(HEXFILE) +FFLAGS = $(HEXFILE) export DEBUGGER_FLAGS = # define the default port depending on the host OS diff --git a/boards/microbit/Makefile.include b/boards/microbit/Makefile.include index 3436b5f801..053ec22fd9 100644 --- a/boards/microbit/Makefile.include +++ b/boards/microbit/Makefile.include @@ -10,10 +10,10 @@ PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.SLAB_USBtoUART*))) PROGRAMMER ?= fscopy ifeq (fscopy,$(PROGRAMMER)) - export FFLAGS = $(HEXFILE) + FFLAGS = $(HEXFILE) export DEBUGGER_FLAGS = - export FLASHER = $(RIOTBOARD)/$(BOARD)/dist/flash.sh + FLASHER = $(RIOTBOARD)/$(BOARD)/dist/flash.sh export DEBUGGER = export DEBUGSERVER = else ifeq (openocd,$(PROGRAMMER)) diff --git a/boards/native/Makefile.include b/boards/native/Makefile.include index 91b4c84b1f..d3cd5bc000 100644 --- a/boards/native/Makefile.include +++ b/boards/native/Makefile.include @@ -41,7 +41,7 @@ else endif TERMPROG ?= $(ELFFILE) -export FLASHER = true +FLASHER = true export VALGRIND ?= valgrind export CGANNOTATE ?= cg_annotate export GPROF ?= gprof diff --git a/boards/nz32-sc151/Makefile.include b/boards/nz32-sc151/Makefile.include index ad09aecc57..d2844aa46b 100644 --- a/boards/nz32-sc151/Makefile.include +++ b/boards/nz32-sc151/Makefile.include @@ -9,12 +9,12 @@ PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.SLAB_USBtoUART*))) # set the default id export ID ?= 0483:df11 -export FLASHER = dfu-util +FLASHER = dfu-util export DEBUGGER = # dfu-util has no debugger export RESET = # dfu-util has no support for resetting the device HEXFILE = $(BINFILE) -export FFLAGS = -d $(ID) -a 0 -s 0x08000000:leave -D "$(HEXFILE)" +FFLAGS = -d $(ID) -a 0 -s 0x08000000:leave -D "$(HEXFILE)" # setup serial terminal include $(RIOTMAKE)/tools/serial.inc.mk diff --git a/boards/opencm904/Makefile.include b/boards/opencm904/Makefile.include index 8ce69924a1..0078a18468 100644 --- a/boards/opencm904/Makefile.include +++ b/boards/opencm904/Makefile.include @@ -3,12 +3,12 @@ export CPU = stm32f1 export CPU_MODEL = stm32f103cb # custom flasher to use with the bootloader -export FLASHER = $(RIOTBOARD)/$(BOARD)/dist/robotis-loader.py +FLASHER = $(RIOTBOARD)/$(BOARD)/dist/robotis-loader.py export DEBUGGER = export DEBUGSERVER = HEXFILE = $(BINFILE) -export FFLAGS = $(PORT) $(HEXFILE) +FFLAGS = $(PORT) $(HEXFILE) export DEBUGGER_FLAGS = # define the default port depending on the host OS diff --git a/boards/openmote-b/Makefile.include b/boards/openmote-b/Makefile.include index 43124605aa..46f0c2bd08 100644 --- a/boards/openmote-b/Makefile.include +++ b/boards/openmote-b/Makefile.include @@ -16,11 +16,11 @@ ifeq ($(PROGRAMMER),cc2538-bsl) else ifeq ($(OS),Darwin) PORT_BSL ?= $(PORT_DARWIN) endif - export FLASHER = $(RIOTBASE)/dist/tools/cc2538-bsl/cc2538-bsl.py - export FFLAGS = -p "$(PORT_BSL)" --bootloader-invert-lines -e -w -v -b 460800 $(FLASHFILE) + FLASHER = $(RIOTBASE)/dist/tools/cc2538-bsl/cc2538-bsl.py + FFLAGS = -p "$(PORT_BSL)" --bootloader-invert-lines -e -w -v -b 460800 $(FLASHFILE) else ifeq ($(PROGRAMMER),jlink) - export FLASHER = $(RIOTBOARD)/$(BOARD)/dist/flash.sh - export FFLAGS = $(BINDIR) $(FLASHFILE) + FLASHER = $(RIOTBOARD)/$(BOARD)/dist/flash.sh + FFLAGS = $(BINDIR) $(FLASHFILE) export DEBUGGER = $(RIOTBOARD)/$(BOARD)/dist/debug.sh export DEBUGSERVER = JLinkGDBServer -device CC2538SF53 export RESET = $(RIOTBOARD)/$(BOARD)/dist/reset.sh diff --git a/boards/openmote-cc2538/Makefile.include b/boards/openmote-cc2538/Makefile.include index 5c7c30b6f0..d77f06b787 100644 --- a/boards/openmote-cc2538/Makefile.include +++ b/boards/openmote-cc2538/Makefile.include @@ -18,8 +18,8 @@ ifeq ($(PROGRAMMER),jlink) include $(RIOTMAKE)/tools/jlink.inc.mk else FLASHFILE ?= $(BINFILE) - export FLASHER = $(RIOTTOOLS)/cc2538-bsl/cc2538-bsl.py - export FFLAGS = -p "$(PORT)" -e -w -v -b 460800 $(FLASHFILE) + FLASHER = $(RIOTTOOLS)/cc2538-bsl/cc2538-bsl.py + FFLAGS = -p "$(PORT)" -e -w -v -b 460800 $(FLASHFILE) endif # setup serial terminal diff --git a/boards/spark-core/Makefile.include b/boards/spark-core/Makefile.include index cd71cdea80..f7fd5f65c8 100644 --- a/boards/spark-core/Makefile.include +++ b/boards/spark-core/Makefile.include @@ -7,12 +7,12 @@ PORT_LINUX ?= /dev/ttyUSB0 PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.SLAB_USBtoUART*))) include $(RIOTMAKE)/tools/serial.inc.mk -export FLASHER = dfu-util +FLASHER = dfu-util export DEBUGGER = # spark core has no debugger export RESET = # dfu-util has no support for resetting the device HEXFILE = $(BINFILE) -export FFLAGS = -d 1d50:607f -a 0 -s 0x08005000:leave -D "$(HEXFILE)" +FFLAGS = -d 1d50:607f -a 0 -s 0x08005000:leave -D "$(HEXFILE)" # Skip the space needed by the embedded bootloader export ROM_OFFSET ?= 0x5000 diff --git a/boards/telosb/Makefile.include b/boards/telosb/Makefile.include index 1133e7fd73..f3a088913f 100644 --- a/boards/telosb/Makefile.include +++ b/boards/telosb/Makefile.include @@ -10,5 +10,5 @@ export BAUD ?= 9600 include $(RIOTMAKE)/tools/serial.inc.mk # flash tool configuration -export FLASHER = $(RIOTTOOLS)/goodfet/goodfet.bsl -export FFLAGS = --telosb -c $(PORT) -r -e -I -p $(HEXFILE) +FLASHER = $(RIOTTOOLS)/goodfet/goodfet.bsl +FFLAGS = --telosb -c $(PORT) -r -e -I -p $(HEXFILE) diff --git a/boards/z1/Makefile.include b/boards/z1/Makefile.include index 2f64e0af73..7d99332157 100644 --- a/boards/z1/Makefile.include +++ b/boards/z1/Makefile.include @@ -9,5 +9,5 @@ PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.SLAB_USBtoUART*))) include $(RIOTMAKE)/tools/serial.inc.mk # setup flash tool -export FLASHER = $(RIOTTOOLS)/goodfet/goodfet.bsl -export FFLAGS = --z1 -I -c $(PORT) -r -e -p $(HEXFILE) +FLASHER = $(RIOTTOOLS)/goodfet/goodfet.bsl +FFLAGS = --z1 -I -c $(PORT) -r -e -p $(HEXFILE) diff --git a/cpu/esp32/Makefile.include b/cpu/esp32/Makefile.include index 79beae95be..922bac0c43 100644 --- a/cpu/esp32/Makefile.include +++ b/cpu/esp32/Makefile.include @@ -161,24 +161,24 @@ export FLASHDEPS = preflash # flasher configuration ifeq ($(QEMU), 1) - export FLASHER = dd - export FFLAGS += if=/dev/zero bs=1M count=4 | tr "\\000" "\\377" > tmp.bin && cat tmp.bin | - export FFLAGS += head -c $$((0x1000)) | - export FFLAGS += cat - $(RIOTCPU)/$(CPU)/bin/bootloader.bin tmp.bin | - export FFLAGS += head -c $$((0x8000)) | - export FFLAGS += cat - $(BINDIR)/partitions.bin tmp.bin | - export FFLAGS += head -c $$((0x10000)) | - export FFLAGS += cat - $(ELFFILE).bin tmp.bin | - export FFLAGS += head -c $$((0x400000)) > $(BINDIR)/esp32flash.bin && rm tmp.bin && - export FFLAGS += cp $(RIOTCPU)/$(CPU)/bin/rom_0x3ff90000_0x00010000.bin $(BINDIR)/rom1.bin && - export FFLAGS += cp $(RIOTCPU)/$(CPU)/bin/rom_0x40000000_0x000c2000.bin $(BINDIR)/rom.bin + FLASHER = dd + FFLAGS += if=/dev/zero bs=1M count=4 | tr "\\000" "\\377" > tmp.bin && cat tmp.bin | + FFLAGS += head -c $$((0x1000)) | + FFLAGS += cat - $(RIOTCPU)/$(CPU)/bin/bootloader.bin tmp.bin | + FFLAGS += head -c $$((0x8000)) | + FFLAGS += cat - $(BINDIR)/partitions.bin tmp.bin | + FFLAGS += head -c $$((0x10000)) | + FFLAGS += cat - $(ELFFILE).bin tmp.bin | + FFLAGS += head -c $$((0x400000)) > $(BINDIR)/esp32flash.bin && rm tmp.bin && + FFLAGS += cp $(RIOTCPU)/$(CPU)/bin/rom_0x3ff90000_0x00010000.bin $(BINDIR)/rom1.bin && + FFLAGS += cp $(RIOTCPU)/$(CPU)/bin/rom_0x40000000_0x000c2000.bin $(BINDIR)/rom.bin else export PROGRAMMER_SPEED ?= 460800 - export FLASHER = $(ESPTOOL) - export FFLAGS += --chip esp32 -p $(PORT) -b $(PROGRAMMER_SPEED) - export FFLAGS += --before default_reset --after hard_reset write_flash - export FFLAGS += -z -fm $(FLASH_MODE) -fs detect -ff $(FLASH_FREQ) - export FFLAGS += 0x1000 $(RIOTCPU)/$(CPU)/bin/bootloader.bin - export FFLAGS += 0x8000 $(BINDIR)/partitions.bin - export FFLAGS += 0x10000 $(ELFFILE).bin + FLASHER = $(ESPTOOL) + FFLAGS += --chip esp32 -p $(PORT) -b $(PROGRAMMER_SPEED) + FFLAGS += --before default_reset --after hard_reset write_flash + FFLAGS += -z -fm $(FLASH_MODE) -fs detect -ff $(FLASH_FREQ) + FFLAGS += 0x1000 $(RIOTCPU)/$(CPU)/bin/bootloader.bin + FFLAGS += 0x8000 $(BINDIR)/partitions.bin + FFLAGS += 0x10000 $(ELFFILE).bin endif diff --git a/cpu/esp8266/Makefile.include b/cpu/esp8266/Makefile.include index e90a4eb6b5..316d2181cb 100644 --- a/cpu/esp8266/Makefile.include +++ b/cpu/esp8266/Makefile.include @@ -137,16 +137,16 @@ export FLASHDEPS ?= preflash # flasher configuration ifeq ($(QEMU), 1) - export FLASHER = cat - export FFLAGS += $(ELFFILE)-0x00000.bin /dev/zero | head -c $$((0x10000)) | cat - - export FFLAGS += $(ELFFILE)-0x10000.bin /dev/zero | head -c $$((0xfc000)) | cat - - export FFLAGS += $(RIOTCPU)/$(CPU)/bin/esp_init_data_default.bin > $(ELFFILE).bin + FLASHER = cat + FFLAGS += $(ELFFILE)-0x00000.bin /dev/zero | head -c $$((0x10000)) | cat - + FFLAGS += $(ELFFILE)-0x10000.bin /dev/zero | head -c $$((0xfc000)) | cat - + FFLAGS += $(RIOTCPU)/$(CPU)/bin/esp_init_data_default.bin > $(ELFFILE).bin else FLASH_MODE ?= dout export PROGRAMMER_SPEED ?= 460800 - export FLASHER = esptool.py - export FFLAGS += -p $(PORT) -b $(PROGRAMMER_SPEED) write_flash - export FFLAGS += -fm $(FLASH_MODE) - export FFLAGS += 0 $(ELFFILE)-0x00000.bin - export FFLAGS += 0x10000 $(ELFFILE)-0x10000.bin; esptool.py -p $(PORT) run + FLASHER = esptool.py + FFLAGS += -p $(PORT) -b $(PROGRAMMER_SPEED) write_flash + FFLAGS += -fm $(FLASH_MODE) + FFLAGS += 0 $(ELFFILE)-0x00000.bin + FFLAGS += 0x10000 $(ELFFILE)-0x10000.bin; esptool.py -p $(PORT) run endif diff --git a/makefiles/tools/bossa.inc.mk b/makefiles/tools/bossa.inc.mk index b98eee54da..b755a9053a 100644 --- a/makefiles/tools/bossa.inc.mk +++ b/makefiles/tools/bossa.inc.mk @@ -1,5 +1,5 @@ -export FLASHER ?= $(RIOTTOOLS)/bossa/bossac -export FFLAGS ?= -p $(PORT) -e -i -w -v -b -R $(HEXFILE) +FLASHER ?= $(RIOTTOOLS)/bossa/bossac +FFLAGS ?= -p $(PORT) -e -i -w -v -b -R $(HEXFILE) HEXFILE = $(BINFILE) diff --git a/makefiles/tools/jlink.inc.mk b/makefiles/tools/jlink.inc.mk index 61abdd1290..ed65bc4610 100644 --- a/makefiles/tools/jlink.inc.mk +++ b/makefiles/tools/jlink.inc.mk @@ -1,11 +1,11 @@ -export FLASHER = $(RIOTTOOLS)/jlink/jlink.sh +FLASHER = $(RIOTTOOLS)/jlink/jlink.sh export DEBUGGER = $(RIOTTOOLS)/jlink/jlink.sh export DEBUGSERVER = $(RIOTTOOLS)/jlink/jlink.sh export RESET = $(RIOTTOOLS)/jlink/jlink.sh FLASHFILE ?= $(BINFILE) -export FFLAGS ?= flash $(FLASHFILE) +FFLAGS ?= flash $(FLASHFILE) export DEBUGGER_FLAGS ?= debug $(ELFFILE) export DEBUGSERVER_FLAGS ?= debug-server export RESET_FLAGS ?= reset diff --git a/makefiles/tools/openocd.inc.mk b/makefiles/tools/openocd.inc.mk index 74709c59e4..7d2187961c 100644 --- a/makefiles/tools/openocd.inc.mk +++ b/makefiles/tools/openocd.inc.mk @@ -1,10 +1,10 @@ -export FLASHER ?= $(RIOTTOOLS)/openocd/openocd.sh +FLASHER ?= $(RIOTTOOLS)/openocd/openocd.sh export DEBUGGER = $(RIOTTOOLS)/openocd/openocd.sh export DEBUGSERVER = $(RIOTTOOLS)/openocd/openocd.sh export RESET ?= $(RIOTTOOLS)/openocd/openocd.sh FLASHFILE ?= $(ELFFILE) -export FFLAGS ?= flash $(FLASHFILE) +FFLAGS ?= flash $(FLASHFILE) export DEBUGGER_FLAGS ?= debug $(ELFFILE) export DEBUGSERVER_FLAGS ?= debug-server export RESET_FLAGS ?= reset diff --git a/makefiles/tools/pyocd.inc.mk b/makefiles/tools/pyocd.inc.mk index 998a1eff1b..4b66b5d9d2 100644 --- a/makefiles/tools/pyocd.inc.mk +++ b/makefiles/tools/pyocd.inc.mk @@ -1,10 +1,10 @@ -export FLASHER ?= $(RIOTBASE)/dist/tools/pyocd/pyocd.sh +FLASHER ?= $(RIOTBASE)/dist/tools/pyocd/pyocd.sh export DEBUGGER = $(RIOTBASE)/dist/tools/pyocd/pyocd.sh export DEBUGSERVER = $(RIOTBASE)/dist/tools/pyocd/pyocd.sh export RESET ?= $(RIOTBASE)/dist/tools/pyocd/pyocd.sh export OFLAGS ?= -O ihex -export FFLAGS ?= flash $(HEXFILE) +FFLAGS ?= flash $(HEXFILE) export DEBUGGER_FLAGS ?= debug $(ELFFILE) export DEBUGSERVER_FLAGS ?= debug-server export RESET_FLAGS ?= reset diff --git a/makefiles/tools/uniflash.inc.mk b/makefiles/tools/uniflash.inc.mk index f2aebbd17c..70ae9617d8 100644 --- a/makefiles/tools/uniflash.inc.mk +++ b/makefiles/tools/uniflash.inc.mk @@ -4,8 +4,8 @@ FLASHFILE ?= $(ELFFILE) export UNIFLASH_PATH ?= "UNIFLASH_PATH unconfigured" # check which uniflash version is available, either 4.x or 3.x ifneq ("$(wildcard $(UNIFLASH_PATH)/dslite.sh)","") - export FLASHER ?= $(UNIFLASH_PATH)/dslite.sh - export FFLAGS = --config $(RIOTBOARD)/$(BOARD)/dist/$(CPU_MODEL)_$(XDEBUGGER).ccxml $(FLASHFILE) + FLASHER ?= $(UNIFLASH_PATH)/dslite.sh + FFLAGS = --config $(RIOTBOARD)/$(BOARD)/dist/$(CPU_MODEL)_$(XDEBUGGER).ccxml $(FLASHFILE) # configure uniflash for resetting target # xds110reset path changed in version UniFlash v4.4.0 # Try to detect the newest one and fallback to only 'xds110reset' @@ -15,8 +15,8 @@ ifneq ("$(wildcard $(UNIFLASH_PATH)/dslite.sh)","") export RESET = $(XDS110RESET) export RESET_FLAGS else - export FLASHER = $(UNIFLASH_PATH)/uniflash.sh - export FFLAGS = -ccxml $(RIOTBOARD)/$(BOARD)/dist/$(CPU_MODEL)_$(XDEBUGGER).ccxml -program $(FLASHFILE) + FLASHER = $(UNIFLASH_PATH)/uniflash.sh + FFLAGS = -ccxml $(RIOTBOARD)/$(BOARD)/dist/$(CPU_MODEL)_$(XDEBUGGER).ccxml -program $(FLASHFILE) # configure uniflash for resetting target export RESET = $(UNIFLASH_PATH)/uniflash.sh export RESET_FLAGS = -ccxml $(RIOTBOARD)/$(BOARD)/dist/$(CPU_MODEL)_$(XDEBUGGER).ccxml -reset diff --git a/makefiles/vars.inc.mk b/makefiles/vars.inc.mk index bff4d74f52..9bc64995de 100644 --- a/makefiles/vars.inc.mk +++ b/makefiles/vars.inc.mk @@ -69,8 +69,8 @@ export WERROR # Treat all compiler warnings as errors if set to 1 export GITCACHE # path to git-cache executable export GIT_CACHE_DIR # path to git-cache cache directory -export FLASHER # The command to call on "make flash". -export FFLAGS # The parameters to supply to FLASHER. +# FLASHER # The command to call on "make flash". +# FFLAGS # The parameters to supply to FLASHER. export FLASH_ADDR # Define an offset to flash code into ROM memory. # TERMPROG # The command to call on "make term". # TERMFLAGS # Additional parameters to supply to TERMPROG. From 95c07c507c157ea54049e3acce35b97448e9e364 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Harter?= Date: Fri, 17 May 2019 13:56:49 +0200 Subject: [PATCH 03/10] dist/tools/buildsystem_sanity_check: check no FLASHER/FFLAGS exports Add sanity check for removed exports. --- dist/tools/buildsystem_sanity_check/check.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/dist/tools/buildsystem_sanity_check/check.sh b/dist/tools/buildsystem_sanity_check/check.sh index 05f84b6c28..f1dea7526e 100755 --- a/dist/tools/buildsystem_sanity_check/check.sh +++ b/dist/tools/buildsystem_sanity_check/check.sh @@ -50,6 +50,7 @@ check_not_parsing_features() { UNEXPORTED_VARIABLES=() UNEXPORTED_VARIABLES+=('FLASHFILE') UNEXPORTED_VARIABLES+=('TERMPROG' 'TERMFLAGS') +UNEXPORTED_VARIABLES+=('FLASHER' 'FFLAGS') EXPORTED_VARIABLES_ONLY_IN_VARS=() check_not_exporting_variables() { From b88d1887c8317b8cccc20671ec156298fb573e4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Harter?= Date: Fri, 17 May 2019 13:52:34 +0200 Subject: [PATCH 04/10] boards/tools: remove exporting RESET/RESET_FLAGS RESET and RESET_FLAGS are evaluated by the main Makefile.include or by file included by it. Their value does not need to be exported. This will also prevent evaluating 'PORT' for RESET_FLAGS when not needed. Testing ------- `git diff --word-diff` only reports `export` being removed. `git show --stat` reports `24 insertions(+), 24 deletions(-)` Which is the same amount as lines that where matching `export[[:blank::]]\+VARIABLE`. --- boards/cc2538dk/Makefile.include | 4 ++-- boards/common/esp32/Makefile.include | 2 +- boards/common/esp8266/Makefile.include | 2 +- boards/common/remote/Makefile.include | 6 +++--- boards/common/stm32f103c8/Makefile.include | 2 +- boards/nz32-sc151/Makefile.include | 2 +- boards/openmote-b/Makefile.include | 4 ++-- boards/spark-core/Makefile.include | 2 +- makefiles/tools/jlink.inc.mk | 4 ++-- makefiles/tools/openocd.inc.mk | 4 ++-- makefiles/tools/pyocd.inc.mk | 4 ++-- makefiles/tools/uniflash.inc.mk | 8 ++++---- makefiles/vars.inc.mk | 4 ++-- 13 files changed, 24 insertions(+), 24 deletions(-) diff --git a/boards/cc2538dk/Makefile.include b/boards/cc2538dk/Makefile.include index f0df568dbd..7006ad5d2b 100644 --- a/boards/cc2538dk/Makefile.include +++ b/boards/cc2538dk/Makefile.include @@ -17,7 +17,7 @@ include $(RIOTMAKE)/tools/renode.inc.mk # debugger config export DEBUGGER = $(RIOTBOARD)/$(BOARD)/dist/debug.sh export DEBUGSERVER = JLinkGDBServer -device CC2538SF53 -export RESET = $(RIOTBOARD)/$(BOARD)/dist/reset.sh +RESET = $(RIOTBOARD)/$(BOARD)/dist/reset.sh # Define the flash-tool and default port: export PROGRAMMER ?= cc2538-bsl @@ -33,6 +33,6 @@ endif OFLAGS = --gap-fill 0xff FLASHFILE ?= $(BINFILE) export DEBUGGER_FLAGS = $(BINDIR) $(ELFFILE) -export RESET_FLAGS = $(BINDIR) +RESET_FLAGS = $(BINDIR) export OBJDUMPFLAGS += --disassemble --source --disassembler-options=force-thumb diff --git a/boards/common/esp32/Makefile.include b/boards/common/esp32/Makefile.include index 2ce4a3dbea..0fb3fb3c25 100644 --- a/boards/common/esp32/Makefile.include +++ b/boards/common/esp32/Makefile.include @@ -8,4 +8,4 @@ PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.SLAB_USBtoUART*))) include $(RIOTMAKE)/tools/serial.inc.mk # reset tool configuration -export RESET = esptool.py --before default_reset run +RESET = esptool.py --before default_reset run diff --git a/boards/common/esp8266/Makefile.include b/boards/common/esp8266/Makefile.include index 5460a7fd32..4c60974b9a 100644 --- a/boards/common/esp8266/Makefile.include +++ b/boards/common/esp8266/Makefile.include @@ -8,4 +8,4 @@ PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.SLAB_USBtoUART*))) include $(RIOTMAKE)/tools/serial.inc.mk # reset tool configuration -export RESET = esptool.py --before default_reset run +RESET = esptool.py --before default_reset run diff --git a/boards/common/remote/Makefile.include b/boards/common/remote/Makefile.include index 36f226285d..fc96393fa5 100644 --- a/boards/common/remote/Makefile.include +++ b/boards/common/remote/Makefile.include @@ -12,7 +12,7 @@ ifeq ($(PROGRAMMER),cc2538-bsl) else ifeq ($(OS),Darwin) PORT_BSL ?= $(PORT_DARWIN) endif - export RESET = $(RIOTTOOLS)/cc2538-bsl/cc2538-bsl.py -p "$(PORT_BSL)" + RESET = $(RIOTTOOLS)/cc2538-bsl/cc2538-bsl.py -p "$(PORT_BSL)" FLASHER = $(RIOTTOOLS)/cc2538-bsl/cc2538-bsl.py FFLAGS = -p "$(PORT_BSL)" -e -w -v -b 115200 $(FLASHFILE) else ifeq ($(PROGRAMMER),jlink) @@ -20,8 +20,8 @@ else ifeq ($(PROGRAMMER),jlink) FFLAGS = $(BINDIR) $(FLASHFILE) export DEBUGGER = $(RIOTBOARD)/common/remote/dist/debug.sh export DEBUGSERVER = JLinkGDBServer -device CC2538SF53 - export RESET = $(RIOTBOARD)/common/remote/dist/reset.sh - export RESET_FLAGS = $(BINDIR) + RESET = $(RIOTBOARD)/common/remote/dist/reset.sh + RESET_FLAGS = $(BINDIR) endif OFLAGS = --gap-fill 0xff diff --git a/boards/common/stm32f103c8/Makefile.include b/boards/common/stm32f103c8/Makefile.include index 682b144dc9..701a761753 100644 --- a/boards/common/stm32f103c8/Makefile.include +++ b/boards/common/stm32f103c8/Makefile.include @@ -25,7 +25,7 @@ ifeq ($(PROGRAMMER),dfu-util) export ROM_OFFSET ?= 0x2000 # Skip the space needed by the embedded bootloader FLASHER = dfu-util export DEBUGGER = # no debugger - export RESET = # dfu-util has no support for resetting the device + RESET = # dfu-util has no support for resetting the device HEXFILE = $(BINFILE) FFLAGS = -d 1eaf:0003 -a 2 -D "$(HEXFILE)" diff --git a/boards/nz32-sc151/Makefile.include b/boards/nz32-sc151/Makefile.include index d2844aa46b..3ca9bbb74c 100644 --- a/boards/nz32-sc151/Makefile.include +++ b/boards/nz32-sc151/Makefile.include @@ -11,7 +11,7 @@ export ID ?= 0483:df11 FLASHER = dfu-util export DEBUGGER = # dfu-util has no debugger -export RESET = # dfu-util has no support for resetting the device +RESET = # dfu-util has no support for resetting the device HEXFILE = $(BINFILE) FFLAGS = -d $(ID) -a 0 -s 0x08000000:leave -D "$(HEXFILE)" diff --git a/boards/openmote-b/Makefile.include b/boards/openmote-b/Makefile.include index 46f0c2bd08..0a01ef0f5f 100644 --- a/boards/openmote-b/Makefile.include +++ b/boards/openmote-b/Makefile.include @@ -23,12 +23,12 @@ else ifeq ($(PROGRAMMER),jlink) FFLAGS = $(BINDIR) $(FLASHFILE) export DEBUGGER = $(RIOTBOARD)/$(BOARD)/dist/debug.sh export DEBUGSERVER = JLinkGDBServer -device CC2538SF53 - export RESET = $(RIOTBOARD)/$(BOARD)/dist/reset.sh + RESET = $(RIOTBOARD)/$(BOARD)/dist/reset.sh endif FLASHFILE ?= $(BINFILE) export DEBUGGER_FLAGS = $(BINDIR) $(ELFFILE) -export RESET_FLAGS = $(BINDIR) +RESET_FLAGS = $(BINDIR) export OBJDUMPFLAGS += --disassemble --source --disassembler-options=force-thumb # setup serial terminal diff --git a/boards/spark-core/Makefile.include b/boards/spark-core/Makefile.include index f7fd5f65c8..eac6a0fd74 100644 --- a/boards/spark-core/Makefile.include +++ b/boards/spark-core/Makefile.include @@ -9,7 +9,7 @@ include $(RIOTMAKE)/tools/serial.inc.mk FLASHER = dfu-util export DEBUGGER = # spark core has no debugger -export RESET = # dfu-util has no support for resetting the device +RESET = # dfu-util has no support for resetting the device HEXFILE = $(BINFILE) FFLAGS = -d 1d50:607f -a 0 -s 0x08005000:leave -D "$(HEXFILE)" diff --git a/makefiles/tools/jlink.inc.mk b/makefiles/tools/jlink.inc.mk index ed65bc4610..7e330e851d 100644 --- a/makefiles/tools/jlink.inc.mk +++ b/makefiles/tools/jlink.inc.mk @@ -1,11 +1,11 @@ FLASHER = $(RIOTTOOLS)/jlink/jlink.sh export DEBUGGER = $(RIOTTOOLS)/jlink/jlink.sh export DEBUGSERVER = $(RIOTTOOLS)/jlink/jlink.sh -export RESET = $(RIOTTOOLS)/jlink/jlink.sh +RESET = $(RIOTTOOLS)/jlink/jlink.sh FLASHFILE ?= $(BINFILE) FFLAGS ?= flash $(FLASHFILE) export DEBUGGER_FLAGS ?= debug $(ELFFILE) export DEBUGSERVER_FLAGS ?= debug-server -export RESET_FLAGS ?= reset +RESET_FLAGS ?= reset diff --git a/makefiles/tools/openocd.inc.mk b/makefiles/tools/openocd.inc.mk index 7d2187961c..25b8b9a2f6 100644 --- a/makefiles/tools/openocd.inc.mk +++ b/makefiles/tools/openocd.inc.mk @@ -1,13 +1,13 @@ FLASHER ?= $(RIOTTOOLS)/openocd/openocd.sh export DEBUGGER = $(RIOTTOOLS)/openocd/openocd.sh export DEBUGSERVER = $(RIOTTOOLS)/openocd/openocd.sh -export RESET ?= $(RIOTTOOLS)/openocd/openocd.sh +RESET ?= $(RIOTTOOLS)/openocd/openocd.sh FLASHFILE ?= $(ELFFILE) FFLAGS ?= flash $(FLASHFILE) export DEBUGGER_FLAGS ?= debug $(ELFFILE) export DEBUGSERVER_FLAGS ?= debug-server -export RESET_FLAGS ?= reset +RESET_FLAGS ?= reset ifneq (,$(DEBUG_ADAPTER)) include $(RIOTMAKE)/tools/openocd-adapters/$(DEBUG_ADAPTER).inc.mk diff --git a/makefiles/tools/pyocd.inc.mk b/makefiles/tools/pyocd.inc.mk index 4b66b5d9d2..8496354bb0 100644 --- a/makefiles/tools/pyocd.inc.mk +++ b/makefiles/tools/pyocd.inc.mk @@ -1,10 +1,10 @@ FLASHER ?= $(RIOTBASE)/dist/tools/pyocd/pyocd.sh export DEBUGGER = $(RIOTBASE)/dist/tools/pyocd/pyocd.sh export DEBUGSERVER = $(RIOTBASE)/dist/tools/pyocd/pyocd.sh -export RESET ?= $(RIOTBASE)/dist/tools/pyocd/pyocd.sh +RESET ?= $(RIOTBASE)/dist/tools/pyocd/pyocd.sh export OFLAGS ?= -O ihex FFLAGS ?= flash $(HEXFILE) export DEBUGGER_FLAGS ?= debug $(ELFFILE) export DEBUGSERVER_FLAGS ?= debug-server -export RESET_FLAGS ?= reset +RESET_FLAGS ?= reset diff --git a/makefiles/tools/uniflash.inc.mk b/makefiles/tools/uniflash.inc.mk index 70ae9617d8..10be610b32 100644 --- a/makefiles/tools/uniflash.inc.mk +++ b/makefiles/tools/uniflash.inc.mk @@ -12,14 +12,14 @@ ifneq ("$(wildcard $(UNIFLASH_PATH)/dslite.sh)","") _XDS110RESET_4_0_4_3 ?= $(UNIFLASH_PATH)/simplelink/gen2/bin/xds110reset _XDS110RESET ?= $(UNIFLASH_PATH)/simplelink/imagecreator/bin/xds110reset XDS110RESET ?= $(firstword $(wildcard $(_XDS110RESET) $(_XDS110RESET_4_0_4_3)) xds110reset) - export RESET = $(XDS110RESET) - export RESET_FLAGS + RESET = $(XDS110RESET) + RESET_FLAGS else FLASHER = $(UNIFLASH_PATH)/uniflash.sh FFLAGS = -ccxml $(RIOTBOARD)/$(BOARD)/dist/$(CPU_MODEL)_$(XDEBUGGER).ccxml -program $(FLASHFILE) # configure uniflash for resetting target - export RESET = $(UNIFLASH_PATH)/uniflash.sh - export RESET_FLAGS = -ccxml $(RIOTBOARD)/$(BOARD)/dist/$(CPU_MODEL)_$(XDEBUGGER).ccxml -reset + RESET = $(UNIFLASH_PATH)/uniflash.sh + RESET_FLAGS = -ccxml $(RIOTBOARD)/$(BOARD)/dist/$(CPU_MODEL)_$(XDEBUGGER).ccxml -reset endif # configure the debug server export DEBUGSERVER = $(UNIFLASH_PATH)/ccs_base/common/uscif/gdb_agent_console diff --git a/makefiles/vars.inc.mk b/makefiles/vars.inc.mk index 9bc64995de..45a057f96b 100644 --- a/makefiles/vars.inc.mk +++ b/makefiles/vars.inc.mk @@ -82,8 +82,8 @@ export DEBUGGER # The command to call on "make debug", usually a sc export DEBUGGER_FLAGS # The parameters to supply to DEBUGGER. export DEBUGSERVER # The command to call on "make debug-server", usually a script starting the GDB server. export DEBUGSERVER_FLAGS # The parameters to supply to DEBUGSERVER. -export RESET # The command to call on "make reset", this command resets/reboots the target. -export RESET_FLAGS # The parameters to supply to RESET. +# RESET # The command to call on "make reset", this command resets/reboots the target. +# RESET_FLAGS # The parameters to supply to RESET. export CCACHE_BASEDIR # ccache basedir, allows multiple riot build # directories to share a ccache directory From 734410b9cd6415522d31fe092bbd792417c8c4f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Harter?= Date: Fri, 17 May 2019 13:56:49 +0200 Subject: [PATCH 05/10] dist/tools/buildsystem_sanity_check: check no RESET/RESET_FLAGS exports Add sanity check for removed exports. --- dist/tools/buildsystem_sanity_check/check.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/dist/tools/buildsystem_sanity_check/check.sh b/dist/tools/buildsystem_sanity_check/check.sh index f1dea7526e..de13e14ab4 100755 --- a/dist/tools/buildsystem_sanity_check/check.sh +++ b/dist/tools/buildsystem_sanity_check/check.sh @@ -51,6 +51,7 @@ UNEXPORTED_VARIABLES=() UNEXPORTED_VARIABLES+=('FLASHFILE') UNEXPORTED_VARIABLES+=('TERMPROG' 'TERMFLAGS') UNEXPORTED_VARIABLES+=('FLASHER' 'FFLAGS') +UNEXPORTED_VARIABLES+=('RESET' 'RESETFLAGS') EXPORTED_VARIABLES_ONLY_IN_VARS=() check_not_exporting_variables() { From 7306dbd3823bc0e9301b171c60bc98928f65fc92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Harter?= Date: Fri, 17 May 2019 13:52:34 +0200 Subject: [PATCH 06/10] boards/tools: remove exporting DEBUG* DEBUGGER/DEBUGGER_FLAGS/DEBUGSERVER/DEBUGSERVER_FLAGS are evaluated by the main Makefile.include or by file included by it. Their value does not need to be exported. Testing ------- `git diff --word-diff` only reports `export` being removed. `git show --stat` reports `55 insertions(+), 55 deletions(-)` Which is the same amount as lines that where matching `export[[:blank::]]\+VARIABLE`. --- boards/calliope-mini/Makefile.include | 6 +++--- boards/cc2538dk/Makefile.include | 6 +++--- boards/common/msb-430/Makefile.include | 8 ++++---- boards/common/remote/Makefile.include | 6 +++--- boards/common/stm32f103c8/Makefile.include | 2 +- boards/f4vi1/Makefile.include | 6 +++--- boards/mbed_lpc1768/Makefile.include | 6 +++--- boards/microbit/Makefile.include | 6 +++--- boards/native/Makefile.include | 8 ++++---- boards/nz32-sc151/Makefile.include | 2 +- boards/opencm904/Makefile.include | 6 +++--- boards/openmote-b/Makefile.include | 6 +++--- boards/spark-core/Makefile.include | 2 +- makefiles/tools/jlink.inc.mk | 8 ++++---- makefiles/tools/openocd.inc.mk | 8 ++++---- makefiles/tools/pyocd.inc.mk | 8 ++++---- makefiles/tools/uniflash.inc.mk | 8 ++++---- makefiles/vars.inc.mk | 8 ++++---- 18 files changed, 55 insertions(+), 55 deletions(-) diff --git a/boards/calliope-mini/Makefile.include b/boards/calliope-mini/Makefile.include index abc3cd143f..a7deba75d0 100644 --- a/boards/calliope-mini/Makefile.include +++ b/boards/calliope-mini/Makefile.include @@ -11,11 +11,11 @@ PROGRAMMER ?= fscopy ifeq (fscopy,$(PROGRAMMER)) FFLAGS = $(HEXFILE) - export DEBUGGER_FLAGS = + DEBUGGER_FLAGS = FLASHER = $(RIOTBOARD)/$(BOARD)/dist/flash.sh - export DEBUGGER = - export DEBUGSERVER = + DEBUGGER = + DEBUGSERVER = else ifeq (openocd,$(PROGRAMMER)) DEBUG_ADAPTER = dap else ifeq (pyocd,$(PROGRAMMER)) diff --git a/boards/cc2538dk/Makefile.include b/boards/cc2538dk/Makefile.include index 7006ad5d2b..91b36cbcc5 100644 --- a/boards/cc2538dk/Makefile.include +++ b/boards/cc2538dk/Makefile.include @@ -15,8 +15,8 @@ include $(RIOTMAKE)/tools/serial.inc.mk include $(RIOTMAKE)/tools/renode.inc.mk # debugger config -export DEBUGGER = $(RIOTBOARD)/$(BOARD)/dist/debug.sh -export DEBUGSERVER = JLinkGDBServer -device CC2538SF53 +DEBUGGER = $(RIOTBOARD)/$(BOARD)/dist/debug.sh +DEBUGSERVER = JLinkGDBServer -device CC2538SF53 RESET = $(RIOTBOARD)/$(BOARD)/dist/reset.sh # Define the flash-tool and default port: @@ -32,7 +32,7 @@ endif OFLAGS = --gap-fill 0xff FLASHFILE ?= $(BINFILE) -export DEBUGGER_FLAGS = $(BINDIR) $(ELFFILE) +DEBUGGER_FLAGS = $(BINDIR) $(ELFFILE) RESET_FLAGS = $(BINDIR) export OBJDUMPFLAGS += --disassemble --source --disassembler-options=force-thumb diff --git a/boards/common/msb-430/Makefile.include b/boards/common/msb-430/Makefile.include index 38d87f9b9f..6a4311f41f 100644 --- a/boards/common/msb-430/Makefile.include +++ b/boards/common/msb-430/Makefile.include @@ -18,10 +18,10 @@ FLASHER ?= mspdebug FFLAGS = $(MSPDEBUGFLAGS) "prog $(HEXFILE)" # setup debugger -export DEBUGSERVER = $(FLASHER) -export DEBUGSERVER_FLAGS = $(MSPDEBUGFLAGS) gdb -export DEBUGGER = $(PREFIX)gdb -export DEBUGGER_FLAGS = --tui --ex="target remote localhost:2000" --ex "monitor reset halt" --ex load -ex "monitor reset halt" $(ELFFILE) +DEBUGSERVER = $(FLASHER) +DEBUGSERVER_FLAGS = $(MSPDEBUGFLAGS) gdb +DEBUGGER = $(PREFIX)gdb +DEBUGGER_FLAGS = --tui --ex="target remote localhost:2000" --ex "monitor reset halt" --ex load -ex "monitor reset halt" $(ELFFILE) # export common msb-430 includes export INCLUDES += -I$(RIOTBOARD)/common/msb-430/include diff --git a/boards/common/remote/Makefile.include b/boards/common/remote/Makefile.include index fc96393fa5..baa8250b4c 100644 --- a/boards/common/remote/Makefile.include +++ b/boards/common/remote/Makefile.include @@ -18,15 +18,15 @@ ifeq ($(PROGRAMMER),cc2538-bsl) else ifeq ($(PROGRAMMER),jlink) FLASHER = $(RIOTBOARD)/common/remote/dist/flash.sh FFLAGS = $(BINDIR) $(FLASHFILE) - export DEBUGGER = $(RIOTBOARD)/common/remote/dist/debug.sh - export DEBUGSERVER = JLinkGDBServer -device CC2538SF53 + DEBUGGER = $(RIOTBOARD)/common/remote/dist/debug.sh + DEBUGSERVER = JLinkGDBServer -device CC2538SF53 RESET = $(RIOTBOARD)/common/remote/dist/reset.sh RESET_FLAGS = $(BINDIR) endif OFLAGS = --gap-fill 0xff FLASHFILE ?= $(BINFILE) -export DEBUGGER_FLAGS = $(BINDIR) $(ELFFILE) +DEBUGGER_FLAGS = $(BINDIR) $(ELFFILE) export OBJDUMPFLAGS += --disassemble --source --disassembler-options=force-thumb # include common remote includes diff --git a/boards/common/stm32f103c8/Makefile.include b/boards/common/stm32f103c8/Makefile.include index 701a761753..120700b236 100644 --- a/boards/common/stm32f103c8/Makefile.include +++ b/boards/common/stm32f103c8/Makefile.include @@ -24,7 +24,7 @@ include $(RIOTMAKE)/tools/serial.inc.mk ifeq ($(PROGRAMMER),dfu-util) export ROM_OFFSET ?= 0x2000 # Skip the space needed by the embedded bootloader FLASHER = dfu-util - export DEBUGGER = # no debugger + DEBUGGER = # no debugger RESET = # dfu-util has no support for resetting the device HEXFILE = $(BINFILE) diff --git a/boards/f4vi1/Makefile.include b/boards/f4vi1/Makefile.include index 5850db4e94..8ac44da078 100644 --- a/boards/f4vi1/Makefile.include +++ b/boards/f4vi1/Makefile.include @@ -14,10 +14,10 @@ include $(RIOTMAKE)/tools/serial.inc.mk # st-flash FLASHER = st-flash -export DEBUGGER = $(RIOTBOARD)/$(BOARD)/dist/debug.sh -export DEBUGSERVER = st-util +DEBUGGER = $(RIOTBOARD)/$(BOARD)/dist/debug.sh +DEBUGSERVER = st-util # define st-flash parameters HEXFILE = $(BINFILE) FFLAGS = write $(HEXFILE) 0x8000000 -export DEBUGGER_FLAGS = $(RIOTBOARD)/$(BOARD)/dist/gdb.conf $(ELFFILE) +DEBUGGER_FLAGS = $(RIOTBOARD)/$(BOARD)/dist/gdb.conf $(ELFFILE) diff --git a/boards/mbed_lpc1768/Makefile.include b/boards/mbed_lpc1768/Makefile.include index e3cb716df8..41c33bcd87 100644 --- a/boards/mbed_lpc1768/Makefile.include +++ b/boards/mbed_lpc1768/Makefile.include @@ -2,12 +2,12 @@ export CPU = lpc1768 FLASHER = $(RIOTBOARD)/$(BOARD)/dist/flash.sh -export DEBUGGER = -export DEBUGSERVER = +DEBUGGER = +DEBUGSERVER = HEXFILE = $(BINFILE) FFLAGS = $(HEXFILE) -export DEBUGGER_FLAGS = +DEBUGGER_FLAGS = # define the default port depending on the host OS PORT_LINUX ?= /dev/ttyACM0 diff --git a/boards/microbit/Makefile.include b/boards/microbit/Makefile.include index 053ec22fd9..496edb3d1b 100644 --- a/boards/microbit/Makefile.include +++ b/boards/microbit/Makefile.include @@ -11,11 +11,11 @@ PROGRAMMER ?= fscopy ifeq (fscopy,$(PROGRAMMER)) FFLAGS = $(HEXFILE) - export DEBUGGER_FLAGS = + DEBUGGER_FLAGS = FLASHER = $(RIOTBOARD)/$(BOARD)/dist/flash.sh - export DEBUGGER = - export DEBUGSERVER = + DEBUGGER = + DEBUGSERVER = else ifeq (openocd,$(PROGRAMMER)) # this board uses a daplink adapter by default DEBUG_ADAPTER = dap diff --git a/boards/native/Makefile.include b/boards/native/Makefile.include index d3cd5bc000..9ee94c3eb3 100644 --- a/boards/native/Makefile.include +++ b/boards/native/Makefile.include @@ -35,9 +35,9 @@ else endif ifeq ($(shell uname -s),Darwin) - export DEBUGGER ?= lldb + DEBUGGER ?= lldb else - export DEBUGGER ?= gdb + DEBUGGER ?= gdb endif TERMPROG ?= $(ELFFILE) @@ -104,9 +104,9 @@ TERMFLAGS := $(PORT) $(TERMFLAGS) export ASFLAGS = ifeq ($(shell basename $(DEBUGGER)),lldb) - export DEBUGGER_FLAGS = -- $(ELFFILE) $(TERMFLAGS) + DEBUGGER_FLAGS = -- $(ELFFILE) $(TERMFLAGS) else - export DEBUGGER_FLAGS = -q --args $(ELFFILE) $(TERMFLAGS) + DEBUGGER_FLAGS = -q --args $(ELFFILE) $(TERMFLAGS) endif term-valgrind: export VALGRIND_FLAGS ?= \ --leak-check=full \ diff --git a/boards/nz32-sc151/Makefile.include b/boards/nz32-sc151/Makefile.include index 3ca9bbb74c..2e780acaee 100644 --- a/boards/nz32-sc151/Makefile.include +++ b/boards/nz32-sc151/Makefile.include @@ -10,7 +10,7 @@ PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.SLAB_USBtoUART*))) export ID ?= 0483:df11 FLASHER = dfu-util -export DEBUGGER = # dfu-util has no debugger +DEBUGGER = # dfu-util has no debugger RESET = # dfu-util has no support for resetting the device HEXFILE = $(BINFILE) diff --git a/boards/opencm904/Makefile.include b/boards/opencm904/Makefile.include index 0078a18468..3f04b4aec5 100644 --- a/boards/opencm904/Makefile.include +++ b/boards/opencm904/Makefile.include @@ -4,12 +4,12 @@ export CPU_MODEL = stm32f103cb # custom flasher to use with the bootloader FLASHER = $(RIOTBOARD)/$(BOARD)/dist/robotis-loader.py -export DEBUGGER = -export DEBUGSERVER = +DEBUGGER = +DEBUGSERVER = HEXFILE = $(BINFILE) FFLAGS = $(PORT) $(HEXFILE) -export DEBUGGER_FLAGS = +DEBUGGER_FLAGS = # define the default port depending on the host OS PORT_LINUX ?= /dev/ttyACM0 diff --git a/boards/openmote-b/Makefile.include b/boards/openmote-b/Makefile.include index 0a01ef0f5f..49978e45ce 100644 --- a/boards/openmote-b/Makefile.include +++ b/boards/openmote-b/Makefile.include @@ -21,13 +21,13 @@ ifeq ($(PROGRAMMER),cc2538-bsl) else ifeq ($(PROGRAMMER),jlink) FLASHER = $(RIOTBOARD)/$(BOARD)/dist/flash.sh FFLAGS = $(BINDIR) $(FLASHFILE) - export DEBUGGER = $(RIOTBOARD)/$(BOARD)/dist/debug.sh - export DEBUGSERVER = JLinkGDBServer -device CC2538SF53 + DEBUGGER = $(RIOTBOARD)/$(BOARD)/dist/debug.sh + DEBUGSERVER = JLinkGDBServer -device CC2538SF53 RESET = $(RIOTBOARD)/$(BOARD)/dist/reset.sh endif FLASHFILE ?= $(BINFILE) -export DEBUGGER_FLAGS = $(BINDIR) $(ELFFILE) +DEBUGGER_FLAGS = $(BINDIR) $(ELFFILE) RESET_FLAGS = $(BINDIR) export OBJDUMPFLAGS += --disassemble --source --disassembler-options=force-thumb diff --git a/boards/spark-core/Makefile.include b/boards/spark-core/Makefile.include index eac6a0fd74..6203e36a80 100644 --- a/boards/spark-core/Makefile.include +++ b/boards/spark-core/Makefile.include @@ -8,7 +8,7 @@ PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.SLAB_USBtoUART*))) include $(RIOTMAKE)/tools/serial.inc.mk FLASHER = dfu-util -export DEBUGGER = # spark core has no debugger +DEBUGGER = # spark core has no debugger RESET = # dfu-util has no support for resetting the device HEXFILE = $(BINFILE) diff --git a/makefiles/tools/jlink.inc.mk b/makefiles/tools/jlink.inc.mk index 7e330e851d..b7f04be2fc 100644 --- a/makefiles/tools/jlink.inc.mk +++ b/makefiles/tools/jlink.inc.mk @@ -1,11 +1,11 @@ FLASHER = $(RIOTTOOLS)/jlink/jlink.sh -export DEBUGGER = $(RIOTTOOLS)/jlink/jlink.sh -export DEBUGSERVER = $(RIOTTOOLS)/jlink/jlink.sh +DEBUGGER = $(RIOTTOOLS)/jlink/jlink.sh +DEBUGSERVER = $(RIOTTOOLS)/jlink/jlink.sh RESET = $(RIOTTOOLS)/jlink/jlink.sh FLASHFILE ?= $(BINFILE) FFLAGS ?= flash $(FLASHFILE) -export DEBUGGER_FLAGS ?= debug $(ELFFILE) -export DEBUGSERVER_FLAGS ?= debug-server +DEBUGGER_FLAGS ?= debug $(ELFFILE) +DEBUGSERVER_FLAGS ?= debug-server RESET_FLAGS ?= reset diff --git a/makefiles/tools/openocd.inc.mk b/makefiles/tools/openocd.inc.mk index 25b8b9a2f6..b478ab2711 100644 --- a/makefiles/tools/openocd.inc.mk +++ b/makefiles/tools/openocd.inc.mk @@ -1,12 +1,12 @@ FLASHER ?= $(RIOTTOOLS)/openocd/openocd.sh -export DEBUGGER = $(RIOTTOOLS)/openocd/openocd.sh -export DEBUGSERVER = $(RIOTTOOLS)/openocd/openocd.sh +DEBUGGER = $(RIOTTOOLS)/openocd/openocd.sh +DEBUGSERVER = $(RIOTTOOLS)/openocd/openocd.sh RESET ?= $(RIOTTOOLS)/openocd/openocd.sh FLASHFILE ?= $(ELFFILE) FFLAGS ?= flash $(FLASHFILE) -export DEBUGGER_FLAGS ?= debug $(ELFFILE) -export DEBUGSERVER_FLAGS ?= debug-server +DEBUGGER_FLAGS ?= debug $(ELFFILE) +DEBUGSERVER_FLAGS ?= debug-server RESET_FLAGS ?= reset ifneq (,$(DEBUG_ADAPTER)) diff --git a/makefiles/tools/pyocd.inc.mk b/makefiles/tools/pyocd.inc.mk index 8496354bb0..f8ba7c6547 100644 --- a/makefiles/tools/pyocd.inc.mk +++ b/makefiles/tools/pyocd.inc.mk @@ -1,10 +1,10 @@ FLASHER ?= $(RIOTBASE)/dist/tools/pyocd/pyocd.sh -export DEBUGGER = $(RIOTBASE)/dist/tools/pyocd/pyocd.sh -export DEBUGSERVER = $(RIOTBASE)/dist/tools/pyocd/pyocd.sh +DEBUGGER = $(RIOTBASE)/dist/tools/pyocd/pyocd.sh +DEBUGSERVER = $(RIOTBASE)/dist/tools/pyocd/pyocd.sh RESET ?= $(RIOTBASE)/dist/tools/pyocd/pyocd.sh export OFLAGS ?= -O ihex FFLAGS ?= flash $(HEXFILE) -export DEBUGGER_FLAGS ?= debug $(ELFFILE) -export DEBUGSERVER_FLAGS ?= debug-server +DEBUGGER_FLAGS ?= debug $(ELFFILE) +DEBUGSERVER_FLAGS ?= debug-server RESET_FLAGS ?= reset diff --git a/makefiles/tools/uniflash.inc.mk b/makefiles/tools/uniflash.inc.mk index 10be610b32..91f315754c 100644 --- a/makefiles/tools/uniflash.inc.mk +++ b/makefiles/tools/uniflash.inc.mk @@ -22,9 +22,9 @@ else RESET_FLAGS = -ccxml $(RIOTBOARD)/$(BOARD)/dist/$(CPU_MODEL)_$(XDEBUGGER).ccxml -reset endif # configure the debug server -export DEBUGSERVER = $(UNIFLASH_PATH)/ccs_base/common/uscif/gdb_agent_console -export DEBUGSERVER_FLAGS = -p 3333 $(RIOTBOARD)/$(BOARD)/dist/$(CPU_MODEL)_$(XDEBUGGER).dat +DEBUGSERVER = $(UNIFLASH_PATH)/ccs_base/common/uscif/gdb_agent_console +DEBUGSERVER_FLAGS = -p 3333 $(RIOTBOARD)/$(BOARD)/dist/$(CPU_MODEL)_$(XDEBUGGER).dat # configure the debugging tool -export DEBUGGER = $(PREFIX)gdb -export DEBUGGER_FLAGS = -x $(RIOTBOARD)/$(BOARD)/dist/$(CPU_MODEL)_gdb.conf $(ELFFILE) +DEBUGGER = $(PREFIX)gdb +DEBUGGER_FLAGS = -x $(RIOTBOARD)/$(BOARD)/dist/$(CPU_MODEL)_gdb.conf $(ELFFILE) diff --git a/makefiles/vars.inc.mk b/makefiles/vars.inc.mk index 45a057f96b..f2c5ac9ed0 100644 --- a/makefiles/vars.inc.mk +++ b/makefiles/vars.inc.mk @@ -78,10 +78,10 @@ export PORT # The port to connect the TERMPROG to. export ELFFILE # The unstripped result of the compilation. export HEXFILE # The stripped result of the compilation. # FLASHFILE # The output file used for flashing (transition phase: only if defined) -export DEBUGGER # The command to call on "make debug", usually a script starting the GDB front-end. -export DEBUGGER_FLAGS # The parameters to supply to DEBUGGER. -export DEBUGSERVER # The command to call on "make debug-server", usually a script starting the GDB server. -export DEBUGSERVER_FLAGS # The parameters to supply to DEBUGSERVER. +# DEBUGGER # The command to call on "make debug", usually a script starting the GDB front-end. +# DEBUGGER_FLAGS # The parameters to supply to DEBUGGER. +# DEBUGSERVER # The command to call on "make debug-server", usually a script starting the GDB server. +# DEBUGSERVER_FLAGS # The parameters to supply to DEBUGSERVER. # RESET # The command to call on "make reset", this command resets/reboots the target. # RESET_FLAGS # The parameters to supply to RESET. From ea51cf31740224005b038423fa1a3962a0e84bcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Harter?= Date: Fri, 17 May 2019 13:56:49 +0200 Subject: [PATCH 07/10] dist/tools/buildsystem_sanity_check: check no DEBUG* exports Add sanity check for removed exports. --- dist/tools/buildsystem_sanity_check/check.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dist/tools/buildsystem_sanity_check/check.sh b/dist/tools/buildsystem_sanity_check/check.sh index de13e14ab4..d14b87522c 100755 --- a/dist/tools/buildsystem_sanity_check/check.sh +++ b/dist/tools/buildsystem_sanity_check/check.sh @@ -52,6 +52,8 @@ UNEXPORTED_VARIABLES+=('FLASHFILE') UNEXPORTED_VARIABLES+=('TERMPROG' 'TERMFLAGS') UNEXPORTED_VARIABLES+=('FLASHER' 'FFLAGS') UNEXPORTED_VARIABLES+=('RESET' 'RESETFLAGS') +UNEXPORTED_VARIABLES+=('DEBUGGER' 'DEBUGGER_FLAGS') +UNEXPORTED_VARIABLES+=('DEBUGSERVER' 'DEBUGSERVER_FLAGS') EXPORTED_VARIABLES_ONLY_IN_VARS=() check_not_exporting_variables() { From ff00096a391d3f90e409bee974bbce57ba398d51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Harter?= Date: Fri, 17 May 2019 13:52:34 +0200 Subject: [PATCH 08/10] boards/tools: remove exporting MSPDEBUGFLAGS MSPDEBUGFLAGS is evaluated only in the same file. Its value does not need to be exported. This will also prevent evaluating 'PORT' for MSPDEBUGFLAGS when not needed. --- boards/common/msb-430/Makefile.include | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/boards/common/msb-430/Makefile.include b/boards/common/msb-430/Makefile.include index 6a4311f41f..58be9005a8 100644 --- a/boards/common/msb-430/Makefile.include +++ b/boards/common/msb-430/Makefile.include @@ -10,9 +10,9 @@ include $(RIOTMAKE)/tools/serial.inc.mk # setup flash tool export PROGRAMMER ?= olimex -export MSPDEBUGFLAGS += -j $(PROGRAMMER) +MSPDEBUGFLAGS += -j $(PROGRAMMER) ifeq ($(strip $(PROGRAMMER)),uif) - export MSPDEBUGFLAGS += -d $(PORT) + MSPDEBUGFLAGS += -d $(PORT) endif FLASHER ?= mspdebug FFLAGS = $(MSPDEBUGFLAGS) "prog $(HEXFILE)" From 79280eb12e3768ea1ca5b83b89271667178ff53b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Harter?= Date: Fri, 17 May 2019 13:52:34 +0200 Subject: [PATCH 09/10] boards/tools: remove exporting PREFLASH/FLASHDEPS PREFLASHER/PREFFLAGS/FLASHDEPS are evaluated by the main Makefile.include. Their value does not need to be exported. Testing ------- `git diff --word-diff` only reports `export` being removed. `git show --stat` reports `16 insertions(+), 16 deletions(-)` Which is the same amount as lines that where matching `export[[:blank::]]\+VARIABLE` plus the newline that is said to have changed. --- cpu/esp32/Makefile.include | 24 ++++++++++++------------ cpu/esp8266/Makefile.include | 6 +++--- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/cpu/esp32/Makefile.include b/cpu/esp32/Makefile.include index 922bac0c43..2194541f16 100644 --- a/cpu/esp32/Makefile.include +++ b/cpu/esp32/Makefile.include @@ -145,19 +145,19 @@ LINKFLAGS += -Wl,--warn-unresolved-symbols FLASH_MODE ?= dout # FIX configuration, DO NOT CHANGE FLASH_FREQ = 40m # FIX configuration, DO NOT CHANGE FLASH_SIZE ?= 2MB -export PREFLASHER = $(ESPTOOL) -export PREFFLAGS = --chip esp32 elf2image -export PREFFLAGS += -fm $(FLASH_MODE) -fs $(FLASH_SIZE) -ff $(FLASH_FREQ) -export PREFFLAGS += -o $(ELFFILE).bin $(ELFFILE); -export PREFFLAGS += echo "" > $(BINDIR)/partitions.csv; -export PREFFLAGS += echo "nvs, data, nvs, 0x9000, 0x6000" >> $(BINDIR)/partitions.csv; -export PREFFLAGS += echo "phy_init, data, phy, 0xf000, 0x1000" >> $(BINDIR)/partitions.csv; -export PREFFLAGS += echo -n "factory, app, factory, 0x10000, " >> $(BINDIR)/partitions.csv; -export PREFFLAGS += ls -l $(ELFFILE).bin | awk '{ print $$5 }' >> $(BINDIR)/partitions.csv; +PREFLASHER = $(ESPTOOL) +PREFFLAGS = --chip esp32 elf2image +PREFFLAGS += -fm $(FLASH_MODE) -fs $(FLASH_SIZE) -ff $(FLASH_FREQ) +PREFFLAGS += -o $(ELFFILE).bin $(ELFFILE); +PREFFLAGS += echo "" > $(BINDIR)/partitions.csv; +PREFFLAGS += echo "nvs, data, nvs, 0x9000, 0x6000" >> $(BINDIR)/partitions.csv; +PREFFLAGS += echo "phy_init, data, phy, 0xf000, 0x1000" >> $(BINDIR)/partitions.csv; +PREFFLAGS += echo -n "factory, app, factory, 0x10000, " >> $(BINDIR)/partitions.csv; +PREFFLAGS += ls -l $(ELFFILE).bin | awk '{ print $$5 }' >> $(BINDIR)/partitions.csv; -export PREFFLAGS += python $(RIOTCPU)/$(CPU)/gen_esp32part.py --disable-sha256sum -export PREFFLAGS += --verify $(BINDIR)/partitions.csv $(BINDIR)/partitions.bin -export FLASHDEPS = preflash +PREFFLAGS += python $(RIOTCPU)/$(CPU)/gen_esp32part.py --disable-sha256sum +PREFFLAGS += --verify $(BINDIR)/partitions.csv $(BINDIR)/partitions.bin +FLASHDEPS = preflash # flasher configuration ifeq ($(QEMU), 1) diff --git a/cpu/esp8266/Makefile.include b/cpu/esp8266/Makefile.include index 316d2181cb..01d2885d2c 100644 --- a/cpu/esp8266/Makefile.include +++ b/cpu/esp8266/Makefile.include @@ -131,9 +131,9 @@ LINKFLAGS += -Wl,--warn-unresolved-symbols # configure preflasher to convert .elf to .bin before flashing FLASH_SIZE = -fs 8m -export PREFLASHER ?= esptool.py -export PREFFLAGS ?= elf2image $(FLASH_SIZE) $(ELFFILE) -export FLASHDEPS ?= preflash +PREFLASHER ?= esptool.py +PREFFLAGS ?= elf2image $(FLASH_SIZE) $(ELFFILE) +FLASHDEPS ?= preflash # flasher configuration ifeq ($(QEMU), 1) From d486598fdf3c72b7b110ff97a9ea2dbb28f50e1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Harter?= Date: Fri, 17 May 2019 13:56:49 +0200 Subject: [PATCH 10/10] dist/tools/buildsystem_sanity_check: check no PREFLASH* exports Add sanity check for removed exports. --- dist/tools/buildsystem_sanity_check/check.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/dist/tools/buildsystem_sanity_check/check.sh b/dist/tools/buildsystem_sanity_check/check.sh index d14b87522c..7704287551 100755 --- a/dist/tools/buildsystem_sanity_check/check.sh +++ b/dist/tools/buildsystem_sanity_check/check.sh @@ -54,6 +54,7 @@ UNEXPORTED_VARIABLES+=('FLASHER' 'FFLAGS') UNEXPORTED_VARIABLES+=('RESET' 'RESETFLAGS') UNEXPORTED_VARIABLES+=('DEBUGGER' 'DEBUGGER_FLAGS') UNEXPORTED_VARIABLES+=('DEBUGSERVER' 'DEBUGSERVER_FLAGS') +UNEXPORTED_VARIABLES+=('PREFLASHER' 'PREFFLAGS' 'FLASHDEPS') EXPORTED_VARIABLES_ONLY_IN_VARS=() check_not_exporting_variables() {