Skip to content

Instantly share code, notes, and snippets.

@compenguy
Last active July 27, 2021 20:13
Show Gist options
  • Save compenguy/3804750685b7ebff0ed510fce19828b2 to your computer and use it in GitHub Desktop.
Save compenguy/3804750685b7ebff0ed510fce19828b2 to your computer and use it in GitHub Desktop.
OpenOCD + BusBlaster v4

Setup

  1. Install OpenOCD.
  2. Plug the JTAG cable into the Bus Blaster's adapter board and the target.
  3. Run
arm-none-eabi-gdb path/to/firmware.elf -ex 'target remote | openocd -c "gdb_port pipe;" -f ../jtag/busblaster.cfg'

(adjust paths as appropriate) to launch gdb.

GDB commands

Basics

  • c - continue
  • ctrl-c - stop
  • p expr - print the value of the C expression expr
  • bt - stack backtrace
  • s - step instruction, goes into calls
  • n - next instruction, skips over calls
  • fin - run until return from function
  • break function - break at the beginning of a function (can also pass file.c:line)
  • delete 1 - delete the first breakpoint
  • tbreak - break only once

Hardware

  • mon reset - Reset cpu and all on-chip peripherals (like the reset button)
  • mon soft_reset_halt - Reset the CPU only

Bus Blaster

adapter driver ftdi
adapter speed 1000
ftdi_device_desc "Dual RS232-HS"
ftdi_vid_pid 0x0403 0x6010

ftdi_layout_init 0x0c08 0x0f1b
ftdi_layout_signal nTRST -data 0x0100 -noe 0x0400
ftdi_layout_signal nSRST -data 0x0200 -noe 0x0800

reset_config srst_only

transport select jtag
#the other option is swd - this bit I had to look up 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment