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/CC2640: The difference between Memory_alloc and ICall_malloc on CC2640

Guru 16800 points
Part Number: CC2640


Tool/software: TI-RTOS

Hello,

In many BLE examples, ICall_malloc() is used frequently.
What are the differences between these API?
Especially, I want to know about alignment check and task safe procedure.

Best Regards,
Nomo

  • Part Number: CC2640

    Tool/software: TI-RTOS

    Hello,

    Is the HeapBuf task safe API?

    In the following document, HeapMem is mutex and protect, and HeapBuf is non-blocking.
    www.ti.com/.../spruex3t.pdf

    However, in the following thread seems that these APIs are task safe.
    e2e.ti.com/.../265793

    Which is correct?

    My customer wants to realize the following procedure.
    -To allocate the heap memory on the GAP event (which is call backed from BLE Stack) dynamically.
    -To store the scanned data into above heap memory.
    -And then, to transfer the data to another task.

    Best Regards,
    Nomo

  • Hello,

    I have merged your threads because they are very closely related.
    For the CC2640, I recommend taking a look at section 3.11 (RAM) of the Software Developer's Guide to see the heap architecture for the device.

    In summary, the TI-RTOS heap functions are only used by TI-RTOS _create() functions, and thus a small heap is used. Instead it is recommended to use the ICall heap. This is discussed at length in the referenced section.

    The iCall heap is threadsafe and uses ICall_enterCSImpl() and ICall_leaveCSImpl() to ensure thread safety.
  • Hello Sean-san,

    Thank you for your reply.

    Best Regards,
    Nomo