Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem


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 ]    [ Privacy ]    [ Sitemap ]    [ ]


Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

Meet Richard Barry and learn about running FreeRTOS on RISC-V at FOSDEM 2019

Version 10.1.1 of the FreeRTOS kernel is available for immediate download. MIT licensed.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


Careers

FreeRTOS and other embedded software careers at AWS.



FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Renesas

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

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

OpenRTOS and SafeRTOS

Xilinx Microblaze and Zynq partner