This tutorial details how to use the Debuggoid to interact with a target.
Required elements
- a wifi connection and a MQTT broker,
- a configured Debuggoid to use this wifi connection and MQTT broker,
- packages:
arm-none-eabi-gdb mosquitto-clients
.
How-to
Flash a target
-
Compile the code using the corresponding toolchain, such as Arduino for DecaDuino or DMOSDK. An elf file is generated.
-
Make a
flash.gdb
file that contains the instructions for gdb. In the file, replace<hostname>
by the hostname or the IP address of the Debuggoid.
target extended-remote <hostname>:2022
load
run
detach
quit
This gdb example script will load the binary into the target, run the program and than detach and quit gdb. Please refer to gdb documentation to get the commands available with GDB.
- From the Linux terminal, launch the script:
$ arm-none-eabi-gdb blink.ino.elf -x flash.gdb
Access to target serial console via MQTT
The target serial console is automatically attached to the MQTT bridge of the debuggoid. Printed chars on console output (such as printf()
or Serial.println()
) are published on the debuggoid/<debuggoid_name>/out
topic, and chars can be sent to the target using debuggoid/<debuggoid_name>/in
topic.
Examples
Subscribe example to see chars from the target:
$ mosquitto_sub -h <broker_hostname> -t "debuggoid/<debuggoid_name>/out"
Publish example to send a Hello world!
string to the target:
$ mosquitto_pub -h <broker_hostname> -t "debuggoid/<debuggoid_name>/in" -m "Hello world!"
Debug a target
Debuggoid accepts gdb debugging commands. Please refer to gdb documentation to get the commands available with GDB.