diff --git a/demo/Makefile b/demo/Makefile index bd009c6e..e5266a5b 100644 --- a/demo/Makefile +++ b/demo/Makefile @@ -77,6 +77,9 @@ program.hex: $(TEST).o $(LINK) openocd: openocd -f swerv.cfg +jlink: + openocd -f jlink.cfg + gdb: $(GDB_PREFIX) -x gdbinit ./build/jtag.bin diff --git a/demo/jlink.cfg b/demo/jlink.cfg new file mode 100644 index 00000000..ff67d987 --- /dev/null +++ b/demo/jlink.cfg @@ -0,0 +1,45 @@ +# +# SEGGER J-Link +# +# http://www.segger.com/jlink.html +# + +adapter driver jlink +transport select jtag +adapter speed 200 + + +# Target configuration for the riscv chip + +set _CHIPNAME riscv +set _TARGETNAME $_CHIPNAME.cpu + +jtag newtap $_CHIPNAME tap -irlen 5 -expected-id 0x1000008b +set _TARGETNAME $_CHIPNAME.tap +target create $_TARGETNAME riscv -chain-position $_TARGETNAME + +# Configure work area in on-chip SRAM +# $_TARGETNAME configure -work-area-phys 0x1000e000 -work-area-size 1000 -work-area-backup 0 + +riscv expose_csrs 1988 + +# Be verbose about GDB errors +gdb_report_data_abort enable +gdb_report_register_access_error enable + +# Increase timeouts in simulation +riscv set_command_timeout_sec 1200 + +# Conclude OpenOCD configuration +init + +# Halt the target +halt + + +# The serial number can be used to select a specific device in case more than +# one is connected to the host. +# +# Example: Select J-Link with serial number 123456789 +# +# adapter serial 123456789