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

vsnprintf() problem with gcc+eclipse+LPC2214

Posted by the-moog on September 8, 2006
Hi,
I'm using vsnprintf() to try to create a version of printf() that will work with preemtive multi tasking - preventing output text being mixed up.

I am using the serial.c library distributed with the source, modified to support two serial ports and called with a new function that replaces printf() using vsnprintf() to format the text before being sent to vSerialPutString(). A semaphore prevents the output texts from numerours tasks being mixed up.

The trouble is my code crashes with a memory access exception within the call to vsnprintf().

I've even tried it with const text and sprintf() and it does the same.

Why would these functions not work when the RTOS is running, yet I can use them before the scheduler starts without a problem?

If I replace them with puts() instead I get the format text as expected (obviously via a different software route)

Any suggestions of other tests I can do to isolate the problem which appears to be an interaction between FreeRTOS and libc or libgcc.

Cheers,
Jason.

RE: vsnprintf() problem with gcc+eclipse+LPC2214

Posted by Nobody/Anonymous on September 8, 2006
sprintf type functions in GCC are nutorios for using a LOT of stack. I suspect your problem is just a stack overflow.

Take a look at the LPC2148 CrossFire demo in the freertos download. This uses a task to control printing - if any other task wants to print it sends the text to print to the printer task. The printer task is the only task that is allowed to access the IO.

RE: vsnprintf() problem with gcc+eclipse+LPC2214

Posted by Nobody/Anonymous on September 11, 2006
Hi,

No worries, fixed it. The new printf function is being called from many tasks. Some of these tasks had a too small size stack, causing the stack to become corrupted.

Pity the RTOS does not have stack checking as standard. I have noticed that others have done a patch that implements this, I'll take a look at it.

j.


[ 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