How riscv-collab/riscv-openocd works
Core Components (Main Layers)
a. Interface Layer
• Supported hardware interfaces (JTAG, SWD, etc.)
• Interface adapter drivers (FTDI, CMSIS-DAP, ST-LINK, etc.)
b. Transport Layer
• Above the interface layer
• JTAG and SWD protocol implementations
• Debug transport abstractions
c. Target Layer
• Above the transport layer
• CPU architecture support (ARM, RISC-V, MIPS, etc.)
• Flash drivers and target-specific implementations
d. Server Layer
• Supported protocols (GDB, Telnet, TCL)
• Command interpreter
Cross-cutting Components
a. Helper/Utility Services
• On the side
• Common utilities (logging, configuration, etc.)
b. TCL Scripting Engine
• As an interconnecting component
• How it interfaces with all layers
• Use a distinctive pattern or border
Key Interactions
a. Data Flow
• Direction from interface through layers to servers
• Bidirectional communication where applicable
b. Control Flow
• Configuration and command paths
• Initialization sequences
External Interfaces
a. Client Tools
• GDB, IDEs, and other tools at the top
• To appropriate server interfaces
• Use external entity symbols
b. Hardware Connections
• Debug adapters at the bottom
• Target devices
• Use hardware symbols
Important Details
a. Configuration System
• How config files are processed
• Board, target, and interface configs
• Where TCL scripts integrate
b. Flash Programming
• Flash algorithm loading path
• Flash driver architecture
• Memory access paths
Implementation Notes
• Clear labels for all components
• Version or date of the architecture
• Brief descriptions of key components
Architectural Patterns
• Layered architecture
• Plugin system for drivers
• Command handling flow
• Demonstrate extensibility points
Remember to:
• Sufficient detail for implementation understanding
• Both static structure and dynamic interactions
This architecture reflects OpenOCD's modular design and its ability to support multiple debug adapters, targets, and client protocols while maintaining a clean separation of concerns.