Navigation Menu

Skip to content
gebart edited this page Nov 26, 2014 · 1 revision

GDB is used to debug Mulle applications. OpenOCD opens up a local server which GDB will connect to.

Contiki

In Contiki mulle-master, the debug-server Makefile target will start a gdb server using OpenOCD.

Specify the programmer serial the same way as for flashing:

export PROGRAMMER_SERIAL=123

replace 123 with the number on the sticker on the programming board.

Note: It is not possible to distinguish the Mulle device by its serial number when connected via the programmer board, only the programmer boards' serial numbers themselves.

Then:

make debug-server

will launch a GDB server.

Connecting to the debug server

In a second terminal, again, specify the programmer serial the same way as for flashing:

export PROGRAMMER_SERIAL=123

replace 123 with the number on the sticker on the programming board.

then launch GDB by running:

make debug

in the project directory.

Useful GDB commands

  • load - loads the program binary into the Mulle CPU flash. This has the same effect as make flash.
  • c - continue the program execution
  • bt - print a backtrace.
  • ctrl+c (when running) - stop program execution.
  • mon help - list all OpenOCD-specific commands.
  • mon [command] - send [command] to OpenOCD. See OpenOCD manual for further information.

See also: http://www.stanford.edu/class/cs107/other/gdbrefcard.pdf

Multiple programmer boards

It is possible to use multiple programmer boards simultaneously, you must make sure that every running instance of OpenOCD uses a separate port number. Otherwise errors such as "Address already in use" or similar messages will appear when starting OpenOCD indicating that the port number needs to be changed.

To change the port, if running OpenOCD from the Contiki build system: set the GDB_PORT environment variable to a unique number in the interval 1024 <= GDB_PORT <= 65535.

Note that it is not necessary to keep an openocd process running in order to use the UART. For example, running the rpl-border-router on one board and running a sensor application being debugged on another board.