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.

evmc6472 and creation of a heap memory using bios6

Other Parts Discussed in Thread: SYSBIOS

Hello

I use ccsv4 and bios6 and the evmc6472 platform

I want to create a heap in the DDR2 Memory and another heap in the LL2RAM.so I write in the cfg file these commands.

/***************************************************************/

var HeapMem     =   xdc.useModule('ti.sysbios.heaps.HeapMem');

//********* create a heap in DDR2 Memory***********/

var heap0 = new HeapMem.Params();
heap0.size = 0x3000000;
heap0.sectionName = ".DDR2Heap";
Program.global.DDR_Heap = HeapMem.create(heap0);
Memory.defaultHeapInstance = Program.global.DDR_Heap;
Program.sectMap[".DDR2Heap"] = "DDR2";
Program.sectMap[".sysmem"] = "DDR2";
Program.heap = 0x3000000;

//********* create a heap in LL2RAM Memory***********/

var heap1 = new HeapMem.Params();
heap1.size = 0xc000;
heap1.sectionName = ".L2RAMHeap";
Program.global.L2_Heap = HeapMem.create(heap1);
Memory.defaultHeapInstance = Program.global.L2_Heap;
Program.sectMap[".L2RAMHeap"] = "LL2RAM";
Program.sectMap[".sysmem"] = "LL2RAM";
Program.heap = 0xc000;

so please could you tell me if these commands are true or not or if there are others thinks that i have to add .

After that, how can I use Memory_alloc in the main.c file and wich library .h  i should add and how can i use these two heaps to allocate two vectors

unsigned char * vect1 in the DDR2 and unsigned char * vec2 in the LL2RAM .they have the same size :256.

i think that i have to use extern and IHeap_Handle but i don't know how i used them.

please give me the right ticks to do that.

and thank you

david

  • David,
    there is a SYS/BIOS example "Memory" in CCSv4 where you can see how to use Memory module. You can select the example as a new project by clicking on File->New->CCS Project. You can name it any way you want, and then follow a series of dialogs where you select the device family (C6000), compiler, etc. In the Dialog Project Templates, select SYS/BIOS->Generic Examples->Memory Example.

    In the file memory.c in the example, you;ll see that you need to add
    #include <xdc/cfg/global.h>
    to your application source to get access to the heap handles DDR_Heap and L2_Heap.

    Then, before you use those heaps in Memory_alloc calls, you need to cast them to IHeap_Handle because that's the type Memory_alloc expects. You would need something like this:

    IHeap_Handle ddr = HeapMem_Handle_upCast(DDR_Heap);
    IHeap_Handle l2 = HeapMem_Handle_upCast(L2_Heap);

    and now you can call

    vect1 = Memory_alloc(ddr, 256, 0, NULL);

  • thank you Sasha

    it's like you said.

    cordialy

    david