printf to a UART on an ARM9
DJ Delorie
dj@redhat.com
Tue Feb 26 10:19:00 GMT 2008
The way to do this is to write (or obtain) a "gloss" library for your
specific board, which defines the write() function (and a few other
board-specific functions) in terms of your serial port. Then all the
stdio functions should "just work" (you'll probably need an sbrk()
too). Look in src/libgloss for examples. Here's an example of what I
do for my m32c/83 board:
int
write(int fd, char *buf, int len)
{
int l = len;
while (len--)
{
while (!ti_u1c1)
asm volatile ("");
u1tbl = *buf++;
}
return l;
}
More information about the Newlib
mailing list