Can someone explain how to locate a heap in L2RAM using ti.sysbios.heaps.HeapMem and the HeapMem_xxx() functions?
Thanks,
Sven
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Can someone explain how to locate a heap in L2RAM using ti.sysbios.heaps.HeapMem and the HeapMem_xxx() functions?
Thanks,
Sven
var heapMem = xdc.useModule('ti.sysbios.heaps.HeapMem');
var heapMemParams = new heapMem.Params();
heapMemParams.sectionName = ".L2RAMHeap"; // can be existing section or new section name
heapMem.create(heapMemParams);
Program.sectMap[".L2RAMHeap"] = "L2RAM"; // place section .L2RAMHeap into L2RAM MEMORY
That should do the trick.
Regards,
- Rob
Hi Sven,
If you want to dynamically create the heap, you need to place the the buffer into a section and then pass the buffer to the create (note: you still need the Program.sectMap[".L2RAMHeap"] = "L2RAM"; in your .cfg file as Rob showed above).
/* Place into section*/
#pragma DATA_SECTION(heapBuffer, ".L2RAMHeap")
char heapBuffer[SIZE];
....
HeapMem_Params params;
HeapMem_Handle heap;
HeapMem_Params_init(¶ms);
params.size = SIZE;
params.buf = heapBuffer;
heap = HeapMem_create(¶ms, NULL);
Todd
Rob,
Follow on question:
Would the following be the recommended way to place the heap in a specific location in the L2RAM?
Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4
Program.sectMap[".L2RAMHeap"]= {loadAddress: 0x00810000};
Or can it be done with L2RAM + offset?
Thanks,
Sven
Sven,
Your example seems fine, but I don't know your ultimate goal.
Re: your L2RAM + offset question... I suppose you could do:
L2Ram = Program.cpu.memoryMap["L2RAM"];
Program.sectMap[".L2RAMHeap"] = {loadAddress: L2Ram.base + offset};
Regards,
- Rob
Rob,
Thanks. We are using the L2RAM for multiple purposes and this allows us to control precisely what goes where.
Regards,
Sven