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.

IWR6843: Object Detection DSP Unit Test Crashing

Part Number: IWR6843
Other Parts Discussed in Thread: SYSBIOS

After modifying the Object Detection DSP Unit Test's dss.cfg according to https://e2e.ti.com/support/processors-group/processors/f/processors-forum/334867/redefining-malloc-in-rtsc-application I get the following error:


[C674X_0] ti.sysbios.heaps.HeapMem: line 221: out of memory: handle=0x81a700, size=216


The obvious thing to do is to increase the heap size:

/* Default Heap Creation: Local L2 memory */
var heapMemParams           = new HeapMem.Params();
heapMemParams.size          = 52*1024;  //this doesnt seem to do anything for the error
heapMemParams.sectionName   = "systemHeap";
Program.global.heap0        = HeapMem.create(heapMemParams);
Memory.defaultHeapInstance  = Program.global.heap0;


/* System stack size (used by ISRs and Swis) */
Program.stack = 0x800;
Program.heap = 0x2000;  //this causes spinning in memory.c



Unfortunately, heapMemParams.size = 52*1024 doesn't seem to do anything for this error. I still get it, the handle address just changes.  But Program.heap = 0x2000; seems to get rid of the error BUT causes it spins in memory.c 

In particular, in:

    /*-----------------------------------------------------------------------*/
    /* Scan through free list for packet large enough to contain packet      */
    /*-----------------------------------------------------------------------*/
    while (current && current->packet_size < newsize)
       current = current->size_ptr;


The packet_size never seems to increase and it loops here forever.

This problem occurs at the SOC_Init stage. So I can't even get to the main task because it goes SOC_Init -> Memory.c -> Crash or Loop Forever...


Any ideas regarding how to fix this?
-----------------------------------------------------------------------------



Here is my projectspec file:


