I've asked this question in another Forum but I consider this is related to DM6446 so I ask again here.
I want to use MEM_alloc or malloc in my program like this
char *a = (char*)MEM_alloc(DDR2, 10, 0);
First, when I didn't choose "No Dynamic Memory Heaps", of course I got return a=0x0.
Next, I disable "No Dynamic Memory Heaps" and make DDR2 "create a heap in this memory" as "True" and set the heap size as 0x400.
I have tried mem_management sample before.
It can really work when allocating memory in IRAM
However, when I change to DDR2 it will fail.
I add extern Int SEG1 as DDR2 heap identifier label, change the malloc()/free() memory to DDR2.
I check the trace memory and got some message:
2 seg0: segment size 0x2000
3 number of MADUs used in seg0: 0x2000
4 size of the largest free contiguous block of memory in seg0: A 0x0
5 allocating memory blocks in seg0 ...
6 memory block 0 allocated at address = 00000000
7 memory block 1 allocated at address = 00000000
8 after allocating ...
9 seg0: segment size 0x2000
10 number of MADUs used in seg0: 0x2000
11 size of the largest free contiguous block of memory in seg0: A 0x0
I wonder why there's no contiguous memory.
I check out the Kernel Object View window and found that
the MEM object describes two memory segment status.
The IRAM is normal but the another one is "PRD_STARTPRD Memory Heap Full".
Once the program beginning, the memory heap is full no matter how I set the DDR2 size and heap size.
How to resolve this problem?
Thank you very much.