Skip to main content

SerialUPDI-based GDB RSP server for AVR8X microcontrollers

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

avr_absurd-1.0.1.tar.gz (27.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

avr_absurd-1.0.1-py3-none-any.whl (26.0 kB view details)

Uploaded Python 3

File details

Details for the file avr_absurd-1.0.1.tar.gz.

File metadata

  • Download URL: avr_absurd-1.0.1.tar.gz
  • Upload date:
  • Size: 27.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.1

File hashes

Hashes for avr_absurd-1.0.1.tar.gz
Algorithm Hash digest
SHA256 2413140b890baec529d8bb6fcd9734313fa3ca4747f11242a4aafeaa0e7d08b5
MD5 a55f262408fd71ba58874db66ccdfc2f
BLAKE2b-256 03cbdb9ad44b51555fe90aabf94335decb58f140f21d61d3fdf508c98638dc32

See more details on using hashes here.

File details

Details for the file avr_absurd-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: avr_absurd-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 26.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.1

File hashes

Hashes for avr_absurd-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 67f633d48ba3c7b4c6f69077960110c598d803191491ea333219dba075c26e08
MD5 7c61476431bf40be4ffa2ed366f1ca37
BLAKE2b-256 39878105447b9b3f1efb486939b012840efb1f31fc7641ada48917531cbeab1a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page