Expand description
en: A gdbstub Target for a CH32 RISC-V core reached over a DtmAccess transport.
Supports registers, memory read/write, halt/continue/single-step, and breakpoints. A break
GDB requests as software (Z0) is placed by the cheapest working mechanism, in order: a RAM
ebreak memory-patch; else a hardware execute trigger when the core has a free slot (no
wear); else a flash software breakpoint that rewrites the containing flash page (works on
triggerless cores, at the cost of flash wear). Hardware breakpoints use the RISC-V trigger
module (measured: 4 slots on QingKe V4F/CH32V307 and V4C/CH32X035, live-fire confirmed; 0 on
V4B/CH32V203, V2A/CH32V003, V3/CH32V103 - detected dynamically). Flash software breakpoints
need a verified FLASH-controller page profile; a family without one refuses them. Attach does not modify flash; flash breakpoints are removed and pages restored on
detach (docs/cli.ja.md §4.6).
ja: DtmAccess 上の CH32 RISC-V core 用 gdbstub Target。register・memory R/W・
halt/continue/step・breakpoint。GDB が software(Z0)で要求した break は、動く中で最も安い
手段の順(RAM ebreak patch → 空き HW trigger〔摩耗なし〕→ flash page 書き換えの flash SW
breakpoint〔trigger 無し core でも効くが flash 摩耗あり〕)で張る。hardware breakpoint は
RISC-V trigger module(実測: V4F/V307・V4C/X035 は 4 slot 実発火、V4B/V203・V2A/V003・V3/V103 は
0。動的検出)。flash SW breakpoint は検証済み FLASH-controller profile が必要(無い family では
断る)。attach で flash を書き換えず、flash breakpoint は detach 時に外して
page を復元する。
Structs§
- Ch32
Target - en: gdbstub target that OWNS its transport
T(owning, not borrowing, keeps the type free of a lifetime so it fitsBlockingEventLoop::Target). Recover the transport withCh32Target::into_innerto detach cleanly afterwards. ja: transportTを所有する gdbstub target(所有にすることでライフタイムが付かずBlockingEventLoop::Targetに収まる)。後始末はCh32Target::into_innerで回収する。 - Flash
Map - en: Code flash as GDB’s memory map shows it:
sizebytes at 0x0800_0000 and at its alias 0x0000_0000, erased inblock-byte pages; everything else is RAM to GDB (SRAM, peripherals). ja: GDB の memory map での code flash。0x0800_0000 と別名の 0x0000_0000 にsizeバイト、消去単位はblock。ほかは GDB には RAM(SRAM、周辺)。
Traits§
- Host
- en: What only the session’s owner can do to the target: reset it and write code flash. With
one (
Ch32Target::with_host) the server offersload(vFlash, with a memory map) and themonitorcommands GDB front ends send to OpenOCD (reset halt,halt,reset,resume,gdb_sync). ja: session の持ち主にしかできないこと(target の reset と code flash の書き込み)。これがあるとload(vFlash と memory map)と、GDB の front end が OpenOCD に送るmonitorコマンドを受ける。