From b1a7d6093b0ffe7b8fa30d0ee830e29df8b852f8 Mon Sep 17 00:00:00 2001 From: Kaspar Schleiser Date: Wed, 20 Feb 2019 23:01:40 +0100 Subject: [PATCH] boards/hifive1: add and use custom openocd reset command --- boards/hifive1/Makefile.include | 1 + boards/hifive1/dist/openocd.cfg | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/boards/hifive1/Makefile.include b/boards/hifive1/Makefile.include index 098e456c64..9ef59603a7 100644 --- a/boards/hifive1/Makefile.include +++ b/boards/hifive1/Makefile.include @@ -13,6 +13,7 @@ PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*))) include $(RIOTMAKE)/tools/serial.inc.mk # this board uses openocd +export OPENOCD_CMD_RESET_RUN=_reset include $(RIOTMAKE)/tools/openocd.inc.mk # use our own openocd script to flash since HiFive1 has reset problems. diff --git a/boards/hifive1/dist/openocd.cfg b/boards/hifive1/dist/openocd.cfg index 76e9213761..8df71e4f66 100644 --- a/boards/hifive1/dist/openocd.cfg +++ b/boards/hifive1/dist/openocd.cfg @@ -31,7 +31,8 @@ $_TARGETNAME configure -work-area-phys 0x80000000 -work-area-size 10000 -work-ar flash bank onboard_spi_flash fespi 0x20000000 0 0 0 $_TARGETNAME #init #reset -- This type of reset is not implemented yet -if {[ info exists pulse_srst]} { + +proc _reset {} { ftdi_set_signal nSRST 0 ftdi_set_signal nSRST z #Wait for the reset stretcher @@ -39,6 +40,10 @@ if {[ info exists pulse_srst]} { #will incur lots of delays for later commands. sleep 1500 } + +if {[ info exists pulse_srst]} { + _reset +} #halt #flash protect 0 64 last off #