avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-gcc-list] [PATCH] avarice: IDR (OCDR) support


From: Shaun Jackman
Subject: [avr-gcc-list] [PATCH] avarice: IDR (OCDR) support
Date: Fri, 23 Feb 2007 14:37:18 -0700

The attached short patch enables support for the I/O Debug Register
(IDR). The result is that any byte written to the On-chip Debug
Register (OCDR) will appear on stdout of the avarice process. Other
options exist, such as sending a `O' console-output packet to GDB, but
I prefer stdout. Following is an example of how to use this feature
with avr-libc.

Cheers,
Shaun

#include <avr/io.h>
#include <stdio.h>

static int ocd_putchar(char c, FILE *stream)
{
        (void)stream;
        while (OCDR & 1<<IDRD);
        OCDR = c;
        return 0;
}

int main()
{
        static FILE ocdout = FDEV_SETUP_STREAM(ocd_putchar, NULL,
                        _FDEV_SETUP_WRITE);
        stdout = &ocdout;
        puts("Hello, world!");
        return 0;
}

2007-02-23  Shaun Jackman  <address@hidden>

        * src/jtag2run.cc (jtag2::jtagContinue): Write IDR events to
        stdout.

--- jtag2run.cc.orig    2007-02-23 11:54:38.000000000 -0700
+++ jtag2run.cc 2007-02-23 11:55:51.000000000 -0700
@@ -182,10 +182,19 @@
            if (evtSize >= 0) {
                // XXX if not event, should push frame back into queue...
                // We really need a queue of received frames.
-               if (seqno != 0xffff)
+               if (seqno != 0xffff) {
                    debugOut("Expected event packet, got other response");
-               else if (evtbuf[8] == EVT_BREAK)
-                   breakpoint = true;
+               } else {
+                   switch (evtbuf[8]) {
+                       case EVT_BREAK:
+                           breakpoint = true;
+                           break;
+                       case EVT_IDR_DIRTY:
+                           putchar(evtbuf[9]);
+                           fflush(stdout);
+                           break;
+                   }
+               }
                // Ignore other events.
                delete [] evtbuf;
            }

Attachment: avarice-idr.diff
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]