bdiGDB for GNU Debugger, BDI2000 (ARM11/Cortex-A8)

User Manual 43

3.3.6 Target DCC I/O via BDI

It is possible to route a TCP/IP port to the ARM’s debug communciation channel (DCC). This way, the application running on the target can output messages via DCC that are displayed for example in a Telnet window. The BDI routes every byte received via DCC to the connected TCP/IP channel and vice versa. Below some simple functions you can link to your application in order to implement IO via DCC.

#define DSCR_WDTR_FULL (1L<<29) #define DSCR_RDTR_FULL (1L<<30)

static unsigned int read_dtr(void)

{

unsigned int c;

__asm__ volatile(

"mrc p14, 0, %0, c0, c5\n"

:"=r" (c));

return c;

}

static void write_dtr(unsigned int c)

{

__asm__ volatile(

"mcr p14, 0, %0, c0, c5\n"

:

: "r" (c));

}

static unsigned int read_dscr(void)

{

unsigned int ret;

__asm__ volatile(

"mrc p14, 0, %0, c0, c1\n"

:"=r" (ret)); return ret;

}

void write_dcc_char(unsigned int c)

{

while(read_dscr() & DSCR_WDTR_FULL); write_dtr(c);

}

unsigned int read_dcc_char(void)

{

while(!(read_dscr() & DSCR_RDTR_FULL)); return read_dtr();

}

void write_dcc_string(const char* s)

{

while (*s) write_dcc_char(*s++);

}

© Copyright 1997-2007 by ABATRON AG Switzerland

V 1.04

Page 43
Image 43
Albatron Technology ARM11/Cortex-A8 user manual Target DCC I/O via BDI