This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Re: retarget printf to uart?
- From: Jesper Vestergaard <openocd at jespervestergaard dot dk>
- To: newlib at sources dot redhat dot com
- Cc: rurality dot wq at gmail dot com
- Date: Wed, 27 May 2009 16:13:57 +0200
- Subject: Re: retarget printf to uart?
- References: <4A1D39C7.1070004@jespervestergaard.dk>
Jesper Vestergaard wrote:
Hi guys
I have been trying to retarget the printf in newlib so i can use it on
a Icnova / Grasshopper avr32 board. I use the avr32 toolchain which
uses newlib 1.16.0.
I have read on a forum that i must implement _write_r in my code so
that i use the uart but it doesn't work. How do i proper retarget the
printf?
Best regards
Jesper
Btw i'm using FreeRTOS which i guess should be treated as a standalone
application.
Here's a snip of the code i have tried:
int putchar2(int c)
{
return usart_putchar(&AVR32_USART1,c);
}
int _write_r(void *reent, int fd, char *ptr, size_t len)
{
size_t i;
for (i=0; i<len; i++)
{
putchar2( ptr[i]);
}
return len;
}
int main(void)
{
printf("testing");
}