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.

IWR6843ISK-ODS: DPC_ObjectDetection_PreStartCfg memUsage configuration

Part Number: IWR6843ISK-ODS
Other Parts Discussed in Thread: SYSBIOS

Hello!

I'm developing function that would perform Datapath configuration without CLI util. As a reference I use source code frome ods_point_cloud_68xx_hwa lab. I use SDK 3.3.

I did all the neccessary init and configuration steps up to DPM_int and launching DPM execute task.

I also have successfuly sent DPC_OBJDET_IOCTL__STATIC_PRE_START_COMMON_CFG command and filled StaticCfg and DynCfg of DPC_ObjectDetection_PreStartCfg structure in preparation of sending  DPC_OBJDET_IOCTL__STATIC_PRE_START_CFG.

My question is how to fill DPC_ObjectDetection_DPC_IOCTL_preStartCfg_memUsage structure of DPC_ObjectDetection_PreStartCfg? I can't find suggestions about that in documentation.

When I try to hardcode values, discovered during debugging of ods_point_cloud_68xx_hwa lab, I get

ti.sysbios.heaps.HeapMem: line 259: assertion failure: A_zeroBlock: Cannot allocate size 0
xdc.runtime.Error.raise: terminating execution

Here is content of DPC_ObjectDetection_DPC_IOCTL_preStartCfg_memUsage structure of ods_point_cloud_68xx_hwa lab (screenshot) and pease of my code my code:

 DPC_ObjectDetection_DPC_IOCTL_preStartCfg_memUsage *memUsage = &preStartCfg.memUsage;
    memUsage->L3RamUsage = 134343948; //sizeof(gMmwL3);
    memUsage->CoreLocalRamUsage = 134246872; //sizeof(gDPC_ObjDetTCM);
    memUsage->SystemHeapTotal = 94871;

   memUsage->CoreLocalRamTotal = 0;
   memUsage->SystemHeapUsed = 0;
   memUsage->SystemHeapDPCUsed = 0;

errCode = DPM_ioctl(dpm, DPC_OBJDET_IOCTL__STATIC_PRE_START_CFG,  &preStartCfg, sizeof(DPC_ObjectDetection_PreStartCfg));

___

