Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Real time embedded FreeRTOS mailing list 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT Training




Loading

printf using printf-stdarg.c

Posted by roujesky on August 1, 2014

I had this working on an old mplab8 project running FreeRTOS. But I have a brand new project running the latest version of FreeRTOS on a PIC32MX795. Now, tho, when i call printf, it goes straight to this function in printf-stdarg.c

/* To keep linker happy. / int write( int i, char c, int n) { return 0; }

what am I doing wrong? Like I said, this worked for me years ago. I should see it stepping thru all the functions in printf-stdarg.c....

thanks!


printf using printf-stdarg.c

Posted by rtel on August 2, 2014

printf-stdarg.c contains an extremely light weight version of some of the stdio functions. It is a useful way of keeping the code size of GCC built programs (XC32 is GCC by another name) down as bringing in a lot of GCC libraries can really bloat code and massively increase your stack usage. In printf-stdarg.c you can direct the output of printf() wherever you like (UART, console, USB CDC etc.) or just provide a dummy write() function if you are not actually going to use printf() at all.

If the libraries that come with your compiler (presumably XC32) come with an implementation of write() that does what you want then you can simply remove printf-stdarg.c from the project all together - if you do that I would strongly suggest you have stack overflow checking turned on in FreeRTOSConfig.h.

Regards.


printf using printf-stdarg.c

Posted by bowerymarc on August 2, 2014

You need to implement the actual output function yourself, or use sprintf and deal with the resultant char array. So overload write(). Your old project probably did that somewhere.

Attachments

alternate (1722 bytes)

printf using printf-stdarg.c

Posted by roujesky on August 3, 2014

thanks! I will implement the necessary code in write().


[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]




Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.


Free TCP/IP and file system demos for the RTOS


Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists