1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-24 14:03:55 +01:00

Merge pull request #13719 from aabadie/pr/boards/flash_export_remove

boards*: remove remaining uses of export with some openocd related variables
This commit is contained in:
Kaspar Schleiser 2020-04-07 11:58:28 +02:00 committed by GitHub
commit 010aca2638
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 52 additions and 27 deletions

View File

@ -14,7 +14,7 @@ DEBUG_ADAPTER ?= dap
OPENOCD_CONFIG ?= $(RIOTBOARD)/common/frdm/dist/openocd-$(CPU_FAMILY).cfg
# Check the flash configuration field before flashing
export PRE_FLASH_CHECK_SCRIPT = $(RIOTCPU)/$(CPU)/dist/check-fcfield.sh
PRE_FLASH_CHECK_SCRIPT = $(RIOTCPU)/$(CPU)/dist/check-fcfield.sh
# setup serial terminal
include $(RIOTMAKE)/tools/serial.inc.mk

View File

@ -43,8 +43,8 @@ else ifeq (openocd,$(PROGRAMMER))
ifneq (,$(filter nordic_softdevice_ble,$(USEPKG)))
LINKER_SCRIPT ?= $(RIOTCPU)/$(CPU)/ldscripts/$(CPU_MODEL)_sd.ld
export OPENOCD_PRE_FLASH_CMDS += -c 'flash write_image erase "$(BINDIR)/softdevice.hex"'
export OPENOCD_PRE_VERIFY_CMDS += -c 'verify_image "$(BINDIR)/softdevice.hex"'
OPENOCD_PRE_FLASH_CMDS += -c 'flash write_image erase "$(BINDIR)/softdevice.hex"'
OPENOCD_PRE_VERIFY_CMDS += -c 'verify_image "$(BINDIR)/softdevice.hex"'
# Cannot use the 'ELFFILE' here
# The segments are 0x10000 aligned so padding bytes are copied and verified

View File

@ -6,7 +6,7 @@ PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*)))
include $(RIOTMAKE)/tools/serial.inc.mk
# this board uses openocd with a custom reset command
export OPENOCD_CMD_RESET_RUN=-c _reset
OPENOCD_CMD_RESET_RUN =-c _reset
include $(RIOTMAKE)/tools/openocd.inc.mk
# use our own openocd script to flash since HiFive1 has reset problems.

View File

@ -13,17 +13,17 @@ DEBUG_ADAPTER_ID ?= $(PROGRAMMER_SERIAL)
PORT_LINUX ?= /dev/ttyUSB0
PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbserial*)))
# setup serial terminal
include $(RIOTMAKE)/tools/serial.inc.mk
# We need special handling of the watchdog if we want to speed up the flash
# verification by using the MCU to compute the image checksum after flashing.
# wdog-disable.bin is a precompiled binary which will disable the watchdog and
# return control to the debugger (OpenOCD)
export OPENOCD_PRE_VERIFY_CMDS += \
OPENOCD_PRE_VERIFY_CMDS += \
-c 'load_image $(RIOTCPU)/$(CPU)/dist/wdog-disable.bin 0x20000000 bin' \
-c 'resume 0x20000000'
export PRE_FLASH_CHECK_SCRIPT = $(RIOTCPU)/$(CPU)/dist/check-fcfield.sh
PRE_FLASH_CHECK_SCRIPT = $(RIOTCPU)/$(CPU)/dist/check-fcfield.sh
# this board uses openocd
include $(RIOTMAKE)/tools/openocd.inc.mk
# setup serial terminal
include $(RIOTMAKE)/tools/serial.inc.mk

View File

@ -2,17 +2,6 @@
PORT_LINUX ?= /dev/ttyACM0
PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*)))
# We need special handling of the watchdog if we want to speed up the flash
# verification by using the MCU to compute the image checksum after flashing.
# wdog-disable.bin is a precompiled binary which will disable the watchdog and
# return control to the debugger (OpenOCD)
export OPENOCD_PRE_VERIFY_CMDS += \
-c 'load_image $(RIOTCPU)/$(CPU)/dist/wdog-disable.bin 0x20000000 bin' \
-c 'resume 0x20000000'
export PRE_FLASH_CHECK_SCRIPT = $(RIOTCPU)/$(CPU)/dist/check-fcfield.sh
DEBUG_ADAPTER ?= dap
# Add board selector (USB serial) to OpenOCD options if specified.
# Use /dist/tools/usb-serial/list-ttys.sh to find out serial number.
# Usage: SERIAL="0200..." BOARD="pba-d-01-kw2x" make flash
@ -29,6 +18,17 @@ endif
# setup serial terminal
include $(RIOTMAKE)/tools/serial.inc.mk
# We need special handling of the watchdog if we want to speed up the flash
# verification by using the MCU to compute the image checksum after flashing.
# wdog-disable.bin is a precompiled binary which will disable the watchdog and
# return control to the debugger (OpenOCD)
OPENOCD_PRE_VERIFY_CMDS += \
-c 'load_image $(RIOTCPU)/$(CPU)/dist/wdog-disable.bin 0x20000000 bin' \
-c 'resume 0x20000000'
PRE_FLASH_CHECK_SCRIPT = $(RIOTCPU)/$(CPU)/dist/check-fcfield.sh
DEBUG_ADAPTER ?= dap
# The board can become un-flashable after some firmware, use connect_assert_srst
# to always be able to flash or reset the board.
OPENOCD_RESET_USE_CONNECT_ASSERT_SRST ?= 1

