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] [May 2012 Threads] Redirecting printfPosted by Paul Coleman on May 11, 2012 Is there an easy way to redirect printf? I'm using the Atmel AVR32 port and it would be nice if I could redirect printf to one of three USARTS, so maybe fprintf with something like... fprintf(USART_1, "text"); fprintf(USART_2, "text"); fprintf(USART_3, "text"); would be good. However, I'm not sure what I need to modify to accomplish this. Has anybody achieved something similar?
Thanks, Paul.
RE: Redirecting printfPosted by Richard on May 11, 2012 Normally you can implement the low level byte in and byte out functions any way you like, so send them to any device you like. How this is done is dependent on your compiler, or, more specifically, the libraries provided with your compiler. Most embedded environments are set up to make it easy to do, and I think the Atmel provided example applications actually are already configured to send printf() output to a UART.
I think you can also implement the low level functions in the low overhead io file being discussed in your other thread this morning.
Regards.
RE: Redirecting printfPosted by Paul Coleman on May 11, 2012 Thanks for the info. After my previous thread I then thought that I could achieve what I wanted by redirecting printf().
I was hoping that fprintf() called down to the _write() function contained in the portable section of FreeRTOS but this doesn't seem to be the case. This would have been easy as the first parameter to _write() is the file descriptor which I could have checked and then diverted the output accordingly. So, if _write() is not called by fprintf() what does it get called by?
Thanks, Paul.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|