<?xml version="1.0" encoding="UTF-8"?>
<projectSpec>
    <project
        name="dss-objdetdsp"
        deviceFamily="C674x"
        isTargetManual="false"
        device="IWR6843"
        endianness="little"
        cgtVersion="8.3.3"
        connection="common/targetdb/connections/TIXDS2XXUSB_Connection.xml"
        toolChain="TI"
        linkerCommandFile="xwr68xx_dss_objectdetection_test_linker.cmd"
        description="ObjDetDSP - DSS"
        launchWizard="false"
        configurations="Debug"
        compilerBuildOptions="
            -c
            -O0
            -eo=.oe674
            -mv6740
            --abi=eabi
            --reread_libs
            -g
            --define=SUBSYS_DSS
            --define=SOC_XWR68XX
            --define=NO_ANTENNA_CORRECTION
            --display_error_number
            --diag_warning=225
            --diag_wrap=off
            -z
            --warn_sections
            --ram_model
            --diag_error=10015
            --disable_push_pop
            --define=MMWAVE_L3RAM_NUM_BANK=6
            --define=MMWAVE_SHMEM_BANK_SIZE=0x20000
            -DAPP_RESOURCE_FILE='<'ti/datapath/dpc/objectdetection/objdetdsp/test/mmw_res.h'>'
            -i${MMWAVE_SDK_TOOLS_INSTALL_PATH}/mmwave_sdk_03_06_00_00-LTS/packages
            -i${MMWAVE_SDK_TOOLS_INSTALL_PATH}/xdctools_3_62_01_16_core/packages
            -i${MMWAVE_SDK_TOOLS_INSTALL_PATH}/bios_6_73_01_01/packages
            -i${MMWAVE_SDK_TOOLS_INSTALL_PATH}/dsplib_c64Px_3_4_0_0/packages
            -i${MMWAVE_SDK_TOOLS_INSTALL_PATH}/mathlib_c674x_3_1_2_1/packages
            "            
        linkerBuildOptions="
            -mv6740
            --abi=eabi
            --reread_libs
            -g
            --display_error_number
            --diag_warning=225
            --diag_wrap=off
            -z
            --warn_sections
            --ram_model
            --disable_push_pop
            --define=MMWAVE_L3RAM_NUM_BANK=6
            --define=MMWAVE_SHMEM_BANK_SIZE=0x20000                        
            -i${MMWAVE_SDK_INSTALL_PATH}/ti/drivers/osal/lib 
            -i${MMWAVE_SDK_INSTALL_PATH}/ti/drivers/soc/lib 
            -i${MMWAVE_SDK_INSTALL_PATH}/ti/drivers/edma/lib 
            -i${MMWAVE_SDK_INSTALL_PATH}/ti/utils/testlogger/lib 
            -i${MMWAVE_SDK_INSTALL_PATH}/ti/datapath/dpedma/lib 
            -i${MMWAVE_SDK_INSTALL_PATH}/ti/alg/mmwavelib/lib  
            -i${MMWAVE_SDK_INSTALL_PATH}/ti/drivers/mailbox/lib 
            -i${MMWAVE_SDK_INSTALL_PATH}/ti/control/dpm/lib 
            -i${MMWAVE_SDK_INSTALL_PATH}/ti/utils/mathutils/lib 
            -I${COM_TI_MMWAVE_SDK_INSTALL_DIR}/packages/ti/datapath/dpu/rangeproc/lib
            -i${MMWAVE_SDK_INSTALL_PATH}/ti/datapath/dpc/dpu/dopplerproc/lib 
            -I${COM_TI_MMWAVE_SDK_INSTALL_DIR}/packages/ti/datapath/dpc/dpu/aoaproc/lib
            -I${COM_TI_MMWAVE_SDK_INSTALL_DIR}/packages/ti/datapath/dpc/dpu/cfarcaproc/lib
            -i${MMWAVE_SDK_TOOLS_INSTALL_PATH}/dsplib_c64Px_3_4_0_0/packages/ti/dsplib/lib 
            -i${MMWAVE_SDK_TOOLS_INSTALL_PATH}/mathlib_c674x_3_1_2_1/packages/ti/mathlib/lib 
            -llibosal_xwr68xx.ae674 
            -llibsoc_xwr68xx.ae674 
            -llibedma_xwr68xx.ae674 
            -llibtestlogger_xwr68xx.ae674 
            -llibmailbox_xwr68xx.ae674 
            -llibmmwavealg_xwr68xx.ae674 
            -llibdpm_xwr68xx.ae674 
            -llibmathutils.ae674 
            -llibrangeproc_dsp_xwr68xx.ae674 
            -llibdopplerproc_dsp_xwr68xx.ae674 
            -llibaoaproc_dsp_xwr68xx.ae674 
            -llibcfarcaproc_dsp_xwr68xx.ae674
            -llibdpedma_hwa_xwr68xx.ae674  
            -llibmmwavealg_xwr68xx.ae674  
            -lrts6740_elf.lib 
            -ldsplib.ae64P             
            -lmathlib.ae674 
            --map_file=${MMWAVE_SDK_INSTALL_PATH}/ti/datapath/dpc/objectdetection/objdetdsp/test/xwr68xx_objectdetection_test_dss.map
            ">
        <!-- Project properties -->
        <property name="type" value="rtsc"/>
        <property name="products" value="com.ti.rtsc.SYSBIOS:6.73.01.01;com.ti.MMWAVE_SDK:03.06.00.00-LTS;"/>
        <property name="xdcToolsVersion" value="3.62.01.16_core"/>
        <property name="target" value="ti.targets.elf.C674"/>
        <property name="platform" value="ti.platforms.c6x:IWR68XX:false:600"/>
        <property name="endianness" value="little"/>
        <property name="output_format" value="elf"/>
        <property name="buildProfile" value="debug"/>
        <property name="configuroOptions" value="--compileOptions "--enum_type=int " "/>
        <!-- Project files -->
        <file path="${COM_TI_MMWAVE_SDK_INSTALL_DIR}/packages/ti/datapath/dpc/objectdetection/common/gen_frame_data.c" openOnCreation="false" excludeFromBuild="false" action="link"/>
        <file path="${COM_TI_MMWAVE_SDK_INSTALL_DIR}/packages/ti/board/antenna_geometry.c" openOnCreation="false" excludeFromBuild="false" action="link"/>
        <file path="${PARENT-1-WORKSPACE_LOC}/sdk/ti/datapath/dpc/objectdetection/objdetdsp/src/objectdetection.c" openOnCreation="false" excludeFromBuild="false" action="link"/>
        <file path="${PARENT-1-WORKSPACE_LOC}/sdk/ti/datapath/dpc/objectdetection/objdetdsp/test/main.c" openOnCreation="false" excludeFromBuild="false" action="link"/>
        <file path="${PARENT-1-WORKSPACE_LOC}/sdk/ti/datapath/dpc/objectdetection/objdetdsp/test/dss.cfg" openOnCreation="false" excludeFromBuild="false" action="link"/>
        <file path="${COM_TI_MMWAVE_SDK_INSTALL_DIR}/packages/ti/platform/xwr68xx/c674x_linker.cmd" openOnCreation="false" excludeFromBuild="false" action="copy"/>
        <file path="${COM_TI_MMWAVE_SDK_INSTALL_DIR}/packages/ti/datapath/dpc/objectdetection/objdetdsp/test/xwr68xx_dss_objectdetection_test_linker.cmd" openOnCreation="false" excludeFromBuild="false" action="link"/>
    </project>
