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 { defineConfig } from 'astro/config';
import starlight from '@astrojs/starlight'; import starlight from '@astrojs/starlight';
import mermaid from 'astro-mermaid';
export default defineConfig({ export default defineConfig({
site: 'https://openocd-python.warehack.ing', site: 'https://openocd-python.warehack.ing',
telemetry: false, telemetry: false,
devToolbar: { enabled: false }, devToolbar: { enabled: false },
integrations: [ integrations: [
mermaid({ autoTheme: true }),
starlight({ starlight({
title: 'openocd-python', title: 'openocd-python',
description: 'Typed async-first Python bindings for OpenOCD', 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" "astro": "astro"
}, },
"dependencies": { "dependencies": {
"astro": "^5.17.2",
"@astrojs/starlight": "^0.35.0", "@astrojs/starlight": "^0.35.0",
"sharp": "^0.33.0", "@iconify-json/lucide": "^1.2.0",
"astro": "^5.17.2",
"astro-icon": "^1.1.0", "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 ## Exception hierarchy
``` ```mermaid
OpenOCDError graph TD
├── ConnectionError # TCP connection failures OpenOCDError --> ConnectionError
├── TimeoutError # Deadline exceeded OpenOCDError --> TimeoutError
├── TargetError # Target not responding or returned an error OpenOCDError --> TargetError
│ └── TargetNotHaltedError # Operation requires halted target TargetError --> TargetNotHaltedError
├── FlashError # Flash operation failed OpenOCDError --> FlashError
├── JTAGError # JTAG communication error OpenOCDError --> JTAGError
├── SVDError # SVD file or parsing error OpenOCDError --> SWDError
├── ProcessError # OpenOCD subprocess failed OpenOCDError --> SVDError
└── BreakpointError # Breakpoint/watchpoint operation failed OpenOCDError --> ProcessError
OpenOCDError --> BreakpointError
``` ```
All exceptions are importable from the top-level `openocd` package: All exceptions are importable from the top-level `openocd` package:
@ -33,6 +34,7 @@ from openocd import (
TargetNotHaltedError, TargetNotHaltedError,
FlashError, FlashError,
JTAGError, JTAGError,
SWDError,
SVDError, SVDError,
ProcessError, 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): An ARM CoreSight debug system has a **Debug Port** (DP) connected to one or more **Access Ports** (APs):
``` ```mermaid
┌─────────────┐ graph TD
│ DP │ ← DPIDR, TARGETID, CTRL/STAT DP["<b>Debug Port (DP)</b><br/>DPIDR · TARGETID · CTRL/STAT"]
│ (SWDIO) │ 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."]
│ AP #0 │ ← MEM-AP (AHB/APB/AXI bus access) APn["..."]
│ AP #1 │ ← JTAG-AP, additional MEM-AP, etc.
│ ... │ DP --> AP0
└─────────────┘ DP --> AP1
DP --> APn
``` ```
- **DP registers** (address 0x0 - 0x24): Debug port identification and control - **DP registers** (address 0x0 - 0x24): Debug port identification and control

View File

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