Skip to content

Method Index

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.

MethodReturnDescription
connect(host="localhost", port=6666, timeout=10.0)SessionConnect to a running OpenOCD instance
start(config, *, tcl_port=6666, openocd_bin=None, timeout=10.0, extra_args=None)SessionSpawn OpenOCD and connect
connect_sync(host="localhost", port=6666, **kwargs)SyncSessionSync version of connect()
start_sync(config, **kwargs)SyncSessionSync version of start()
close()NoneClose connection and stop subprocess
command(cmd)strSend a raw command, return response
on_halt(callback)NoneRegister halt notification callback
on_reset(callback)NoneRegister reset notification callback

Properties: target, memory, registers, flash, jtag, breakpoints, rtt, svd, transport

MethodReturnDescription
halt()TargetStateHalt the target
resume(address=None)NoneResume execution, optionally from an address
step(address=None)TargetStateSingle-step one instruction
reset(mode="halt")NoneReset the target ("run", "halt", or "init")
wait_halt(timeout_ms=5000)TargetStateBlock until halted or timeout
state()TargetStateQuery current target state
MethodReturnDescription
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)bytesRead raw bytes
write_u8(addr, values)NoneWrite 8-bit values
write_u16(addr, values)NoneWrite 16-bit values
write_u32(addr, values)NoneWrite 32-bit values
write_bytes(addr, data)NoneWrite raw bytes
search(pattern, start, end)list[int]Search for byte pattern in memory
dump(addr, size, path)NoneDump memory region to file
hexdump(addr, size)strFormatted hex+ASCII dump
MethodReturnDescription
read(name)intRead a single register by name
write(name, value)NoneWrite 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()intRead the program counter
sp()intRead the stack pointer
lr()intRead the link register
xpsr()intRead the xPSR register
MethodReturnDescription
banks()list[FlashBank]List all configured flash banks
info(bank=0)FlashBankDetailed bank info with sectors
read(bank, offset, size)bytesRead raw flash content
read_to_file(bank, path)NoneDump entire bank to file
write(bank, offset, data)NoneWrite raw bytes to flash
write_image(path, erase=True, verify=True)NoneHigh-level flash programming
erase_sector(bank, first, last)NoneErase a sector range
erase_all(bank=0)NoneErase entire bank
protect(bank, first, last, on)NoneSet/clear write protection
verify(bank, path)boolVerify flash against a file
MethodReturnDescription
add(address, length=2, hw=False)NoneSet a breakpoint
remove(address)NoneRemove a breakpoint
list()list[Breakpoint]List active breakpoints
add_watchpoint(address, length, access="rw")NoneSet a data watchpoint
remove_watchpoint(address)NoneRemove a watchpoint
list_watchpoints()list[Watchpoint]List active watchpoints
MethodReturnDescription
scan_chain()list[TAPInfo]Enumerate TAPs on the chain
new_tap(chip, tap, ir_len, expected_id=None)NoneDeclare a new TAP
irscan(tap, instruction)intShift instruction into IR
drscan(tap, bits, value)intShift data through DR
runtest(cycles)NoneClock TCK in Run-Test/Idle
pathmove(states)NoneWalk TAP through state sequence
svf(path, tap=None, *, quiet=False, progress=True)NoneExecute SVF file
xsvf(tap, path)NoneExecute XSVF file
Method / PropertyReturnDescription
load(svd_path)NoneParse an SVD XML file
loaded (property)boolWhether an SVD is loaded
list_peripherals()list[str]Sorted peripheral names
list_registers(peripheral)list[str]Sorted register names
read_register(peripheral, register)DecodedRegisterRead from hardware and decode
read_peripheral(peripheral)dict[str, DecodedRegister]Read all registers in a peripheral
decode(peripheral, register, value)DecodedRegisterDecode without hardware read
MethodReturnDescription
setup(address, size, id_string="SEGGER RTT")NoneConfigure control block search
start()NoneFind control block, activate channels
stop()NoneDeactivate RTT
channels()list[RTTChannel]List discovered channels
read(channel)strRead from an up-channel
write(channel, data)NoneWrite to a down-channel
MethodReturnDescription
select()strGet the active transport name
list()list[str]List available transports
adapter_info()strGet adapter description
adapter_speed(khz=None)intGet or set adapter speed in kHz
Method / PropertyReturnDescription
enable()NoneEnable TCL notifications
on(event_type, callback)NoneRegister event callback
off(event_type, callback)NoneUnregister event callback
enabled (property)boolWhether notifications are active