Openocd
From Leo's Notes
This page was last edited on 25 May 2021, at 21:42.
Cheat Sheet
For a comprehensive list of commands, see: http://www.openocd.org/doc/html/General-Commands.html
| Command | Description |
|---|---|
init
|
initalize |
halt
|
halt the processor |
reset halt
|
reset device and halt |
reset run
|
reset device and start execution |
flash list
|
lists detected flash devices |
flash read_bank <bank> <outputfile>
|
Reads the entire bank of flash memory into an output file.
Eg. read the first 32KB of flash memory |
reg
|
shows all registers |
reg <register>
|
Shows a specific register. Eg. reg r0.
|
md{d,w,h,b} <address>
|
Memory access (d = double/64 bit, w = word/32 bit, h = half/16 bit, b = byte/8 bit) |
mw{d,w,h,b} <address>
|
Memory write (same units above). |
Interfacing with STM32F100
There are some specific commands for the STM32F100 through the stm32f1x commands. To begin, run:
# openocd -f interface/stlink-v2.cfg -f target/stm32f1x.cfg
You may use the commands listed in the cheat sheet above and also the STM32 specific commands below.
| Command | Description |
|---|---|
stm32f1x mass_erase 0
|
Erase |
stm32f1x options_read 0
|
Check set options, such as if readout protection is enabled. |
stm32f1x unlock 0
|
Unlock the readout protection (Warning: erases existing contents!) |