Skip to content

Instantly share code, notes, and snippets.

@tcr
Forked from kevinmehall/README.md
Last active August 29, 2015 14:03
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save tcr/ba2a9356d577c36b3d2c to your computer and use it in GitHub Desktop.

Setup

  1. Install OpenOCD. You need version >= 0.8.0.
  1. Acquire a configuration script for your Bus Blaster. Included in the firmware repo is tools/tessel-busblaster.cfg.

  2. Plug the JTAG cable into the Bus Blaster's adapter board and the Tessel. Pin one is towards the USB port; the cable goes over the center of the board.

  3. Run

arm-none-eabi-gdb out/Release/tessel-firmware.elf -ex 'target remote | openocd -c "gdb_port pipe;" -f tools/tessel-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 Tessel and all on-chip peripherals (like the reset button)
  • mon soft_reset_halt - Reset the CPU only

Other notes

  • Make sure your .elf file matches the firmware on the Tessel. Otherwise the position information will be wrong and calls will crash.

  • LPC1800 SPIFI Flash is functional from OpenOCD, but I don't recommend using it. Flash Tessel with the bootloader (make arm-deploy) before running GDB.

  • The ROM confuses JTAG on reset. If you c and then ctrl-c, it recovers. To debug the very beginning of execution, use

    mon soft_reset_halt
    tbreak main
    c
    

Troubleshooting

OS X: If you are getting a libusb error, you may need to disable some system drivers in order for OpenOCD to work. Run kextstat | grep -i ftdi. If any drivers are listed, you need to run either sudo kextunload -bundle com.apple.driver.AppleUSBFTDI and/or sudo kextunload -bundle com.FTDI.driver.FTDIUSBSerialDriver. For a long-term solution for configuring this, see http://alvarop.com/2014/01/using-busblaster-openocd-on-osx-mavericks/.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment