Replace ASCII diagrams with Mermaid, add missing SWDError to hierarchy

Use astro-mermaid (client-side) for 3 diagrams: DAP architecture in
swd-operations, exception hierarchy in error-handling and exceptions
reference. Also fixes stale error-handling.mdx that was missing SWDError
from the hierarchy diagram and import example.
This commit is contained in:
Ryan Malloy 2026-02-17 23:47:40 -07:00
parent 17e8070c50
commit b571cb02ea
6 changed files with 1200 additions and 35 deletions

View File

@ -1,11 +1,13 @@
import { defineConfig } from 'astro/config';
import starlight from '@astrojs/starlight';
import mermaid from 'astro-mermaid';
export default defineConfig({
site: 'https://openocd-python.warehack.ing',
telemetry: false,
devToolbar: { enabled: false },
integrations: [
mermaid({ autoTheme: true }),
starlight({
title: 'openocd-python',
description: 'Typed async-first Python bindings for OpenOCD',

1158
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -10,10 +10,12 @@
"astro": "astro"
},
"dependencies": {
"astro": "^5.17.2",
"@astrojs/starlight": "^0.35.0",
"sharp": "^0.33.0",
"@iconify-json/lucide": "^1.2.0",
"astro": "^5.17.2",
"astro-icon": "^1.1.0",
"@iconify-json/lucide": "^1.2.0"
"astro-mermaid": "^1.3.1",
"mermaid": "^11.12.3",
"sharp": "^0.33.0"
}
}

View File

@ -9,17 +9,18 @@ openocd-python uses a structured exception hierarchy rooted at `OpenOCDError`. E
## Exception hierarchy
```
OpenOCDError
├── ConnectionError # TCP connection failures
├── TimeoutError # Deadline exceeded
├── TargetError # Target not responding or returned an error
│ └── TargetNotHaltedError # Operation requires halted target
├── FlashError # Flash operation failed
├── JTAGError # JTAG communication error
├── SVDError # SVD file or parsing error
├── ProcessError # OpenOCD subprocess failed
└── BreakpointError # Breakpoint/watchpoint operation failed
```mermaid
graph TD
OpenOCDError --> ConnectionError
OpenOCDError --> TimeoutError
OpenOCDError --> TargetError
TargetError --> TargetNotHaltedError
OpenOCDError --> FlashError
OpenOCDError --> JTAGError
OpenOCDError --> SWDError
OpenOCDError --> SVDError
OpenOCDError --> ProcessError
OpenOCDError --> BreakpointError
```
All exceptions are importable from the top-level `openocd` package:
@ -33,6 +34,7 @@ from openocd import (
TargetNotHaltedError,
FlashError,
JTAGError,
SWDError,
SVDError,
ProcessError,
)

View File

@ -37,15 +37,16 @@ Both transports share the higher-level subsystems (target, memory, registers, fl
An ARM CoreSight debug system has a **Debug Port** (DP) connected to one or more **Access Ports** (APs):
```
┌─────────────┐
│ DP │ ← DPIDR, TARGETID, CTRL/STAT
│ (SWDIO) │
├─────────────┤
│ AP #0 │ ← MEM-AP (AHB/APB/AXI bus access)
│ AP #1 │ ← JTAG-AP, additional MEM-AP, etc.
│ ... │
└─────────────┘
```mermaid
graph TD
DP["<b>Debug Port (DP)</b><br/>DPIDR · TARGETID · CTRL/STAT"]
AP0["<b>AP #0</b> — MEM-AP<br/>AHB / APB / AXI bus access"]
AP1["<b>AP #1</b> — JTAG-AP<br/>Additional MEM-AP, etc."]
APn["..."]
DP --> AP0
DP --> AP1
DP --> APn
```
- **DP registers** (address 0x0 - 0x24): Debug port identification and control

View File

@ -25,18 +25,18 @@ from openocd.breakpoints import BreakpointError
## Hierarchy
```
OpenOCDError
+-- ConnectionError
+-- TimeoutError
+-- TargetError
| +-- TargetNotHaltedError
+-- FlashError
+-- JTAGError
+-- SWDError
+-- SVDError
+-- ProcessError
+-- BreakpointError
```mermaid
graph TD
OpenOCDError --> ConnectionError
OpenOCDError --> TimeoutError
OpenOCDError --> TargetError
TargetError --> TargetNotHaltedError
OpenOCDError --> FlashError
OpenOCDError --> JTAGError
OpenOCDError --> SWDError
OpenOCDError --> SVDError
OpenOCDError --> ProcessError
OpenOCDError --> BreakpointError
```
<Aside type="note">