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] [September 2006 Threads] vsnprintf() problem with gcc+eclipse+LPC2214Posted 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+LPC2214Posted 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+LPC2214Posted 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.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|