View File

@ -7,7 +7,7 @@ ifeq (openocd,$(PROGRAMMER))
endif
# Enable direct write to FCF (required for setting FOPT byte).
export OPENOCD_PRE_FLASH_CMDS += "-c kinetis fcf_source write"
OPENOCD_PRE_FLASH_CMDS += "-c kinetis fcf_source write"
# Include default FRDM board config
include $(RIOTBOARD)/common/kw41z/Makefile.include

View File

@ -7,12 +7,12 @@ include $(RIOTMAKE)/tools/serial.inc.mk
DEBUG_ADAPTER ?= dap
# generate image checksum from hex file
PRE_FLASH_CHECK_SCRIPT = lpc_checksum --format hex
# remap flash to address 0x0, otherwise it verifies the rom bootloader
OPENOCD_PRE_VERIFY_CMDS += '-c reset init'
# this board uses openocd with an HEXFILE
FLASHFILE ?= $(HEXFILE)
include $(RIOTMAKE)/tools/openocd.inc.mk
# generate image checksum from hex file
export PRE_FLASH_CHECK_SCRIPT = lpc_checksum --format hex
# remap flash to address 0x0, otherwise it verifies the rom bootloader
export OPENOCD_PRE_VERIFY_CMDS += '-c reset init'

View File

@ -84,6 +84,9 @@ UNEXPORTED_VARIABLES+=('USEMODULE_INCLUDES')
UNEXPORTED_VARIABLES+=('OPENOCD_ADAPTER_INIT')
UNEXPORTED_VARIABLES+=('OPENOCD_CONFIG')
UNEXPORTED_VARIABLES+=('OPENOCD_RESET_USE_CONNECT_ASSERT_SRST')
UNEXPORTED_VARIABLES+=('OPENOCD_CMD_RESET_RUN')
UNEXPORTED_VARIABLES+=('OPENOCD_PRE_FLASH_CMDS' 'OPENOCD_PRE_VERIFY_CMDS')
UNEXPORTED_VARIABLES+=('PRE_FLASH_CHECK_SCRIPT')
UNEXPORTED_VARIABLES+=('FLASH_TARGET_TYPE')
UNEXPORTED_VARIABLES+=('PYOCD_ADAPTER_INIT')
UNEXPORTED_VARIABLES+=('JLINK_DEVICE' 'JLINK_IF')

View File

@ -24,3 +24,25 @@ $(call target-export-variables,$(OPENOCD_TARGETS),OPENOCD_ADAPTER_INIT)
# Export OPENOCD_RESET_USE_CONNECT_ASSERT_SRST to required targets
$(call target-export-variables,$(OPENOCD_TARGETS),OPENOCD_RESET_USE_CONNECT_ASSERT_SRST)
ifneq (,$(OPENOCD_CMD_RESET_RUN))
# Export OPENOCD_CMD_RESET_RUN only to the reset target
$(call target-export-variables,reset,OPENOCD_CMD_RESET_RUN)
endif
OPENOCD_FLASH_TARGETS = flash flash-only
ifneq (,$(OPENOCD_PRE_VERIFY_CMDS))
# Export OPENOCD_PRE_VERIFY_CMDS only to the flash/flash-only target
$(call target-export-variables,$(OPENOCD_FLASH_TARGETS),OPENOCD_PRE_VERIFY_CMDS)
endif
ifneq (,$(OPENOCD_PRE_FLASH_CMDS))
# Export OPENOCD_PRE_FLASH_CMDS only to the flash/flash-only targets
$(call target-export-variables,$(OPENOCD_FLASH_TARGETS),OPENOCD_PRE_FLASH_CMDS)
endif
ifneq (,$(PRE_FLASH_CHECK_SCRIPT))
# Export PRE_FLASH_CHECK_SCRIPT only to the flash/flash-only targets
$(call target-export-variables,$(OPENOCD_FLASH_TARGETS),PRE_FLASH_CHECK_SCRIPT)
endif