hi ,
I am using code warrior 3.0 for my project.
In that i am using fopen functionality.
While debugging , when it enters the first fopen() after my 'int main()', no problem for my application (it works fine).
But at the second time (in a while loop) , when it enters in fopen(), goes to the following function in msc814x_intr_vectors.asm file
;Entry 5 Reserved
jmp>___EmptyIntHandler
dup 29
nop
endm
When i traced the path , i found as ,
from fopen() in my application
to
fopen() in C:\Program Files\Freescale\CodeWarrior\StarCore_Support\compiler\src\rtlib\expanded\fopen_common.c
to
__do_open() in C:\Program Files\Freescale\CodeWarrior\StarCore_Support\compiler\src\rtlib\expanded\fopen_common.c
to
malloc() in C:\Program Files\Freescale\CodeWarrior\StarCore_Support\compiler\src\rtlib\expanded\maloc_common.c
From this malloc() function it is going to the exception (finally stuck ) goes to msc814x_intr_vectors.asmfile
Here am pasting the code stuff of malloc() stuck area (Inside the while() loop )from the maloc_common.c
/* First: attempt to allocate the buffer from the existing pool with a
minimum of wasted space. */
while ( NULL != p )
{
if ( NO == p->used && nbytes <= p->size && waste > ( p->size - nbytes ) ) => throws exception from this area
waste = p->size - nbytes, best_fit = p;
p = p->lnk;
}
I don't know why this happens in the second time when fopen() calls.
Can any one help me out in solving this problem?
This is the whole issue .
/renjith_g
The empty interrupt handler is a catch-all for when the program gets lost and is out in the weeds. The fact that fopen() works initially but dies in a loop makes me thing that your loop code is doing something that makes fopen() run out of memory (hence the malloc() call). What does your loop code look like?
---Tom
hi,
It is my custom embedded application taking some memory.Also how can prevent this exception at fopen()? ( or how can i give enough / more memory fopen() ?)
How can i find/control the memory overflow ?
/Kanu__
If you comment out the fopen() in the loop, does the program work, as much as can be expected without the use of that function? The fact that you say the fopen() fails to work in the loop yet works outside of the loop, makes me think that something in the loop code is the culprit. Somehow it's creating a memory leak, or perhaps calling fopen() so often that you run out of memory.
---Tom
hi,
The application is very well depend on the fopen() call. So not able to realize without it.
As like your suggestion , may be my loop code is having some leakage.
Now am analyzing that.
Which are all places , should i give more importances to find the leakage?
What are the memory constraints in board /simulator?
/Kanu__
No other replies yet?
/Kanu__
Hello
Did you check the sample project in {Install}/(CodeWarrior_Examples)\StarCore_Examples\FileIO?
As far as I know they are using fopen.
CrasyCat
hi ,
yes i tried the three example projects in the above directory.
They are working fine and completed successfully.
/Kanu__
Did you make sure that you increase the heap this is what affects the fopen() function?
hi,
Can you please describe a little bit more on that , ie heap memory which is relating with fopen()?
I haven't touched the heap size control parameter in my code /configuration file .
Also from where i need to start my debugging ?
/Kanu__