Denis

  • Hi Denis,

    The memory configuration (available local and L3 memories and corresponding addresses) are passed to the DPM by the application (i.e. the demo) in MmwDemo_initTask in main.c as shown below. 

        /* Memory related config */
        objDetInitParams.L3ramCfg.addr = (void *)&gMmwL3[0];
        objDetInitParams.L3ramCfg.size = sizeof(gMmwL3);
        objDetInitParams.CoreLocalRamCfg.addr = &gDPC_ObjDetTCM[0];
        objDetInitParams.CoreLocalRamCfg.size = sizeof(gDPC_ObjDetTCM);
    
        /* Call-back config */
        objDetInitParams.processCallBackCfg.processFrameBeginCallBackFxn =
            MmwDemo_DPC_ObjectDetection_processFrameBeginCallBackFxn;
        objDetInitParams.processCallBackCfg.processInterFrameBeginCallBackFxn =
            MmwDemo_DPC_ObjectDetection_processInterFrameBeginCallBackFxn;
    
        memset ((void *)&dpmInitCfg, 0, sizeof(DPM_InitCfg));
    
        /* Setup the configuration: */
        dpmInitCfg.socHandle        = gMmwMCB.socHandle;
        dpmInitCfg.ptrProcChainCfg  = &gDPC_ObjectDetectionCfg;
        dpmInitCfg.instanceId       = 0xFEEDFEED;
        dpmInitCfg.domain           = DPM_Domain_LOCALIZED;
        dpmInitCfg.reportFxn        = MmwDemo_DPC_ObjectDetection_reportFxn;
        dpmInitCfg.arg              = &objDetInitParams;
        dpmInitCfg.argSize          = sizeof(DPC_ObjectDetection_InitParams);

    The DPC copies these values when processing the DPC_OBJDET_IOCTL__STATIC_PRE_START_CFG message as shown below in ti\datapath\dpc\objectdetection\objectdetectionhwa\src\objectdetection.c

                /* Related to pre-start configuration */
                case DPC_OBJDET_IOCTL__STATIC_PRE_START_CFG:
                {
                    DPC_ObjectDetection_PreStartCfg *cfg;
                    DPC_ObjectDetection_DPC_IOCTL_preStartCfg_memUsage *memUsage;
                    MemoryP_Stats statsStart;
                    MemoryP_Stats statsEnd;
    
                    /* Pre-start common config must be received before pre-start configs
                     * are received. */
                    if (objDetObj->isCommonCfgReceived == false)
                    {
                        retVal = DPC_OBJECTDETECTION_PRE_START_CONFIG_BEFORE_PRE_START_COMMON_CONFIG;
                        goto exit;
                    }
    
                    DebugP_assert(argLen == sizeof(DPC_ObjectDetection_PreStartCfg));
    
                    /* Get system heap size before preStart configuration */
                    MemoryP_getStats(&statsStart);
    
                    cfg = (DPC_ObjectDetection_PreStartCfg*)arg;
    
                    memUsage = &cfg->memUsage;
                    memUsage->L3RamTotal = objDetObj->L3RamObj.cfg.size;
                    memUsage->CoreLocalRamTotal = objDetObj->CoreLocalRamObj.cfg.size;
                    retVal = DPC_ObjDet_preStartConfig(subFrmObj,
                                 &objDetObj->commonCfg, &cfg->staticCfg, &cfg->dynCfg,
                                 &objDetObj->edmaHandle[0],
                                 &objDetObj->L3RamObj,
                                 &objDetObj->CoreLocalRamObj,
                                 &objDetObj->hwaMemBankAddr[0],
                                 objDetObj->hwaMemBankSize,
                                 &memUsage->L3RamUsage,
                                 &memUsage->CoreLocalRamUsage);

    Regards

    -Nitin

  • Hello, Nitin

    memUsage has 7 fields.

    When configuring objDetInitParams we specify only 2 of them: L3ramCfg.size (used as L3RamTotal in memUsage) and CoreLocalRamCfg.size (used as CoreLocalRamTotal in memUsage).

    How do other fields of memUsage are filled?

    Especially SystemHeap fields (I get exactly ti.sysbios.heaps.HeapMem: line 259: assertion failure: A_zeroBlock: Cannot allocate size 0).

    It seems that L3RamUsage and CoreLocalRamUsage are returned by DPC_ObjDet_preStartConfig (according to the way it passed as &-arguments).

    Is that correct?

     

    _____

    Denis

  • I can add that if don't fill memUsage at all (fill staticCfg and dynCfg and the call DPC_OBJDET_IOCTL__STATIC_PRE_START_CFG),

    I still get the same error

    ti.sysbios.heaps.HeapMem: line 259: assertion failure: A_zeroBlock: Cannot allocate size 0

    Stepping into durring debugging of this error leads to following line

    SemaphoreP_post (ptrDPM->semaphoreHandle);

    in DPM_pipeSend function in dpm_pipe.c

    _____

    Denis

  • Hi Denis,

    Please look at the definition of DPC_ObjectDetection_DPC_IOCTL_preStartCfg_memUsage in ti\datapath\dpc\objectdetection\objectdetectionhwa\objectdetection.h


    The comments and the field names indicate which fields are used as inputs and which ones are used to report memory usage (these are used in main.c to report the memory usage on CCS console).

    /*
     * @brief  Structure related to @ref DPC_OBJDET_IOCTL__STATIC_PRE_START_CFG
     *        IOCTL command. When the pre-start IOCTL is processed, it will report
     *        memory usage as part of @DPC_ObjectDetection_PreStartCfg.
     */
    typedef struct DPC_ObjectDetection_DPC_IOCTL_preStartCfg_memUsage_t
    {
        /*! @brief   Indicates number of bytes of L3 memory allocated to be used by DPC */
        uint32_t L3RamTotal;
    
        /*! @brief   Indicates number of bytes of L3 memory used by DPC from the allocated
         *           amount indicated through @ref DPC_ObjectDetection_InitParams */
        uint32_t L3RamUsage;
    
        /*! @brief   Indicates number of bytes of Core Local memory allocated to be used by DPC */
        uint32_t CoreLocalRamTotal;
    
        /*! @brief   Indicates number of bytes of Core Local memory used by DPC from the allocated
         *           amount indicated through @ref DPC_ObjectDetection_InitParams */
        uint32_t CoreLocalRamUsage;
    
        /*! @brief   Indicates number of bytes of system heap allocated */
        uint32_t SystemHeapTotal;
    
        /*! @brief   Indicates number of bytes of system heap used at the end of PreStartCfg */
        uint32_t SystemHeapUsed;
    
        /*! @brief   Indicates number of bytes of system heap used by DCP at the end of PreStartCfg */
        uint32_t SystemHeapDPCUsed;
    } DPC_ObjectDetection_DPC_IOCTL_preStartCfg_memUsage;

    I have already mentioned where the allocated L3RamTotal and CoreLocalRamTotal are specified. 

    L3RamUsage and CoreLocalRamUsage are sent as pointers and the DPC populates the values to report the corresponding memory usage: 

                    retVal = DPC_ObjDet_preStartConfig(subFrmObj,
                                 &objDetObj->commonCfg, &cfg->staticCfg, &cfg->dynCfg,
                                 &objDetObj->edmaHandle[0],
                                 &objDetObj->L3RamObj,
                                 &objDetObj->CoreLocalRamObj,
                                 &objDetObj->hwaMemBankAddr[0],
                                 objDetObj->hwaMemBankSize,
                                 &memUsage->L3RamUsage,
                                 &memUsage->CoreLocalRamUsage);

    And in the same case statement (DPC_OBJDET_IOCTL__STATIC_PRE_START_CFG) in objectdetection.c, you can see the rest of the fields being filled to report the memory usage:

                    /* Get system heap size after preStart configuration */
                    MemoryP_getStats(&statsEnd);
    
                    /* Populate system heap usage */
                    memUsage->SystemHeapTotal = statsEnd.totalSize;
                    memUsage->SystemHeapUsed = statsEnd.totalSize -statsEnd.totalFreeSize;
                    memUsage->SystemHeapDPCUsed = statsStart.totalFreeSize - statsEnd.totalFreeSize;
    

    Regards

    -Nitin

     

  • Hello, Nitin

    Thank you for reply. It became clear for me that I have to fill only 2 fields of memUsage.

    But I guess memUsage structure is not the issue: no matter what I do with it, I still get error

    ti.sysbios.heaps.HeapMem: line 259: assertion failure: A_zeroBlock: Cannot allocate size 0
    xdc.runtime.Error.raise: terminating execution

    Can you please suggest the way of dealing with these error?

    Maybe I should start other thread for this discussion?

  • Hi Denis,

    Yes, with this limited context, it is hard to comment on the cause of the error. If your objective is to hardcode the configuration so that the sensor starts automatically with a pre-defined configuration, you can look at the multiple E2E threads on this subject on this forum. Here are a couple of such threads which discuss this topic and the provided solution:

    CCS/IWR1642BOOST: How to run independently from the host computer

    CCS/IWR6843: Hard-code configuration commands

    To get an example of this approach with configuration commands that work with the latest SDK, please look at the 68xx AoP_ODS - Multiple Gesture and Motion Detection Lab in Industrial Toolbox.

    I will close this thread since the particular question asked in this thread, regarding DPC_ObjectDetection_PreStartCfg memUsage configuration, is addressed. Please feel free to create a new thread if you have issues with the approach suggested in the above referred threads or have other questions.

    Thanks

    -Nitin