1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-17 04:52:59 +01:00

boards/hifive1b: add support for openocd programmer

This commit is contained in:
Alexandre Abadie 2020-07-02 09:14:35 +02:00
parent 613d0cfffd
commit 9a893e1bf5
No known key found for this signature in database
GPG Key ID: 1C919A403CAE1405
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