FreeRTOS Support Archive
The FreeRTOS support forum is used to obtain active support directly from Real
Time Engineers Ltd. In return for using our top quality software and services for
free, we request you play fair and do your bit to help others too! Sign up
to receive notifications of new support topics then help where you can.
This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.
[FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [April 2008 Threads] Directing the printf streamPosted by Billy Rafferty on April 14, 2008 Hi there,
This is probably a very silly question, but I have been unable to figure it out.
I am using the ARM7_AT91SAM7X256_Eclipse demo and I want to use simple printf statements to help me debug my program. How can I use the printf function it to write to one of the serial ports? Must I write my own implantation of putchar() etc to implement this functionality, or has this low level stuff been included with the OS?
Many thanks,
Billy
RE: Directing the printf streamPosted by Mark Meade on April 15, 2008 http://www.arm.com/support/faqdev/3824.html
Take a look at "retarget.c"... I was able to use this file to get stdio printf's to the debug serial port.
You need to implement two functions:
char UART_read(void); void UART_write(char);
My implementation looks something like this: /*-----------------------------------------------------------*/ void UART_write(char x) { xSerialPutChar( debugComPortHandle, x, mainUART_BLOCK_TIME ); }
/*-----------------------------------------------------------*/ char UART_read(void) { signed portCHAR rx;
if ( xSerialGetChar( debugComPortHandle, &rx, mainUART_BLOCK_TIME ) == pdTRUE ) { return rx; } else { return NULL; } }
where "debugComPortHandle" is initialized as follows:
debugComPortHandle = xSerialPortInitMinimal( 115200, 100 );
This worked for me, but it was compiled using the latest Keil toolchain. I'm not sure if it will work with the Eclipse demo, but hopefully this points you in the right direction.
-- Mark
RE: Directing the printf streamPosted by Billy Rafferty on April 16, 2008 Hi Mark,
I had a strange feeling I was going to have to implent a few functions.
Many thanks for the advice.
Cheers,
Billy
RE: Directing the printf streamPosted by Çağlar Akyüz on April 16, 2008 For gcc you need to modify syscalls.c file and call your serial write/send routine there. I guess you know this already :)
Another possibility is to use sprintf instead printf in your debug macros. Then you can send that buffer via your serial,usb,ethernet,etc "send" functions, at least this is what I'm doing now. Just in case...
Regards, Caglar
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|