This wiki documents Piksi v2.3.1 which was discontinued April 1st, 2017.
Visit for newer products including Piksi Multi.

HOW-TO: Flashing and debugging the Piksi firmware using Black Magic Probe and gdb

From Swift Navigation Wiki
Jump to navigation Jump to search

You can do in-application debugging of Piksi's on-board microcontroller firmware if you have a compatible JTAG device. We highly recommend the Black Magic Probe.

If anything in this guide is incorrect or unclear, please email our mailing list.

Enter the Piksi firmware directory.

$ cd ~/piksi_firmware

Connect Piksi via USB, connect your JTAG device via USB, and connect your JTAG device via a 10 pin ribbon cable to Piksi.

There is a .gdbinit file in the piksi_firmware root directory that issues commands for connecting to the device and loading the firmware when gdb starts. You may need to edit this file to point to the correct virtual serial port for the Black Magic Probe. Edit this line:

target extended-remote /dev/ttyACM0

Substituting the correct USB serial device for /dev/ttyACM0, for example on OS X the correct device might be /dev/cu.usbmodem-??????

Run gdb, providing the path to the firmware to be loaded.

$ arm-none-eabi-gdb src/piksi_firmware.elf

NOTE: On some Linux installations you may get a permissions error:

/dev/ttyACM0: Permission denied

This can be fixed by adding your user to the dialout group as follows (you may need to log out and back in for this to take effect):

$ sudo adduser <username> dialout

Usage of gdb is beyond the scope of this quide but there are many excellent resources and tutorials online. Below are a couple of basic commands to get started:

To flash the firmware to the microcontroller (this is also done automatically on startup):

> load

To run the firmware:

> run

To break execution, press Ctrl+C

To resume:

> continue

To exit gdb, press Ctrl+D