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.

MCU-PLUS-SDK-AM243X: ICSS FW HAL uses malloc instead of pools

Part Number: MCU-PLUS-SDK-AM243X

I work on a custom board AM243x with the last SDK mcu_plus_sdk_am243x_08_02_00_31

I am testing PRP demo application as recommended by your documentation.

I have just discovered that when sending a PRP TX packet the FW HAL allocates a chunk of dynamic memory for the packet self: I would expect a memory pool instead of malloc !

Here is the code in source/industrial_comms/hsr_prp/icss_fwhal/hsrPrp_red.c

int32_t RedTxPacket(void *icssEmachandle, ICSS_EMAC_TxArgument *txArg, void *userArg)
{

    ...
    
    redFrame = RedFrameAllocate(packetData, packetLength);

    if(!redFrame)
    {
        RED_DEBUG_MSG("%s: RedFrameAllocate failed!\n", __FUNCTION__);
        return (RED_ERR);
    }

    ret = RedFrameSend(hsrPrphandle, icssEmacHandle, redFrame, packetData,
                       packetLength,
                       queuePriority, portNum);

    RedFrameFree(redFrame);
    redFrame = NULL;

    if(ret)
    {
        RED_DEBUG_MSG("%s: RedFrameSend failed!\n", __FUNCTION__);
        return (RED_ERR);
    }

and

static RED_FRAME *RedFrameAllocate(const uint8_t *pFrame, int32_t frameSize)
{
    RED_FRAME *pRedFrame = NULL;
    uint16_t     vlanTag;
    uint16_t     redFrameMinSize;

    if(pFrame == NULL)
    {
        return (NULL);
    }

    /* Allocate the RED frame structure */
    pRedFrame = malloc(sizeof(RED_FRAME));

    if(!pRedFrame)
    {
        RED_DEBUG_MSG("%s: pRedFrame == NULL\n", __FUNCTION__);
        return (NULL);
    }

I would like to integrate PRP into my application already handling pools:

  • how to avoid using malloc ?
  • should I write a custom implementation of RedTxPacket to pass as customTxCallBack ?

Thank you in advance

    Andrea