Hello,
I'm working with the AT91RM9200 - the USART is already configurated and works but I don't know how I could use the printf-function for the usart.
Now I'm sending a character with this function - it works, but it's ver uncomfortable if I want to send one sentence or numbers...
char a[11] = "Hallo Welt"; for(int i=0; i<11; i++) { while( !(COM1->US_CSR & AT91C_US_TXRDY) ) continue; COM1->US_THR = (a[i] & 0xFF); }
Is there a possibility to use the printf-function for the first USART / not the DEBUG-Unit at the AT91?
printf("Hello World\n");
best regards Johannes
Hello Johannes Meier,
please take a look at Project C:\Keil\ARM\Boards\Atmel\AT91SAM7S-EK\Hello. This example program uses UART with retargetting. It is not the microcontroller you are using but it is also an Atmel.
Best Regards, Martin Guenther
thanks for your reply, but there is no problem with the retarget.c file...
there must be another problem, because the retarget.c file from the AT91SAM7S-EK is identical with the retarget.c file I use.
I don't know where could be the error that FILE __stdout; is not allowed
Don\t you notice something strange.
You have posted what you claim is your Retarget.c file. It doesn't have many source lines. The compiler complains about line 19. Line 19 does not match your source file. Have you really posted a verbatim copy of Retarget.c?
right, at the beginning of the retarget.c file there are comments, I don't posted...
But the error message says which things are not correct... I created a complete new protect file and now it is working... I only copy the whole c-code in the new project file..
But it would be very interesting what the error was / or is.
The errors that you show are consistent with you compiling this C file as a CPP file. Notice the reference in the error message to the std namespace.
There is a switch to the compiler to compile .c files as cpp files. Are you using it?
yes that's the reason... I forget to delete cpp from the linker...