Hi,
I am trying to do something very simple but for some reason it just does not want to work: I create a new HeapMem instance in my .cfg file:
var heapMemDDRParams = new HeapMem.Params();
heapMemDDRParams.instance.name = "heapMemDDR";
heapMemDDRParams.size = 65536;
Program.global.heapMemDDR = HeapMem.create(heapMemDDRParams);
In my C code I try to use this heap to allocate memory (from within a task):
Error_Block eb;
Memory_Stats ms;
HeapMem_getStats(heapMemDDR, &ms);
Error_init(&eb);
pBuffer = (uint32_t *)HeapMem_alloc(heapMemDDR, 0x0004, 0, &eb);
The HeapMem_alloc always fails with an out of memory error message - no matter how many bytes a try to allocate. I have added the "getState" to verify that the heap exists and that it has the right size. Stepping though the code I can see that the heap exists and has the correct size. Looking through ROV I can see the heap instance, the size is correct and the amount of free memory (equals to the size). I can see that space for the heap has been reserved in the .far segment. Everything looks right - but the allocate never succeeds.
Any ideas what I am doing wrong?
I have the following header files included in the C program:
#include <ti/sysbios/BIOS.h>
#include <ti/sysbios/heaps/HeapMem.h>
#include <xdc/runtime/Memory.h>
#include <xdc/runtime/Error.h>
#include <xdc/cfg/global.h>
I use SysBios 6.32.05.54. I use CCS4.2.4.00033. My target is a TMS320C6A8168 (DSP core).
Regards,
Niki