• TI thinks resolved

RTOS: Memory allocation in .cfg file

Tool/software: TI-RTOS

hi TI professors,

   Now I want to make 8 cores to use a same program at c6678evm.That meaning is that only have one .cfg file. How to realize  MSM allocation in .cfg file? For example core0 use 0xc0000000 to 0xc0000ffff and core1 use 0xc00010000 to 0xc00020000.

  • You have a couple options:

    1. Dynamically create heaps during runtime: You can use the DNUM register to determine which core you are on and then carve up the shared memory accordingly. The created heap handle can be used in Memory_alloc(createdHeapHandle, ...) then. In this case, there still is a default heap that Memory_alloc(NULL, ...) and malloc uses. This heap should just be acting on local memory.

    2. Supply a default heap: You can create a HeapCallback heap in the .cfg file and assign it to the default BIOS heap. With HeapCallback, you supply the alloc, free, etc. functions. When Memory_alloc_(NULL, ...) or malloc is called, eventually your alloc function is called. In your function, you can use DNUM to get the memory from the desired memory. If you really want to get tricky, your startup function your supply to HeapCallback could create a HeapMem instance on each core. You supply the memory based on the DNUM. Then each core has it's own heap managing different memory and your alloc call you supply is pretty simple.

    Note: heads up... when objects/heaps are in shared memory in a single image, make sure to use the NOLOAD and NOINIT accordingly...otherwise the second core loaded might wipe out values from the first core.