riscv-openocd/src/target
Tom Hebb e2cfd4e063
Improve support for GD32VF103 MCU (#538)
* riscv: work around buggy hart states during reset in some DMs

As described in the comment this change adds, the GD32VF103 DM reports
that the hart is in more than one state while it is resetting. Because
of this, the current code acknowledges resets before they actually
complete. This sometimes prevents havereset from getting cleared as
intended, leading to a spurious "Hart 0 unexpectedly reset!" message the
next time riscv_is_halted() gets called.

To work around this, check for the absence of the unavailable state
rather than the presence of the running or halted states. This behavior
is also arguably more true to the spec than what exists now: Section 3.2
states that "The system may take an arbitrarily long time to come out of
reset, as reported by allunavail, anyunavail."

Change-Id: I34e90a16233125608bce8e4c2414dbead637600e
Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>

* riscv: support custom reset-assert scripts

The reset-assert event is used, if present, to override the default
reset logic for ARM and MIPS cores. Do the same for RISC-V so that
devices with buggy ndmreset functionality (like GD32VF103) or
nonstandard reset sequences can specify the appropriate logic in Tcl.

Change-Id: I5e12077d67509853edb8ef3ad3f037f293a5fbb6
Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>

* tcl/target: support GD32VF103 RISC-V MCU

The GD32VF103 is a low-cost 32-bit RISC-V microcontroller with
peripherals that are more-or-less compatible with the STM32F103 ARM
microcontroller. It is available on several low-cost dev boards, such as
the Sipeed Longan Nano, which is what I am testing on.

Add initial support for this chip, including a workaround for a buggy
ndmreset line (i.e. one that doesn't actually trigger a reset) in its
integrated debug module. Use the existing GD32VF103 flash driver that
was ported from the vendor's code in commit 48e40f3513 ("Add support
for GD32VF103 flash").

Change-Id: Iadac47ceb5437b8e18f3d35901388f10fef9f876
Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>

* tcl/target/gd32vf103: add main flash alias

The GD32VF103 creates an alias to either main flash or the bootloader at
0x0, depending on how it was booted. As such, we want to indicate to
debuggers that the memory at 0x0 is flash and so cannot support software
breakpoints. To do this, add an alias to the main flash in the config.
This isn't strictly accurate in the case where we're running the
bootloader, but it still suits our purpose of fixing breakpoint
behavior.

Change-Id: I9eb8462d354f096eee231c0e5e2bffa538a5903e
Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>
2020-10-01 11:06:11 -07:00
..
openrisc coding style: open function's brace at beginning of new line 2020-05-09 14:41:31 +01:00
riscv Improve support for GD32VF103 MCU (#538) 2020-10-01 11:06:11 -07:00
Makefile.am Remove BUILD_TARGET64 2020-04-21 12:55:41 +01:00
aarch64.c semihosting: add semihosting handlers to AArch64 2020-03-12 09:48:56 +00:00
aarch64.h aarch64: add 'maskisr' command 2018-01-16 09:05:41 +00:00
adi_v5_dapdirect.c adi_v5_dapdirect: fix connect under reset 2020-02-24 10:28:46 +00:00
adi_v5_jtag.c arm_adi_v5: add API send_sequence() and use it 2020-01-02 21:24:54 +00:00
adi_v5_swd.c target/adi_v5_swd: fix clang static analyzer warning 2020-02-23 21:36:36 +00:00
algorithm.c Remove FSF address from GPL notices 2016-05-24 22:30:01 +01:00
algorithm.h target: Add 64-bit target address support 2017-02-10 13:50:17 +01:00
arc.c target/arc: fix build with clang 2020-05-14 20:28:24 +01:00
arc.h target/arc: introduce breakpoint functionality 2020-05-08 21:23:05 +01:00
arc_cmd.c coding style: avoid unnecessary line continuations 2020-05-09 14:39:29 +01:00
arc_cmd.h Introduce ARCv2 architecture related code 2020-02-27 06:46:51 +00:00
arc_jtag.c coding style: src: remove empty lines at end of text files 2020-05-02 15:40:21 +01:00
arc_jtag.h Introduce ARCv2 architecture related code 2020-02-27 06:46:51 +00:00
arc_mem.c Introduce ARCv2 architecture related code 2020-02-27 06:46:51 +00:00
arc_mem.h Introduce ARCv2 architecture related code 2020-02-27 06:46:51 +00:00
arm.h target/cortex_a: fix memory leak of register cache 2020-06-06 18:05:29 +01:00
arm7_9_common.c arm: Use different enum for core_type and core_mode 2020-03-12 10:05:42 +00:00
arm7_9_common.h target: Add 64-bit target address support 2017-02-10 13:50:17 +01:00
arm7tdmi.c target/arm: add support for multi-architecture gdb 2019-01-08 09:59:42 +00:00
arm7tdmi.h Make #include guard naming consistent 2016-05-24 22:30:55 +01:00
arm9tdmi.c helper/command: change prototype of command_print/command_print_sameline 2019-05-14 19:37:11 +01:00
arm9tdmi.h Make #include guard naming consistent 2016-05-24 22:30:55 +01:00
arm11.c coding style: add parenthesis around the argument of sizeof 2020-05-09 14:39:19 +01:00
arm11.h Make #include guard naming consistent 2016-05-24 22:30:55 +01:00
arm11_dbgtap.c coding style: add parenthesis around the argument of sizeof 2020-05-09 14:39:19 +01:00
arm11_dbgtap.h Make #include guard naming consistent 2016-05-24 22:30:55 +01:00
arm720t.c helper/command: change prototype of command_print/command_print_sameline 2019-05-14 19:37:11 +01:00
arm720t.h Make #include guard naming consistent 2016-05-24 22:30:55 +01:00
arm920t.c target/arm920t: fix clang static analyzer warning 2020-03-07 15:29:44 +00:00
arm920t.h target: Add 64-bit target address support 2017-02-10 13:50:17 +01:00
arm926ejs.c helper/command: change prototype of command_print/command_print_sameline 2019-05-14 19:37:11 +01:00
arm926ejs.h target: Add 64-bit target address support 2017-02-10 13:50:17 +01:00
arm946e.c target/arm946e: add missing error detection 2020-01-16 09:45:19 +00:00
arm946e.h Make #include guard naming consistent 2016-05-24 22:30:55 +01:00
arm966e.c helper/command: change prototype of command_print/command_print_sameline 2019-05-14 19:37:11 +01:00
arm966e.h Make #include guard naming consistent 2016-05-24 22:30:55 +01:00
arm_adi_v5.c arm_adi_v5: dap_ti_be_32_quirks_command minor simplification 2020-06-06 18:03:12 +01:00
arm_adi_v5.h stlink: add DAP direct driver 2020-01-14 11:40:36 +00:00
arm_cti.c coding style: src: remove empty lines at end of text files 2020-05-02 15:40:21 +01:00
arm_cti.h armv8: valgrind memleak fixes 2018-05-08 15:21:49 -07:00
arm_dap.c adi_v5_dapdirect: add support for adapter drivers that provide DAP API 2020-01-14 11:40:25 +00:00
arm_disassembler.c arm_disassembler: fix typo 'ARM_UNKNOWN_INSTUCTION' to '.._INSTRUCTION' 2020-05-24 21:26:47 +01:00
arm_disassembler.h arm_disassembler: fix typo 'ARM_UNKNOWN_INSTUCTION' to '.._INSTRUCTION' 2020-05-24 21:26:47 +01:00
arm_dpm.c target/cortex_a: fix memory leak of register cache 2020-06-06 18:05:29 +01:00
arm_dpm.h From upstream (#331) 2018-11-19 12:46:40 -08:00
arm_jtag.c helper/binarybuffer: fix clang static analyzer warnings 2020-03-07 15:30:05 +00:00
arm_jtag.h Make #include guard naming consistent 2016-05-24 22:30:55 +01:00
arm_opcodes.h arm_opcode: fix encoding of ARMv5 breakpoint instruction 2019-01-23 15:26:39 +00:00
arm_semihosting.c target/arm_semihosting: Use 'bool' data type 2019-03-06 16:16:29 +00:00
arm_semihosting.h Rework/update ARM semihosting 2018-06-04 09:16:08 +01:00
arm_simulator.c Remove FSF address from GPL notices 2016-05-24 22:30:01 +01:00
arm_simulator.h Make #include guard naming consistent 2016-05-24 22:30:55 +01:00
armv4_5.c target/cortex_a: fix memory leak of register cache 2020-06-06 18:05:29 +01:00
armv4_5.h target/cortex_a: add hypervisor mode 2020-03-12 10:11:19 +00:00
armv4_5_cache.c helper/command: change prototype of command_print/command_print_sameline 2019-05-14 19:37:11 +01:00
armv4_5_cache.h target/armv4_5_cache: change prototype of armv4_5_handle_cache_info_command() 2019-05-14 19:35:41 +01:00
armv4_5_mmu.c Remove FSF address from GPL notices 2016-05-24 22:30:01 +01:00
armv4_5_mmu.h target: Add 64-bit target address support 2017-02-10 13:50:17 +01:00
armv7a.c helper/command: change prototype of command_print/command_print_sameline 2019-05-14 19:37:11 +01:00
armv7a.h armv7a: access monitor registers only with security extensions 2020-03-12 10:10:33 +00:00
armv7a_cache.c helper/command: change prototype of command_print/command_print_sameline 2019-05-14 19:37:11 +01:00
armv7a_cache.h Make #include guard naming consistent 2016-05-24 22:30:55 +01:00
armv7a_cache_l2x.c helper/command: change prototype of command_print/command_print_sameline 2019-05-14 19:37:11 +01:00
armv7a_cache_l2x.h target: Add 64-bit target address support 2017-02-10 13:50:17 +01:00
armv7a_mmu.c Remove BUILD_TARGET64 2020-04-21 12:55:41 +01:00
armv7a_mmu.h armv7a_mmu: Do not restrict virtual addresses to uint32_t 2019-06-12 15:14:44 +01:00
armv7m.c target/armv7m: cosmetic refactorization 2020-05-03 21:42:23 +01:00
armv7m.h target, flash: prepare infrastructure for multi-block blank check 2018-05-08 15:21:49 -07:00
armv7m_trace.c target/armv7m_trace: Calculate prescaler for external capture devices 2020-06-18 10:11:02 +01:00
armv7m_trace.h From upstream (#286) 2018-08-20 14:55:30 -07:00
armv8.c target/armv8: Add ARM target name on halt status 2020-04-24 17:39:41 +01:00
armv8.h target/armv8: change prototype of display_cache_info() 2019-05-14 19:35:25 +01:00
armv8_cache.c helper/command: change prototype of command_print/command_print_sameline 2019-05-14 19:37:11 +01:00
armv8_cache.h aarch64: add cache handling functions 2017-02-10 14:01:39 +01:00
armv8_dpm.c coding style: add parenthesis around the argument of sizeof 2020-05-09 14:39:19 +01:00
armv8_dpm.h aarch64: fix debug entry from EL0 2018-03-16 08:58:06 +00:00
armv8_opcodes.c target/armv8_opcodes: use T32 instructions when the PE is in AArch32 state 2020-03-12 09:47:08 +00:00
armv8_opcodes.h target/armv8_opcodes: use T32 instructions when the PE is in AArch32 state 2020-03-12 09:47:08 +00:00
avr32_ap7k.c coding style: remove useless break after a goto or return 2020-05-09 14:39:05 +01:00
avr32_ap7k.h Make #include guard naming consistent 2016-05-24 22:30:55 +01:00
avr32_jtag.c coding style: src: remove empty lines at end of text files 2020-05-02 15:40:21 +01:00
avr32_jtag.h Make #include guard naming consistent 2016-05-24 22:30:55 +01:00
avr32_mem.c Remove FSF address from GPL notices 2016-05-24 22:30:01 +01:00
avr32_mem.h Make #include guard naming consistent 2016-05-24 22:30:55 +01:00
avr32_regs.c Remove FSF address from GPL notices 2016-05-24 22:30:01 +01:00
avr32_regs.h Make #include guard naming consistent 2016-05-24 22:30:55 +01:00
avrt.c coding style: fix space around pointer's asterisk 2020-02-24 10:30:36 +00:00
avrt.h Make #include guard naming consistent 2016-05-24 22:30:55 +01:00
breakpoints.c Merge branch 'master' into from_upstream 2020-06-23 13:05:43 -07:00
breakpoints.h target: Add function to remove all breakpoints 2020-03-26 19:30:34 +00:00
cortex_a.c target/cortex_a: fix memory leak of register cache 2020-06-06 18:05:29 +01:00
cortex_a.h From upstream (#331) 2018-11-19 12:46:40 -08:00
cortex_m.c target/cortex-m: enable C_DEBUGEN during examine 2020-06-06 18:04:36 +01:00
cortex_m.h cortex_m: make bit fields in cortex_m unsigned. 2020-05-12 06:05:45 +01:00
dsp563xx.c Create `riscv repeat_read` command (#510) 2020-08-18 11:01:41 -07:00
dsp563xx.h Make #include guard naming consistent 2016-05-24 22:30:55 +01:00
dsp563xx_once.c coding style: wrap lines longer than 120 chars 2020-05-09 14:40:52 +01:00
dsp563xx_once.h coding style: fix space around pointer's asterisk 2020-02-24 10:30:36 +00:00
dsp5680xx.c coding style: wrap lines longer than 120 chars 2020-05-09 14:40:52 +01:00
dsp5680xx.h coding style: fix space around pointer's asterisk 2020-02-24 10:30:36 +00:00
embeddedice.c target/embeddedice: Use 'bool' data type 2019-03-06 16:15:56 +00:00
embeddedice.h Make #include guard naming consistent 2016-05-24 22:30:55 +01:00
esirisc.c helper/command: change prototype of command_print/command_print_sameline 2019-05-14 19:37:11 +01:00
esirisc.h esirisc: support eSi-Trace 2018-12-12 08:47:44 +00:00
esirisc_jtag.c helper/binarybuffer: fix clang static analyzer warnings 2020-03-07 15:30:05 +00:00
esirisc_jtag.h esirisc: support eSi-Trace 2018-12-12 08:47:44 +00:00
esirisc_regs.h From upstream (#331) 2018-11-19 12:46:40 -08:00
esirisc_trace.c helper/command: change prototype of command_print/command_print_sameline 2019-05-14 19:37:11 +01:00
esirisc_trace.h esirisc: support eSi-Trace 2018-12-12 08:47:44 +00:00
etb.c helper/binarybuffer: fix clang static analyzer warnings 2020-03-07 15:30:05 +00:00
etb.h Make #include guard naming consistent 2016-05-24 22:30:55 +01:00
etm.c coding style: fix multi-line dereferencing 2020-06-06 18:06:05 +01:00
etm.h Make #include guard naming consistent 2016-05-24 22:30:55 +01:00
etm_dummy.c helper/command: change prototype of command_print/command_print_sameline 2019-05-14 19:37:11 +01:00
etm_dummy.h Make #include guard naming consistent 2016-05-24 22:30:55 +01:00
fa526.c target/arm: add support for multi-architecture gdb 2019-01-08 09:59:42 +00:00
feroceon.c target/feroceon: Use 'bool' data type 2019-03-06 16:17:24 +00:00
hla_target.c hla: use the new system_reset API 2020-01-14 11:37:34 +00:00
image.c Improve block read and checksum speed (#381) 2019-06-19 10:56:37 -07:00
image.h target: Add 64-bit target address support 2017-02-10 13:50:17 +01:00
lakemont.c target/lakemont: Use 'bool' data type 2019-03-06 16:19:28 +00:00
lakemont.h target: Add 64-bit target address support 2017-02-10 13:50:17 +01:00
ls1_sap.c helper/binarybuffer: fix clang static analyzer warnings 2020-03-07 15:30:05 +00:00
mem_ap.c target/mem_ap: fix two memory leaks 2020-06-06 18:05:08 +01:00
mips32.c helper/command: change prototype of command_print/command_print_sameline 2019-05-14 19:37:11 +01:00
mips32.h target, flash: prepare infrastructure for multi-block blank check 2018-05-08 15:21:49 -07:00
mips32_dmaacc.c Remove FSF address from GPL notices 2016-05-24 22:30:01 +01:00
mips32_dmaacc.h Make #include guard naming consistent 2016-05-24 22:30:55 +01:00
mips32_pracc.c mips32, add support for micromips in debug mode 2017-05-08 18:03:28 +01:00
mips32_pracc.h mips32: pracc: Fix indent 2019-03-23 17:43:30 +00:00
mips64.c Remove BUILD_TARGET64 2020-04-21 12:55:41 +01:00
mips64.h mips: Add MIPS64 support 2019-11-28 16:59:15 +00:00
mips64_pracc.c Remove BUILD_TARGET64 2020-04-21 12:55:41 +01:00
mips64_pracc.h mips: Add MIPS64 support 2019-11-28 16:59:15 +00:00
mips_ejtag.c Remove BUILD_TARGET64 2020-04-21 12:55:41 +01:00
mips_ejtag.h mips_ejtag: there is no DCR.MIPS64 bit 2020-01-20 06:28:49 +00:00
mips_m4k.c helper/command: change prototype of command_print/command_print_sameline 2019-05-14 19:37:11 +01:00
mips_m4k.h mips32: add micromips isa handling 2017-05-08 18:04:56 +01:00
mips_mips64.c Remove BUILD_TARGET64 2020-04-21 12:55:41 +01:00
mips_mips64.h mips64: Add generic mips64 target support 2019-11-28 19:49:10 +00:00
nds32.c gdb_server: fix string length with semihosting_fileio 2019-12-19 20:40:55 +00:00
nds32.h target/nds32: fix type of magic number 2020-02-15 15:36:56 +00:00
nds32_aice.c target: Add 64-bit target address support 2017-02-10 13:50:17 +01:00
nds32_aice.h target: Add 64-bit target address support 2017-02-10 13:50:17 +01:00
nds32_cmd.c coding style: add missing space when split strings 2020-05-09 14:39:44 +01:00
nds32_cmd.h Make #include guard naming consistent 2016-05-24 22:30:55 +01:00
nds32_disassembler.c coding style: avoid unnecessary line continuations 2020-05-09 14:39:29 +01:00
nds32_disassembler.h Make #include guard naming consistent 2016-05-24 22:30:55 +01:00
nds32_edm.h Make #include guard naming consistent 2016-05-24 22:30:55 +01:00
nds32_insn.h Make #include guard naming consistent 2016-05-24 22:30:55 +01:00
nds32_reg.c Remove FSF address from GPL notices 2016-05-24 22:30:01 +01:00
nds32_reg.h Make #include guard naming consistent 2016-05-24 22:30:55 +01:00
nds32_tlb.c target: Add 64-bit target address support 2017-02-10 13:50:17 +01:00
nds32_tlb.h target: Add 64-bit target address support 2017-02-10 13:50:17 +01:00
nds32_v2.c target: Add 64-bit target address support 2017-02-10 13:50:17 +01:00
nds32_v2.h Make #include guard naming consistent 2016-05-24 22:30:55 +01:00
nds32_v3.c target: Add 64-bit target address support 2017-02-10 13:50:17 +01:00
nds32_v3.h Make #include guard naming consistent 2016-05-24 22:30:55 +01:00
nds32_v3_common.c target: Add 64-bit target address support 2017-02-10 13:50:17 +01:00
nds32_v3_common.h target: Add 64-bit target address support 2017-02-10 13:50:17 +01:00
nds32_v3m.c target: Add 64-bit target address support 2017-02-10 13:50:17 +01:00
nds32_v3m.h Make #include guard naming consistent 2016-05-24 22:30:55 +01:00
oocd_trace.c helper/command: change prototype of command_print/command_print_sameline 2019-05-14 19:37:11 +01:00
oocd_trace.h Make #include guard naming consistent 2016-05-24 22:30:55 +01:00
quark_d20xx.c Remove FSF address from GPL notices 2016-05-24 22:30:01 +01:00
quark_x10xx.c target: quark_x10xx: miscellaneous cleanups 2018-01-13 09:25:12 +00:00
register.c gdb_server, rtos: Fine-grained RTOS register access 2019-08-28 08:07:37 +01:00
register.h gdb_server, rtos: Fine-grained RTOS register access 2019-08-28 08:07:37 +01:00
semihosting_common.c semihosting: reorganize semihosting commands 2020-03-10 20:20:22 +00:00
semihosting_common.h Rework/update ARM semihosting 2018-06-04 09:16:08 +01:00
smp.c helper/command: change prototype of command_print/command_print_sameline 2019-05-14 19:37:11 +01:00
smp.h smp: replace commands smp_on/smp_off with "smp [on|off]" 2019-03-27 08:55:03 +00:00
startup.tcl target: add examine-fail event 2020-03-12 09:43:55 +00:00
stm8.c stm8 target: make adapter speed settings work 2020-05-24 21:34:48 +01:00
stm8.h STM8 Target relicensing to GPLv2 and later 2019-11-07 08:21:40 +00:00
target.c Create `riscv repeat_read` command (#510) 2020-08-18 11:01:41 -07:00
target.h Create `riscv repeat_read` command (#510) 2020-08-18 11:01:41 -07:00
target_request.c helper/command: change prototype of command_print/command_print_sameline 2019-05-14 19:37:11 +01:00
target_request.h Make #include guard naming consistent 2016-05-24 22:30:55 +01:00
target_type.h Fix memory access on some targets. (#428) 2019-11-22 11:37:46 -08:00
testee.c command_registration: add empty usage field to chained commands 2019-04-07 08:17:36 +01:00
trace.c helper/command: change prototype of command_print/command_print_sameline 2019-05-14 19:37:11 +01:00
trace.h Make #include guard naming consistent 2016-05-24 22:30:55 +01:00
x86_32_common.c helper/command: change prototype of command_print/command_print_sameline 2019-05-14 19:37:11 +01:00
x86_32_common.h target: lakemon: implement assert_reset and deassert_reset 2018-01-13 09:25:34 +00:00
xscale.c coding style: add parenthesis around the argument of sizeof 2020-05-09 14:39:19 +01:00
xscale.h Make #include guard naming consistent 2016-05-24 22:30:55 +01:00