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.

IWR1642BOOST: The code for IWR1642BOOST is getting struck at ESM_init(0) in CCS debug

Part Number: IWR1642BOOST
Other Parts Discussed in Thread: SYSBIOS

Tool/software:

HI, 

I am creating a custom code for IWR1642BOOST. I want to debug few portion of the code using CCS Studio. However the breakpoint never goes after ESM_init(0). It's not showing any error. Inside ESM_init(0), I think something weird is happening at hwi_create(). I am not able to figure out this further. I am able to debug using mmWAVE oob demo, but with custom demo, I am getting this issue. Please see my cfg file below 

/*
* 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 Memory = xdc.useModule('xdc.runtime.Memory');
var BIOS = xdc.useModule('ti.sysbios.BIOS');
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.arm.v7r.vim.Hwi');
var System = xdc.useModule('xdc.runtime.System');
var SysStd = xdc.useModule('xdc.runtime.SysStd');
var clock = xdc.useModule('ti.sysbios.knl.Clock');
var Pmu = xdc.useModule('ti.sysbios.family.arm.v7a.Pmu');
var Load = xdc.useModule('ti.sysbios.utils.Load');
var timer = xdc.useModule('ti.sysbios.hal.Timer');
System.SupportProxy = SysStd;
/* FIQ Stack Usage: */
Hwi.fiqStackSize = 2048;
Hwi.fiqStackSection = ".myFiqStack"
Program.sectMap[".myFiqStack"] = "DATA_RAM";
/* Default Heap Creation: Local L2 memory */
var heapMemParams = new HeapMem.Params();
heapMemParams.size = 32*1024;
heapMemParams.sectionName = "systemHeap";
Program.global.heap0 = HeapMem.create(heapMemParams);
Memory.defaultHeapInstance = Program.global.heap0;
/* Enable BIOS Task Scheduler */
BIOS.taskEnabled = true;
/* Reduce the size of BIOS */
BIOS.swiEnabled = false; /* We don't use SWIs */
BIOS.libType = BIOS.LibType_Custom;
Program.stack = 2048; /* for isr context */
Task.idleTaskStackSize = 800;
var Text = xdc.useModule('xdc.runtime.Text');
Text.isLoaded = false;
/* do not call update for load - Application will call it at inter-frame boundary */
Load.updateInIdle = false;
/* Install idle function to sleep the R4F (using WFI instruction). Note above
Load.updateInIdle is false which allows to sleep the R4F in idle.
Also, no other book-keeping etc functions should be installed in the idle thread */
//Idle.addFunc('&MmwDemo_sleep');
Program.sectMap[".vecs"] = "VECTORS";
/* Make sure libraries are built with 32-bit enum types to be compatible with DSP enum types*/
BIOS.includeXdcRuntime = true;
BIOS.libType = BIOS.LibType_Custom;
BIOS.customCCOpts += " --enum_type=int ";
/********************************************************************
* Enabling DebugP Log Support
********************************************************************/
var Log = xdc.useModule('xdc.runtime.Log');
var Main = xdc.useModule('xdc.runtime.Main');
var Diags = xdc.useModule('xdc.runtime.Diags');
var LoggerBuf = xdc.useModule('xdc.runtime.LoggerBuf');
/* Configure the Logger Buffer: */
var loggerBufParams = new LoggerBuf.Params();
loggerBufParams.bufType = LoggerBuf.BufType_CIRCULAR;
loggerBufParams.exitFlush = false;
loggerBufParams.instance.name = "_logInfo";
loggerBufParams.numEntries = 200;
/* Create the Logger and attach this to the application */
MyAppLogger = LoggerBuf.create(loggerBufParams);
Main.common$.logger = MyAppLogger;
Main.common$.diags_USER1 = Diags.RUNTIME_ON;
Task.common$.diags_USER1 = Diags.RUNTIME_ON;
My main code looks like this 
int main(int argc, char **argv)
{
SOC_Handle socHandle;
SOC_Cfg socCfg;
DMA_Params dmaParams;
int32_t errCode;
UART_Params params;
UART_Handle handle;
int32_t status;
uint32_t index;
uint32_t baudRate = 115200;
uint8_t txData = 'A';
/* Initialize the ESM: Dont clear errors as TI RTOS does it */
ESM_init(0U);
/* Initialize the SOC confiugration: */
memset ((void *)&socCfg, 0, sizeof(SOC_Cfg));
/* Populate the SOC configuration: On the EVM we want to ensure that the BSS is
* executing and the system clock is correctly configured. */
socCfg.clockCfg = SOC_SysClock_INIT;
/* Initialize the SOC Module: This is done as soon as the application is started
* to ens ure that the MPU is correctly configured. */
socHandle = SOC_init (&socCfg, &errCode);
/* Initialize the UART */
UART_init();
/* Initialize the DMA */
DMA_init ();
/* Open the DMA Instance */
DMA_Params_init(&dmaParams);
gDMAHandle = DMA_open(0, &dmaParams, &errCode);
/* Setup the PINMUX to bring out the MSS UART-1 */
Pinmux_Set_FuncSel(SOC_XWR16XX_PINN5_PADBE, SOC_XWR16XX_PINN5_PADBE_MSS_UARTA_TX);
Pinmux_Set_OverrideCtrl(SOC_XWR16XX_PINN5_PADBE, PINMUX_OUTEN_RETAIN_HW_CTRL, PINMUX_INPEN_RETAIN_HW_CTRL);
Pinmux_Set_FuncSel(SOC_XWR16XX_PINN4_PADBD, SOC_XWR16XX_PINN4_PADBD_MSS_UARTA_RX);
Pinmux_Set_OverrideCtrl(SOC_XWR16XX_PINN4_PADBD, PINMUX_OUTEN_RETAIN_HW_CTRL, PINMUX_INPEN_RETAIN_HW_CTRL);
/* Setup the PINMUX to bring out the MSS UART-3 */
Pinmux_Set_OverrideCtrl(SOC_XWR16XX_PINF14_PADAJ, PINMUX_OUTEN_RETAIN_HW_CTRL, PINMUX_INPEN_RETAIN_HW_CTRL);
Pinmux_Set_FuncSel(SOC_XWR16XX_PINF14_PADAJ, SOC_XWR16XX_PINF14_PADAJ_MSS_UARTB_TX);
/* Setup the default UART Parameters */
UART_Params_init(&params);
params.clockFrequency = gCPUClockFrequency;
params.baudRate = baudRate;
params.isPinMuxDone = 1;
handle = UART_open(0, &params);
while(1)
{
for (index = 0; index < 10; index++)
{
/* Write out the character: */
status = UART_writePolling(handle, &txData, 1);
if (status < 0)
{
System_printf("Error: Unable to send out the data [%d] on UART-3 [Error %d]\n", index, status);
return -1;
}
/* Next iteration; next character */
if (txData == 'Z')
{
txData = 'A';
}
else
{
txData++;
}
}
}
UART_close (handle);
BIOS_start();
return 0;
}
If I comment out, ESM_Init then it will be struck at SOC_Init. For SOC_Init the issue is from   buffer = HeapMem_allocUnprotected(obj, reqSize, reqAlign); from the function HeapMem_alloc() in HeapMem.c Basically buffer is returning NULL. I am not able to debug further.  
I am able to see proper workflow with Test codes and OOB binary in mmWave SDK 3.6 and I reused the config file and many other snippets from the existing code. 
Please help
  • Hello.

    It doesn't look like you provided your configuration in the post.  Are you using a configuration from the SDK or is this a custom configuration?

    Sincerely,

    Santosh

  • The cfg file was reused from mmWave OOB demo for building 

    environment['xdc.cfg.check.fatal'] = 'false';
    /********************************************************************
    ************************** BIOS Modules ****************************
    ********************************************************************/
    var Memory = xdc.useModule('xdc.runtime.Memory');
    var BIOS = xdc.useModule('ti.sysbios.BIOS');
    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.arm.v7r.vim.Hwi');
    var System = xdc.useModule('xdc.runtime.System');
    var SysStd = xdc.useModule('xdc.runtime.SysStd');
    var clock = xdc.useModule('ti.sysbios.knl.Clock');
    var Pmu = xdc.useModule('ti.sysbios.family.arm.v7a.Pmu');
    var Load = xdc.useModule('ti.sysbios.utils.Load');
    var timer = xdc.useModule('ti.sysbios.hal.Timer');
    System.SupportProxy = SysStd;
    /* FIQ Stack Usage: */
    Hwi.fiqStackSize = 2048;
    Hwi.fiqStackSection = ".myFiqStack"
    Program.sectMap[".myFiqStack"] = "DATA_RAM";
    /* Default Heap Creation: Local L2 memory */
    var heapMemParams = new HeapMem.Params();
    heapMemParams.size = 32*1024;
    heapMemParams.sectionName = "systemHeap";
    Program.global.heap0 = HeapMem.create(heapMemParams);
    Memory.defaultHeapInstance = Program.global.heap0;
    /* Enable BIOS Task Scheduler */
    BIOS.taskEnabled = true;
    /* Reduce the size of BIOS */
    BIOS.swiEnabled = false; /* We don't use SWIs */
    BIOS.libType = BIOS.LibType_Custom;
    Program.stack = 2048; /* for isr context */
    Task.idleTaskStackSize = 800;
    var Text = xdc.useModule('xdc.runtime.Text');
    Text.isLoaded = false;
    /* do not call update for load - Application will call it at inter-frame boundary */
    Load.updateInIdle = false;
    /* Install idle function to sleep the R4F (using WFI instruction). Note above
    Load.updateInIdle is false which allows to sleep the R4F in idle.
    Also, no other book-keeping etc functions should be installed in the idle thread */
    //Idle.addFunc('&MmwDemo_sleep');
    Program.sectMap[".vecs"] = "VECTORS";
    /* Make sure libraries are built with 32-bit enum types to be compatible with DSP enum types*/
    BIOS.includeXdcRuntime = true;
    BIOS.libType = BIOS.LibType_Custom;
    BIOS.customCCOpts += " --enum_type=int ";
    /********************************************************************
    * Enabling DebugP Log Support
    ********************************************************************/
    var Log = xdc.useModule('xdc.runtime.Log');
    var Main = xdc.useModule('xdc.runtime.Main');
    var Diags = xdc.useModule('xdc.runtime.Diags');
    var LoggerBuf = xdc.useModule('xdc.runtime.LoggerBuf');
    /* Configure the Logger Buffer: */
    var loggerBufParams = new LoggerBuf.Params();
    loggerBufParams.bufType = LoggerBuf.BufType_CIRCULAR;
    loggerBufParams.exitFlush = false;
    loggerBufParams.instance.name = "_logInfo";
    loggerBufParams.numEntries = 200;
    /* Create the Logger and attach this to the application */
    MyAppLogger = LoggerBuf.create(loggerBufParams);
    Main.common$.logger = MyAppLogger;
    Main.common$.diags_USER1 = Diags.RUNTIME_ON;
    Task.common$.diags_USER1 = Diags.RUNTIME_ON;

  • Let me look into this and provide an update by the end of the day Thursday.

    Sincerely

    Santosh

  • Hello.

    Did you make any changes to the start-up code?  Or is the custom demo only custom in the processing only?  If you are failing due to insufficient memory, it may be due to the way memory is allocated and you will have to rearrange how the memory is organized in the linker file.

    Sincerely,

    Santosh