Since 5223x chips have small RAM I should expect it fills up some day. But not so quickly. My CW7.2 shows project's (depends on settings) code size from 5 to 8kB. Data size about 1.5kB. Now at runtime I allocate memory for few structures. After allocating about 800 bytes I get errno: 12 and no allocation at all. I thought I have 32 kB of RAM at hand... It's quite odd that setting different optimization I get from 5 to 8 kB of code but no difference in malloc behavior. What is going on? Any ideas?
Running CW7.2SE, RAM configuration, EWL C.
TIA,
Michal
Solved! Go to Solution.
One issue was in the past (saw last mails years ago, I don't know about the 7.2 setup) that memory pools were used.
Search in old threads, for example
https://community.freescale.com/message/43154#43154
Another thing to check is how your lcf is setup, maybe you just do not allocate more RAM for the heap?
Daniel
SOLVED!
I've changed ___heap_size in the .lcf file to 0x800 and it helped.
Thanks a lot for quick response.
See if CW provides (or can be made to provide) a MAP file. Examine that to see how the memory is allocated.
Memory is usually taken up with (in order) the Interrupt Vectors, Code, Data, BSS, Heap and Stack.
The "heap" is what Malloc uses. It and the Stack usually share all the remaining memory. Somewhere in the project you have to tell CW how much to allocate for the Stack, with the remaining usually being for the Heap. If your Stack is too big (or somehow the project is set for no heap) then that might explain your problem.
One issue was in the past (saw last mails years ago, I don't know about the 7.2 setup) that memory pools were used.
Search in old threads, for example
https://community.freescale.com/message/43154#43154
Another thing to check is how your lcf is setup, maybe you just do not allocate more RAM for the heap?
Daniel