This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: printf to a UART on an ARM9


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;
}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]