2016-03-11 09:11:03 +01:00
|
|
|
# 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
|
|
|
|
ifneq (,$(SERIAL))
|
2019-09-02 14:21:11 +02:00
|
|
|
# Trigger adapter selection on SERIAL in 'openocd-adapters'
|
|
|
|
DEBUG_ADAPTER_ID ?= $(SERIAL)
|
2018-05-15 11:23:44 +02:00
|
|
|
SERIAL_TTY = $(firstword $(shell $(RIOTTOOLS)/usb-serial/find-tty.sh $(SERIAL)))
|
2017-09-22 14:52:12 +02:00
|
|
|
ifeq (,$(SERIAL_TTY))
|
|
|
|
$(error Did not find a device with serial $(SERIAL))
|
|
|
|
endif
|
|
|
|
PORT_LINUX := $(SERIAL_TTY)
|
2016-03-11 09:11:03 +01:00
|
|
|
endif
|
|
|
|
|
2020-11-19 18:38:41 +01:00
|
|
|
# this board uses openocd
|
|
|
|
PROGRAMMER ?= openocd
|
2021-02-23 15:15:38 +01:00
|
|
|
PROGRAMMERS_SUPPORTED += openocd
|
2020-11-19 18:38:41 +01:00
|
|
|
|
2020-04-07 11:38:53 +02:00
|
|
|
# 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'
|
2021-02-18 18:18:54 +01:00
|
|
|
OPENOCD_PRE_FLASH_CHECK_SCRIPT = $(RIOTCPU)/$(CPU)/dist/check-fcfield.sh
|
2020-04-07 11:38:53 +02:00
|
|
|
|
2021-02-18 17:15:55 +01:00
|
|
|
OPENOCD_DEBUG_ADAPTER ?= dap
|
2020-04-07 11:38:53 +02:00
|
|
|
|
2019-03-04 14:13:28 +01:00
|
|
|
# The board can become un-flashable after some firmware, use connect_assert_srst
|
|
|
|
# to always be able to flash or reset the board.
|
2020-02-24 10:26:14 +01:00
|
|
|
OPENOCD_RESET_USE_CONNECT_ASSERT_SRST ?= 1
|