Skip to main content

Arduino debugger

This is a console debugger for use with sketches running on an embedded Arduino system. After uploading your sketch to the Arduino, you can connect the serial port to your computer and debug your running sketch with this application.

debugger screenshot

You must include a small debugging library (dbg.cpp and PyArduinoDebug.h) available at https://github.com/kimballa/PyArduinoDebug in your application.

  • Arduino IDE users can include the PyArduinoDebug library in their sketch dependencies.
  • If compiling with a Makefile, you should #include <PyArduinoDebug.h> and link with libPyArduinoDebug.a to enable debugging your sketch.

You will find instructions in PyArduinoDebug.h on the API for creating unconditional and assertion-based breakpoints, and emitting debug and trace messages.

Setup

  • Install this debugger and its dependencies with: pip install .
  • If not already installed, install binutils through your OS package manager.
  • Clone and build the Arduino library with make install.
  • Follow instructions in PyArduinoDebug.h to include in your application.
  • Run arduino-dbg to launch the debug console. Use -h to see CLI options.
  • Set your Arduino platform: e.g.: set arduino.platform = uno
  • Use the help command at the prompt to see available capabilities.

Usage

Typical usage is something like:

arduino-dbg -f /path/to/sketch.elf -p /dev/ttyACM0

(Assuming your Arduino's USB serial port connection is on ttyACM0.)

If you run the break command or press ^C within the debugger, it will pause the running sketch so you can interrogate or set the values of variables (print someglobal), see a backtrace, etc. Programmatic breakpoints can be selectively toggled on and off with breakpoint enable and breakpoint disable. New breakpoints can be created from the debugger at runtime only on platforms like the ARM Cortex-M4 which support monitor-mode debugging. On AVR CPUs, you are restricted to breakpoints added statically in the source code.

Within the debugger, you can save a dump of the system registers and memory with dump <filename>. With this dump file and the compiled ELF file of your sketch, you can then perform offline debugging later with arduino-dbg -d /path/to/filename.dump, or by running load /path/to/filename.dump within the debugger.

The dump file will retain the filename of your sketch's ELF file. If you move it to a different location, you can open the ELF file with open /path/to/my.elf within the debugger after running the load command.

There are several additional commands. Typing help will list available commands in the debugger. Type help <command> to see usage information for each specific command.

Type quit, exit, or \q to quit the debugger.

Arduino platforms

You should specify what Arduino platform you are using with the set command. e.g.:

set arduino.platform = uno

The available platforms are:

  • feather_m4
  • leonardo
  • uno

You can see an up-to-date list of supported Arduino platforms with the list platforms command. The list architectures command will display supported CPU architectures.

By default the platform is auto, and the debugger will attempt to auto-detect your CPU. You can force auto-detection with:

set arduino.platform = auto

Please open an issue if you are interested in support for additional platforms. At the time of this writing, the debugger has the ability to support AVR- and ARM-based platforms; each new cpu or platform in these families just requires a new configuration file to be added and tested.

Type set to see more configuration variables you can modify. Once set, configuration is saved to ~/.arduino_dbg.conf and reused in future sessions. You can delete this file and restart the debugger to reinitialize the default configuration.

CPU-assisted debugger support

This debugger can perform useful functions on any Arduino with a USB-serial connection. The debugger service can be activated by breakpoints introduced with the BREAK() macro or by issuing the break (^C) command within the debugger prompt.

Beyond that, for CPUs that support "monitor-mode debugging" (where debug events trigger an IRQ which can be handled with onboard software, rather than requiring control by an external JTAG debugger), such as the ARM SAMD51-based Cortex-M4, used in the Adafruit Feather-M4 platform, this debugger can also take advantage of CPU-assisted debugging features such as single-stepping with the step (\s) command, or using the ability to create new breakpoints or watchpoints dynamically at run-time.

On such platforms, the ARM BKPT opcode will also properly enter the debugger service.

License

This project is licensed under the BSD 3-Clause license. See LICENSE.txt for complete details.

Metadata

Release files for arduino-dbg 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for arduino-dbg 0.2.0
File Size Uploaded Provenance Actions
arduino-dbg-0.2.0.tar.gz 881.5 kB Without provenance Details for arduino-dbg-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for arduino-dbg 0.2.0
File Interpreter ABI Platform Actions
arduino_dbg-0.2.0-py3-none-any.whl Python 3 none any Details for arduino_dbg-0.2.0-py3-none-any.whl

Total release size: 1.0 MB

Release files / arduino-dbg-0.2.0.tar.gz

Download URL arduino-dbg-0.2.0.tar.gz
Size 881.5 kB
Tags Source
SHA-256 checksum
How to use checksums
2798b7971139d7cacc893bfac4c790d5218026473afc14e9a07b931a953f2583
BLAKE2b-256 checksum
How to use checksums
30561b82ec5f313c4cb491264838409bd91120937408c0ba4ce2f4708e5d206b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.22.0 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/18.0.1 rfc3986/2.0.0 colorama/0.4.3 CPython/3.8.10

Release files / arduino_dbg-0.2.0-py3-none-any.whl

Download URL arduino_dbg-0.2.0-py3-none-any.whl
Size 154.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
42be7f61012ba2502ecbc265c4a11a057349fad276af605027439423f46277fb
BLAKE2b-256 checksum
How to use checksums
e067d5c55f966597d47d51cdfaad96622de52e2371072c89842dd92269af7d55
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.22.0 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/18.0.1 rfc3986/2.0.0 colorama/0.4.3 CPython/3.8.10

Security for arduino-dbg 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page