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: retarget printf to uart?


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


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