</projectSpec>





Here is the full dss.cfg

/*
 *  Copyright 2011 by Texas Instruments Incorporated.
 *
 *  All rights reserved. Property of Texas Instruments Incorporated.
 *  Restricted rights to use, duplicate or disclose this code are
 *  granted through contract.
 *
 */
environment['xdc.cfg.check.fatal'] = 'false';

/********************************************************************
 ************************** BIOS Modules ****************************
 ********************************************************************/
var Defaults = xdc.useModule('xdc.runtime.Defaults');
var Diags = xdc.useModule('xdc.runtime.Diags');
var Error = xdc.useModule('xdc.runtime.Error');
var Log = xdc.useModule('xdc.runtime.Log');
var Main = xdc.useModule('xdc.runtime.Main');
var System = xdc.useModule('xdc.runtime.System');
var Text = xdc.useModule('xdc.runtime.Text');
var Memory    = xdc.useModule('xdc.runtime.Memory');
var SysStd    = xdc.useModule('xdc.runtime.SysStd');

var BIOS      = xdc.useModule('ti.sysbios.BIOS');
var MemAlloc = xdc.useModule('ti.sysbios.rts.MemAlloc');
MemAlloc.generateFunctions = false;
var HeapMem   = xdc.useModule('ti.sysbios.heaps.HeapMem');
var HeapBuf   = xdc.useModule('ti.sysbios.heaps.HeapBuf');
var Task      = xdc.useModule('ti.sysbios.knl.Task');
var Idle      = xdc.useModule('ti.sysbios.knl.Idle');
var SEM       = xdc.useModule('ti.sysbios.knl.Semaphore');
var Event     = xdc.useModule('ti.sysbios.knl.Event');
var Hwi       = xdc.useModule('ti.sysbios.family.c64p.Hwi');
var EventCombiner = xdc.useModule('ti.sysbios.family.c64p.EventCombiner');
var Load      = xdc.useModule('ti.sysbios.utils.Load');



/* Default Heap Creation: Local L2 memory */
var heapMemParams           = new HeapMem.Params();
heapMemParams.size          = 52*1024;
heapMemParams.sectionName   = "systemHeap";
Program.global.heap0        = HeapMem.create(heapMemParams);
Memory.defaultHeapInstance  = Program.global.heap0;
/*
* Enable Event Groups here and registering of ISR for specific GEM INTC is done
* using EventCombiner_dispatchPlug() and Hwi_eventMap() APIs
*/
EventCombiner.eventGroupHwiNum[0] = 7;
EventCombiner.eventGroupHwiNum[1] = 8;
EventCombiner.eventGroupHwiNum[2] = 9;
EventCombiner.eventGroupHwiNum[3] = 10;
/* 
*   turn the if to zero if you dont want any messages on CCS console say because of
*   slow printing. They can be viewed in CCS ROV viewer in SysMin module 
*/
if (1)
    System.SupportProxy = SysStd;
else
{
    var SysMin = xdc.useModule('xdc.runtime.SysMin');
    SysMin.bufSize = 4096;
    System.SupportProxy = SysMin;
}

/* Enable BIOS Task Scheduler */
BIOS.taskEnabled        =   true;


/* System stack size (used by ISRs and Swis) */
Program.stack = 0x800;
Program.heap = 0x2000;



Task.idleTaskStackSize = 0x400;

/*
 * Build a custom BIOS library.  The custom library will be smaller than the
 * pre-built "instrumented" (default) and "non-instrumented" libraries.
 *
 * The BIOS.logsEnabled parameter specifies whether the Logging is enabled
 * within BIOS for this custom build.  These logs are used by the RTA and
 * UIA analysis tools.
 *
 * The BIOS.assertsEnabled parameter specifies whether BIOS code will
 * include Assert() checks.  Setting this parameter to 'false' will generate
 * smaller and faster code, but having asserts enabled is recommended for
 * early development as the Assert() checks will catch lots of programming
 * errors (invalid parameters, etc.)
 */
BIOS.libType = BIOS.LibType_Custom;
BIOS.logsEnabled = false;
BIOS.assertsEnabled = true;

