Hi, I currently encounter problems with malloc. I use microlib and configured the heap to be 32MBytes (0x02000000 bytes). Under some special circumstances (depending on the image date we get from a CMOS) malloc fails somwhere in my image analysis when trying to allocate memory of e.g. 0x1000 bytes. I tracked the total amount of allocated memory and found out, that only 0x19000 bytes has been allocated until the call of malloc. After each call to the image analysis functions, all allocated memory is freed, thus it should not be caused by fragmentation.
How can it be possible, that malloc fails? May it be possible - because of a programming error -, that overwriting some data malloc uses to determine the free amount of memory, will cause such problems?
Where can I get informations on how microlib implements malloc?
I do not have assembler written ISRs, all ISRs are written in C.
-> To exclude this as the reason, I may just disable all interrupts and try to run the program - right?
btw: Where does RTX place the stack of each task?
_I think_ there is a global container called 'mp_stk', unless the task provides its own memory. Look in your .map file.
In an RTOS environment, it is often hard to turn off interrupts, since the main goal of the application is to multitask.
I just found it in the sources of RTX. There is memory defined with _declare_box8 and as you said, it's called mp_stk.
MicroLib + RTX + A function with 7 parameters.
It seams like the problem is solved. I printf-ed the values inside the function and saw, that the values were right. So the debugger fooled me and showed me the wrong values.