A quick-reference index of every public method in openocd-python, organized by subsystem. Each entry shows the method signature, return type, and a brief description.
| Method | Return | Description |
|---|
connect(host="localhost", port=6666, timeout=10.0) | Session | Connect to a running OpenOCD instance |
start(config, *, tcl_port=6666, openocd_bin=None, timeout=10.0, extra_args=None) | Session | Spawn OpenOCD and connect |
connect_sync(host="localhost", port=6666, **kwargs) | SyncSession | Sync version of connect() |
start_sync(config, **kwargs) | SyncSession | Sync version of start() |
close() | None | Close connection and stop subprocess |
command(cmd) | str | Send a raw command, return response |
on_halt(callback) | None | Register halt notification callback |
on_reset(callback) | None | Register reset notification callback |
Properties: target, memory, registers, flash, jtag, breakpoints, rtt, svd, transport
| Method | Return | Description |
|---|
halt() | TargetState | Halt the target |
resume(address=None) | None | Resume execution, optionally from an address |
step(address=None) | TargetState | Single-step one instruction |
reset(mode="halt") | None | Reset the target ("run", "halt", or "init") |
wait_halt(timeout_ms=5000) | TargetState | Block until halted or timeout |
state() | TargetState | Query current target state |
| Method | Return | Description |
|---|
read_u8(addr, count=1) | list[int] | Read 8-bit values |
read_u16(addr, count=1) | list[int] | Read 16-bit values |
read_u32(addr, count=1) | list[int] | Read 32-bit values |
read_u64(addr, count=1) | list[int] | Read 64-bit values |
read_bytes(addr, size) | bytes | Read raw bytes |
write_u8(addr, values) | None | Write 8-bit values |
write_u16(addr, values) | None | Write 16-bit values |
write_u32(addr, values) | None | Write 32-bit values |
write_bytes(addr, data) | None | Write raw bytes |
search(pattern, start, end) | list[int] | Search for byte pattern in memory |
dump(addr, size, path) | None | Dump memory region to file |
hexdump(addr, size) | str | Formatted hex+ASCII dump |
| Method | Return | Description |
|---|
read(name) | int | Read a single register by name |
write(name, value) | None | Write a value to a register |
read_all() | dict[str, Register] | Read all registers |
read_many(names) | dict[str, int] | Read several registers by name |
pc() | int | Read the program counter |
sp() | int | Read the stack pointer |
lr() | int | Read the link register |
xpsr() | int | Read the xPSR register |
| Method | Return | Description |
|---|
banks() | list[FlashBank] | List all configured flash banks |
info(bank=0) | FlashBank | Detailed bank info with sectors |
read(bank, offset, size) | bytes | Read raw flash content |
read_to_file(bank, path) | None | Dump entire bank to file |
write(bank, offset, data) | None | Write raw bytes to flash |
write_image(path, erase=True, verify=True) | None | High-level flash programming |
erase_sector(bank, first, last) | None | Erase a sector range |
erase_all(bank=0) | None | Erase entire bank |
protect(bank, first, last, on) | None | Set/clear write protection |
verify(bank, path) | bool | Verify flash against a file |
| Method | Return | Description |
|---|
add(address, length=2, hw=False) | None | Set a breakpoint |
remove(address) | None | Remove a breakpoint |
list() | list[Breakpoint] | List active breakpoints |
add_watchpoint(address, length, access="rw") | None | Set a data watchpoint |
remove_watchpoint(address) | None | Remove a watchpoint |
list_watchpoints() | list[Watchpoint] | List active watchpoints |
| Method | Return | Description |
|---|
scan_chain() | list[TAPInfo] | Enumerate TAPs on the chain |
new_tap(chip, tap, ir_len, expected_id=None) | None | Declare a new TAP |
irscan(tap, instruction) | int | Shift instruction into IR |
drscan(tap, bits, value) | int | Shift data through DR |
runtest(cycles) | None | Clock TCK in Run-Test/Idle |
pathmove(states) | None | Walk TAP through state sequence |
svf(path, tap=None, *, quiet=False, progress=True) | None | Execute SVF file |
xsvf(tap, path) | None | Execute XSVF file |
| Method / Property | Return | Description |
|---|
load(svd_path) | None | Parse an SVD XML file |
loaded (property) | bool | Whether an SVD is loaded |
list_peripherals() | list[str] | Sorted peripheral names |
list_registers(peripheral) | list[str] | Sorted register names |
read_register(peripheral, register) | DecodedRegister | Read from hardware and decode |
read_peripheral(peripheral) | dict[str, DecodedRegister] | Read all registers in a peripheral |
decode(peripheral, register, value) | DecodedRegister | Decode without hardware read |
| Method | Return | Description |
|---|
setup(address, size, id_string="SEGGER RTT") | None | Configure control block search |
start() | None | Find control block, activate channels |
stop() | None | Deactivate RTT |
channels() | list[RTTChannel] | List discovered channels |
read(channel) | str | Read from an up-channel |
write(channel, data) | None | Write to a down-channel |
| Method | Return | Description |
|---|
select() | str | Get the active transport name |
list() | list[str] | List available transports |
adapter_info() | str | Get adapter description |
adapter_speed(khz=None) | int | Get or set adapter speed in kHz |
| Method / Property | Return | Description |
|---|
enable() | None | Enable TCL notifications |
on(event_type, callback) | None | Register event callback |
off(event_type, callback) | None | Unregister event callback |
enabled (property) | bool | Whether notifications are active |