Skip to main content

AVR Basic SerialUPDI RSP Debugger

ABSURD is a Python-based GDB remote server that allows GDB to interact with the on-chip debugger (OCD) of modern AVR microcontrollers ("AVR8X") via SerialUPDI.
ABSURD is licensed under the MIT License.

Requirements

  • SerialUPDI programmer (USB-UART adapter with its TX and RX connected by a Schottky diode to simulate a half-duplex line)
  • AVR8X microcontroller with UPDI
    • MegaAVR 0-Series (ATmega__0_)
    • TinyAVR 0/1/2-Series (ATtiny__0_, ATtiny__1_, ATtiny__2_)
    • AVR Dx Series (AVR___DA__[S], AVR___DB__, AVR__DD__, AVR__DU__)
    • AVR Ex Series (AVR__EA__, AVR16EB__)
    • AVR Sx Series (AVR32SD__)
    • AVR Lx Series (AVR__LA__)
  • pySerial Python library

[!NOTE] ABSURD has only been tested with a subset of the devices listed above. Given it is based on guesswork, overgeneralization is quite possible. At the time of writing, no experiments have been performed with SD, and LA remains a header-only device.

Serial port configuration

Transmission through a serial port may be buffered by OS or device driver. Typically, the buffer is flushed when it is full or after a certain timeout. This can cause significant delay with UPDI communication, which involves back-and-forth exchange of small packets. To mitigate this issue, minimize the buffering timeout in the way specific to OS and UART adapter in use.

Note that a "minimal" timeout like 1 ms is still much longer than a UART character or an AVR clock cycle. This limitation is inherent to the SerialUPDI approach.

Usage

  • Install ABSURD with pip install absurd
    • Alternatively, clone this repository and install with pip install -e . for development
  • Connect MCU to PC with a SerialUPDI programmer
  • avr-absurd -P [serial port name]
    • or python -m absurd instead of avr-absurd if it is not in PATH
  • Run avr-gdb and connect to the server with target extended-remote :[TCP port number]
  • Optional parameters
    • -b/--bps baud rate (default: 115200). This can be higher (up to 1.8 MHz) with good SerialUPDI adapters.
    • -r/--rsp-port TCP port number for RSP (default: 3333)
    • -s/--swbp enable software breakpoints. Note that use of software breakpoints consumes flash erase/write cycles, and is incompatible with in-application programming
    • -v/--verbose print more logs

Features

  • Instruction-level stepping
  • Two hardware breakpoints
  • Optional software breakpoints
    • Wear minimized by use of instruction injection
  • Break on...
    • change of flow (after any skip/branch)
    • interrupt
    • external trigger
  • Read/write access to register file, RAM and peripheral SFRs
  • Flash programming through load command
    • Other NVMs (EEPROM/User Row/Boot Row/Fuses) are not supported

Fixed problems

  • OCD v0 (Tiny 0/1) support
  • Interrupt handling during stepping
  • RSP packet checksum handling

TODO

  • Check auto-detected chip identity/parameters against specified one
    • Chip database to support it
  • Chip parameter override

For developers

  • Breaking API change were made to internals
  • My guesswork on OCD registers is available here.

Metadata

Release files for avr-absurd 1.0.1

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

Source distribution (sdist)

Source distribution for avr-absurd 1.0.1
File Size Uploaded
avr_absurd-1.0.1.tar.gz 27.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for avr-absurd 1.0.1
File Interpreter ABI Platform
avr_absurd-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 53.3 kB

Release files / avr_absurd-1.0.1.tar.gz

Download URL avr_absurd-1.0.1.tar.gz
Size 27.4 kB
Tags Source
SHA-256 checksum
How to use checksums
2413140b890baec529d8bb6fcd9734313fa3ca4747f11242a4aafeaa0e7d08b5
BLAKE2b-256 checksum
How to use checksums
03cbdb9ad44b51555fe90aabf94335decb58f140f21d61d3fdf508c98638dc32
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.1

Release files / avr_absurd-1.0.1-py3-none-any.whl

Download URL avr_absurd-1.0.1-py3-none-any.whl
Size 26.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
67f633d48ba3c7b4c6f69077960110c598d803191491ea333219dba075c26e08
BLAKE2b-256 checksum
How to use checksums
39878105447b9b3f1efb486939b012840efb1f31fc7641ada48917531cbeab1a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.1

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files

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