You can debug Tessel by soldering JTAG headers to the board and using a JTAG debugger. This tutorial asummes you are using a Bus Blaster and an associated JTAG 20 -> 10 pin adapter.
- Install OpenOCD. You need version >= 0.8.0.
- This version is not in Ubuntu 14.04, but the packages from Ubuntu Utopic work fine there
brew install libusb libftdi open-ocd
installs >= 0.8.0.
-
Acquire a configuration script for your Bus Blaster. Included in the firmware repo is
tools/tessel-busblaster.cfg
. -
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.
-
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.
c
- continuectrl-c
- stopp expr
- print the value of the C expressionexpr
bt
- stack backtraces
- step instruction, goes into callsn
- next instruction, skips over callsfin
- run until return from functionbreak function
- break at the beginning of a function (can also passfile.c:line
)delete 1
- delete the first breakpointtbreak
- break only once
mon reset
- Reset Tessel and all on-chip peripherals (like the reset button)mon soft_reset_halt
- Reset the CPU only
-
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 thenctrl-c
, it recovers. To debug the very beginning of execution, usemon soft_reset_halt tbreak main c
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/.