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.

RTOS/DRA746: Proper default heap configuration for SysBios

Part Number: DRA746
Other Parts Discussed in Thread: SYSBIOS

Tool/software: TI-RTOS

I have a customer that is struggling with some heap issues in their programs running on Sysbios 

The issue can be observed on IPU core configured in SMP. When they are performing a lot of memory allocations, it happens, that core crashes.

They managed to solve this issue by setting the following gate for the HeapMem (which they are using as default heap):

/* assign Gate instance to Heaps */

var Gate = xdc.useModule('ti.sysbios.family.arm.ducati.GateSmp');
var gateParams = new Gate.Params;
var gateInstance = Gate.create(gateParams);
HeapMem.common$.gate = gateInstance;

Their question is whether this is the the proper gate configuration for that Heap? Can they use other heaps, like HeapStd or HeapBuf, which don't have gate configuration, in SMP mode?

  • Hi John,

    I have forwarded your question to an expert for comment.

    Regards,
    Yordan
  • Hi John,

    Your solution is correct. By default HeapMem uses a single core mutex to provide mutual exclusion. With SMP, you'll need to exclude the other core also. This can be done by making GateSmp the gate module (instead of GateMutex).

    Todd
  • Todd,
    They thanked you for the answer, and had a follow up question:

    They found the 'Gate' configuration issue only in Heap, are there other components which needs proper Gate configuration like Tasks, Semaphores?
    They have set following parameter:
    BIOS.smpEnabled = true;
    They are using following 'SMP' in our SysBios configuration:
    • xdc.useModule('ti.sysbios.smp.SysStd');
    • xdc.useModule('ti.sysbios.family.arm.ducati.GateSmp');
    Are they missing some additional configuration?
  • Hi John,

    GateMutex should provide mutual exclusion across cores in a SMP setup. It can fail if heap allocation is being done from interrupt context (true for both SMP and non-SMP case). Maybe that is the case here ? If yes, then using GateSmp as the gate provider makes sense. I would suggest using GateHwi instead of using GateSmp though.

    Best,
    Ashish