Coder Social home page Coder Social logo

debugwire-gdb-bridge's Introduction

debugwire-gdb-bridge

About

This is a Pascal implementation of the debugwire protocol for small AVR controllers such as attiny85 or atmega328P. It includes a gdb remote serial protocol server so that a debugger such as gdb or LazDebuggerFpRspRemote in Lazarus can communicate with the debugwire implementation to debug on-chip code. The aim is to focus on features that would enable one to use Lazarus to both write code for and debug the generated code on compatible AVR microcontrollers.

A simple USB-serial adapter can be used to interface with hardware, see hardware documentation.

Usage

Run the dw_gdb executable and a serial port (mandatory) to connect to. It will connect to the serial port and if successfull, open a TCP port (default 1234) and wait for a TCP connection from a debugger. A baud rate can be specified for the serial connection - if not a baud rate scan will be done. The DWEN fuse can be diabled temporarily to enable ISP programming. The general syntax and command line options supported are:

dw_gdb -S <sp> [-B <bd>] [-T <tp>] [-I] [-V] [-H]

-S <sp>, -s <sp>, --serialport=<sp>
Connect to serial port <sp>, e.g. /dev/ttyUSB0

-B <bd>, -b <bd>, --baud=<bd>
Connect to serial port using baud rate <bd>.  If not specified, the debugWIRE baud rate will be scanned automatically.

-T <tp>, -t <tp>, --tcpport=<tp>
Set TCP port <tp> for remote connection.  If not specified, TCP port defaults to 1234.

-I, -i, --ispenable
Temporarily disable DWEN fuse to enable ISP functionality and exit.

-V, -v, --verbose
Enable verbose debug output.

-H, -h, -?, --help
Display this help and exit.

Note that parameters for long options can be separated by a = or a space.

References

Special thanks to RikusW and others for documenting the debugwire protocol:
http://www.ruemohr.org/docs/debugwire.html

Other debugwire implementations that in some way inspired this work:
https://github.com/dcwbrown/dwire-debug
https://github.com/mvirkkunen/dwprog
https://github.com/jbtronics/WireDebugger

Todo list:

  • Scan candidate serial ports automatically to detect a debugwire compatible device. This could potentially affect other serial connected hardware, so caution is required. See this link for Windows and this link for Linux.

debugwire-gdb-bridge's People

Contributors

ccrause avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

dioannidis

debugwire-gdb-bridge's Issues

Software breakpoints not always updated correctly during debugging

When several breakpoints are in play some breakpoints are written to flash. These breakpoints are not always removed when deleted in Lazarus and debugging continues. All software breakpoints seem to be properly removed when closing a debugging session. This may therefore be a bug in either TBPManager.DeleteBP or TBPManager.FinalizeBPs.

Flash writes fail on atmega328p

Writing to new data to flash proceeds through flash reading, flash erasure and filling temp page but fails when writing the temp page to flash.

Flash upload sometimes corrupts first two bytes

Testing flash uploads revealed corrupt (FF FF) first two bytes when upload is broken in 128 byte chunks on atmega328p @16mhz. When uploading even a large binary in one go there isn't corruption. Stepping through the code doesn't result in corruption.

Perhaps a timing issue?

Haven't yet seen this on attiny45.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.