Using this documentation, i was able to find out that DebugWire simply uses UART on one line with the baud rate F_CPU/128.
So I built up a up a little circuit with Attiny13. I use an FT232 usb-serial-adapter to communicate with PC. GND and 5V are connected to their respective pins on the Tiny13. The RX pin of the FT232 is connected to the RST line of the Tiny13. The TX side have to be open-collector, so I used a diode with cathode to TX to connect TX and RST. Additionally I added an LED to have some output for a program. (You can find the schematic in the gallery)
Then I flashed some little blink program, which blinks the LED with 1s delay (at 1,2MHz). After that I set the DWEN-Fuse, which activates the DebugWire hardware in the chip. Now we can communicate with the DW-hardware via the Serial Port.
I build a little GUI in C#, which should work on Windows and maybe even Linux under Mono. There you select the Port where the adaptor is connected to and the Frequency of the target.
Right now it supports:
- Start and Stop target
- Read signature
- Reset target
- Single step on target
- Deactivate DW and reenable ISP temporary
- Read/Write Program Counter
- Read/Write "Hardware Breakpoint"
- Execute 16-bit commands on target, read out last set command.
I will try to implement the Memory (RAM, Flash, Registers) Read/Write operations next, then I will try to create a gdbserver-compatible tool, so we can debug with gdb via debugwire.
You can find releases of the tool here: https://github.com/jbtronics/WireDebugger/releases