/* Make sure libraries are built with 32-bit enum types to be compatible with DSP enum types*/
BIOS.includeXdcRuntime  = true; 
BIOS.customCCOpts      += " --enum_type=int ";
BIOS.heapSize = 0x8000;





  • Hello,

    Increasing heap size does help and should be done, but you will also need to increase the amount of memory allocated to DATA_RAM in your linker.cmd file. Check your memory allocation tab within CCS to see how much is being given to DATA_RAM and PROG_RAM, and decrease from one to add to the other. Below is an example where I do exactly that

    Best Regards,

    Pedrhom Nafisi

  •  Okay but I am running this on the DSS, so wouldn't I have to modify c674x_linker.cmd? If so, how would I do it?


    I also get this error:

    warning #10247-D: creating output section ".sysmem" without a SECTIONS specification
    warning #10370-D: Possible codesize or performance degradation. Section ".text:__TI_printfi:rts6740_elf.lib<_printfi.c.obj>" has calls to rts routines, but rts is placed out of range from call site at 0x20005e8c, or in a different section. To optimize codesize, either 1) place rts closer to call site, or 2) place rts in same section, or 3) compile with --disable_push_pop.
    warning #10370-D: Possible codesize or performance degradation. Section ".text:__TI_printfi:rts6740_elf.lib<_printfi.c.obj>" has calls to rts routines, but rts is placed out of range from call site at 0x20003ec0, or in a different section. To optimize codesize, either 1) place rts closer to call site, or 2) place rts in same section, or 3) compile with --disable_push_pop.

    Does this have anything to do with the issue?

  • Hello,

    First I would ignore those warnings for now, second the c674x_linker.cmd works in the same way however the allocation slices are more occupied. You can similarly use memory allocation and force allocating certain sections to only one slice by removing the or symbol "|".

    Best Regards,

    Pedrhom

  • Okay I will ignore those warnings. And yea I tried moving some heap elements around using the DSP linker but I didn't get very far. Any professional advice on what the exact changes I should make might be? 

  • Hello,

    If you need a lot of space then unfortunately the DSS is very limited in space. However you are actually able to write from the DSS to the MSS directly using the TCMA address. Is there a specific reason the space you are allocating must be on the DSS/DSP/C674x?

    Best Regards,

    Pedrhom

  •  The reason I am using the DSS is because the ObjectDetectionDSP Unit Test is, by default, built for and run on the XWR's DSP. I am using the MMWave 3.06 SDK

    Here is the Makefile (in 3.06sdk/packages/ti/datapath/dpc/objectdetection/objdetdsp/makefile)

    ###################################################################################
    #   objdetdsp Test makefile
    ###################################################################################
    # The following needs to be before any makefile inclusion
    MAKEFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST)))
    MODULE_NAME := $(notdir $(patsubst %/,%,$(dir $(MAKEFILE_PATH))))
    
    include $(MMWAVE_SDK_LOCAL_PATH)/ti/common/mmwave_sdk.mak
    
    ##################################################################################
    # SOC Specific Test Targets
    ##################################################################################
    ifneq ($(filter $(MMWAVE_SDK_DEVICE_TYPE), xwr68xx xwr18xx xwr16xx), )
    include ./test/dssTest.mak
    ###################################################################################
    # Standard Targets which need to be implemented by each mmWave SDK module. This
    # plugs into the release scripts.
    ###################################################################################
    .PHONY: all clean test testClean dssTest dssTestClean help
    
    testClean:  dssTestClean
    test:       dssTest
    
    # Clean: This cleans all the objects
    clean:      testClean
    
    # This will build the hwa_edma test
    all: test
    
    # Help: This displays the MAKEFILE Usage.
    help:
    	@echo '****************************************************************************************'
    	@echo '* Makefile Targets for the objdetdsp test '
    	@echo 'clean             -> Clean out all the objects'
    	@echo 'test              -> Builds all the unit tests for the module'
    	@echo 'testClean         -> Cleans all the Unit Tests for the module'
    	@echo '****************************************************************************************'
    
    else
    # For some reason the .DEFAULT does not seem to work for lib, test
    .PHONY: lib test
    
    lib test .DEFAULT:
    	@echo "Error: $(MODULE_NAME) is not supported on $(MMWAVE_SDK_DEVICE) !!!"
    endif
    
    


    Is there another Unit Test that uses both the MSS and the DSS but may allow more space but also uses the DSP the run the object detection DPC?

    Thanks