Merge pull request #14428 from aabadie/pr/boards/hifive1b_openocd

boards/hifive1b: add support for openocd programmer
This commit is contained in:
Alexandre Abadie 2020-08-20 13:30:38 +02:00 committed by GitHub
commit 6bf6b6be6c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 6 deletions

View File

@ -5,12 +5,23 @@ PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*)))
# setup serial terminal
include $(RIOTMAKE)/tools/serial.inc.mk
# setup JLink for flashing
# export JLINK := JLink
JLINK_DEVICE = FE310
JLINK_IF = JTAG
FLASH_ADDR = 0x20010000
include $(RIOTMAKE)/tools/jlink.inc.mk
# Set default programmer as jlink
PROGRAMMER ?= jlink
ifeq (openocd,$(PROGRAMMER))
DEBUG_ADAPTER = jlink
OPENOCD_TRANSPORT = jtag
OPENOCD_PRE_FLASH_CMDS += "-c flash protect 0 1 last off"
include $(RIOTMAKE)/tools/openocd.inc.mk
else ifeq (jlink,$(PROGRAMMER))
# setup JLink for flashing
JLINK_DEVICE = FE310
JLINK_IF = JTAG
FLASH_ADDR = 0x20010000
include $(RIOTMAKE)/tools/jlink.inc.mk
else
$(error Programmer '$(PROGRAMMER)' not supported for board '$(BOARD)')
endif
TESTRUNNER_RESET_DELAY = 1
$(call target-export-variables,test,TESTRUNNER_RESET_DELAY)

10
boards/hifive1b/dist/openocd.cfg vendored Normal file
View File

@ -0,0 +1,10 @@
adapter speed 4000
set _CHIPNAME riscv
jtag newtap $_CHIPNAME cpu -irlen 5 -expected-id 0x20000913
set _TARGETNAME $_CHIPNAME.cpu
target create $_TARGETNAME.0 riscv -chain-position $_TARGETNAME
$_TARGETNAME.0 configure -work-area-phys 0x80000000 -work-area-size 0x4000 -work-area-backup 0
flash bank onboard_spi_flash fespi 0x20000000 0 0 0 $_TARGETNAME.0