1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

make: namespace pyocd FLASH_TARGET_TYPE variable

This commit is contained in:
Alexandre Abadie 2021-02-18 17:16:20 +01:00
parent 603186f913
commit 6f47505997
No known key found for this signature in database
GPG Key ID: 1C919A403CAE1405
9 changed files with 17 additions and 17 deletions

View File

@ -6,7 +6,7 @@ ifeq (openocd,$(PROGRAMMER))
else ifeq (pyocd,$(PROGRAMMER))
# PyOCD doesn't recognize automatically the board ID, so target type has to
# be passed explicitly
FLASH_TARGET_TYPE ?= -t nrf51
PYOCD_FLASH_TARGET_TYPE ?= -t nrf51
endif
# include nrf51 boards common configuration

View File

@ -26,7 +26,7 @@ else
ifeq (pyocd,$(PROGRAMMER))
# The board is not recognized automatically by pyocd, so the CPU target
# option is passed explicitly
FLASH_TARGET_TYPE ?= -t nrf52840
PYOCD_FLASH_TARGET_TYPE ?= -t nrf52840
else ifeq (openocd,$(PROGRAMMER))
OPENOCD_DEBUG_ADAPTER ?= dap
endif

View File

@ -3,7 +3,7 @@ PROGRAMMER ?= openocd
ifeq (pyocd,$(PROGRAMMER))
# The board is not recognized automatically by pyocd, so the CPU target
# option is passed explicitly
FLASH_TARGET_TYPE ?= -t $(CPU)
PYOCD_FLASH_TARGET_TYPE ?= -t $(CPU)
else ifeq (openocd,$(PROGRAMMER))
OPENOCD_DEBUG_ADAPTER = dap
endif

View File

@ -6,7 +6,7 @@ PROGRAMMER ?= pyocd
ifeq (pyocd,$(PROGRAMMER))
# The board is not recognized automatically by pyocd, so the CPU target
# option is passed explicitly
FLASH_TARGET_TYPE ?= -t $(CPU)
PYOCD_FLASH_TARGET_TYPE ?= -t $(CPU)
else ifeq (openocd,$(PROGRAMMER))
OPENOCD_DEBUG_ADAPTER = dap
endif

View File

@ -6,7 +6,7 @@ PROGRAMMER ?= pyocd
ifeq (pyocd,$(PROGRAMMER))
# The board is not recognized automatically by pyocd, so the CPU target
# option is passed explicitly
FLASH_TARGET_TYPE ?= -t nrf52840
PYOCD_FLASH_TARGET_TYPE ?= -t nrf52840
else ifeq (openocd,$(PROGRAMMER))
OPENOCD_DEBUG_ADAPTER = dap
endif

View File

@ -3,7 +3,7 @@ RIOT_TERMINAL ?= jlink
# define pyocd as programmer to program with stlink
ifeq (pyocd,$(PROGRAMMER))
FLASH_TARGET_TYPE ?= -t $(CPU)
PYOCD_FLASH_TARGET_TYPE ?= -t $(CPU)
endif
# use shared Makefile.include

View File

@ -121,7 +121,7 @@ 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_FLASH_TARGET_TYPE')
UNEXPORTED_VARIABLES+=('PYOCD_ADAPTER_INIT')
UNEXPORTED_VARIABLES+=('JLINK_DEVICE' 'JLINK_IF')
UNEXPORTED_VARIABLES+=('JLINK_PRE_FLASH' 'JLINK_RESET_FILE')

View File

@ -12,7 +12,7 @@
#
# options:
# <hex_file>: Filename of the hex file that will be flashed
# FLASH_TARGET_TYPE: CPU target type (nrf52, nrf51, etc)
# PYOCD_FLASH_TARGET_TYPE: CPU target type (nrf52, nrf51, etc)
#
# debug: debug <elfile>
# starts pyocd-gdbserver as GDB server in the background and
@ -71,7 +71,7 @@
: ${DBG_FLAGS:=${DBG_DEFAULT_FLAGS} ${DBG_EXTRA_FLAGS}}
# CPU Target type.
# Use `-t` followed by value. Example: -t nrf51
: ${FLASH_TARGET_TYPE:=}
: ${PYOCD_FLASH_TARGET_TYPE:=}
# This is an optional offset to the base address that can be used to flash an
# image in a different location than it is linked at. This feature can be useful
# when flashing images for firmware swapping/remapping boot loaders.
@ -126,7 +126,7 @@ do_flash() {
fi
# flash device
sh -c "${PYOCD_FLASH} ${FLASH_TARGET_TYPE} ${PYOCD_ADAPTER_INIT} -a ${IMAGE_OFFSET} \"${HEX_FILE}\"" &&
sh -c "${PYOCD_FLASH} ${PYOCD_FLASH_TARGET_TYPE} ${PYOCD_ADAPTER_INIT} -a ${IMAGE_OFFSET} \"${HEX_FILE}\"" &&
echo 'Done flashing'
}
@ -148,7 +148,7 @@ do_debug() {
trap '' INT
# start PyOCD as GDB server
${SETSID} sh -c "${PYOCD_GDBSERVER} \
${FLASH_TARGET_TYPE} \
${PYOCD_FLASH_TARGET_TYPE} \
${PYOCD_ADAPTER_INIT} \
-p ${GDB_PORT} \
-T ${TELNET_PORT} & \
@ -166,7 +166,7 @@ do_debug() {
do_debugserver() {
# start PyOCD as GDB server
sh -c "${PYOCD_GDBSERVER} \
${FLASH_TARGET_TYPE} \
${PYOCD_FLASH_TARGET_TYPE} \
${PYOCD_ADAPTER_INIT} \
-p ${GDB_PORT} \
-T ${TELNET_PORT}"
@ -174,7 +174,7 @@ do_debugserver() {
do_reset() {
# start PyOCD and invoke board reset
sh -c "${PYOCD_CMD} cmd -c reset ${FLASH_TARGET_TYPE} ${PYOCD_ADAPTER_INIT}"
sh -c "${PYOCD_CMD} cmd -c reset ${PYOCD_FLASH_TARGET_TYPE} ${PYOCD_ADAPTER_INIT}"
}
#

View File

@ -3,7 +3,7 @@ DEBUGGER ?= $(RIOTBASE)/dist/tools/pyocd/pyocd.sh
DEBUGSERVER ?= $(RIOTBASE)/dist/tools/pyocd/pyocd.sh
RESET ?= $(RIOTBASE)/dist/tools/pyocd/pyocd.sh
FLASH_TARGET_TYPE ?=
PYOCD_FLASH_TARGET_TYPE ?=
FLASHFILE ?= $(HEXFILE)
FFLAGS ?= flash $(FLASHFILE)
DEBUGGER_FLAGS ?= debug $(ELFFILE)
@ -12,9 +12,9 @@ RESET_FLAGS ?= reset
PYOCD_TARGETS = debug% flash% reset
# Export FLASH_TARGET_TYPE to required targets only if not empty
ifneq (,$(FLASH_TARGET_TYPE))
$(call target-export-variables,$(PYOCD_TARGETS),FLASH_TARGET_TYPE)
# Export PYOCD_FLASH_TARGET_TYPE to required targets only if not empty
ifneq (,$(PYOCD_FLASH_TARGET_TYPE))
$(call target-export-variables,$(PYOCD_TARGETS),PYOCD_FLASH_TARGET_TYPE)
endif
# Add serial matching command, only if DEBUG_ADAPTER_ID was specified