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.

AM5729: CCS debug not not stop at main() and starts running

Part Number: AM5729
Other Parts Discussed in Thread: SYSBIOS

Hello,

I am trying to debug an application on CCS 11.1. When I load the program on the DSP core of the AM5729 (TMSIDK572x) device, the program immediately starts running and does not stop at main().

I paused the application, set a breakpoint at the initial line of the main() function and restarted the program. The program still does not come to the main() function. So it is apparently getting stuck at some point of execution even before reaching the main() function. 

The application is working and I have been able to debug it earlier. However, I had to reinstall CCS after I changed my laptop, and now I am not able to debug it. 

Any pointers to how I can solve this problem?

Thanks,

Dimple

  • Hello Dimple,

    If there is a point before main() that is running, like the entry point. You can find a place in the code to add a while loop. This can be in assembly or in C, whichever is more convenient. Add the infinite while loop, then connect with the debugger and you should be waiting in that while loop. You can then step through the code.

    Please let me know if this works for you.

    Thanks,

    Erick

  • Hello Eric,

    Thanks for the reply. 

    I had to set the check frequency parameter of dmtimer to false in the .cfg file for the program to reach main(). However, it is not clear to me why such a setting would be needed and in what scenarios, for the code to reach main(). If you have any explanation for the same, please let me know.

    Thanks,

    Dimple

  • Dimple,

    Can you share the .cfg file you are referring to? Is this a part of the SDK or a CCS related file?

    Thanks,

    Erick

  • Hi Erick,

    This is a CCS related file. 

     I am unable to attach the file here, so pasting the contents here: (The check frequency parameter is highlighted in red in the end)

    --------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    /* root of the configuration object model */
    var Program = xdc.useModule('xdc.cfg.Program');

    /* ================ General configuration ================ */
    var Task = xdc.useModule('ti.sysbios.knl.Task');
    var Semaphore = xdc.useModule('ti.sysbios.knl.Semaphore');
    var HWI = xdc.useModule('ti.sysbios.hal.Hwi');
    var Swi = xdc.useModule('ti.sysbios.knl.Swi');
    var SysStd = xdc.useModule('xdc.runtime.SysStd');
    var Clock = xdc.useModule('ti.sysbios.knl.Clock');
    var ECM = xdc.useModule ("ti.sysbios.family.c64p.EventCombiner");
    var cache = xdc.useModule ("ti.sysbios.hal.Cache");
    var Cache = xdc.useModule('ti.sysbios.family.c66.Cache');
    var IntXbar = xdc.useModule('ti.sysbios.family.shared.vayu.IntXbar');
    var GIO = xdc.useModule('ti.sysbios.io.GIO');


    var Timer = xdc.useModule('ti.sysbios.hal.Timer');
    var ti_sysbios_timers_dmtimer_Timer = xdc.useModule('ti.sysbios.timers.dmtimer.Timer');


    Cache.enableCache = true;


    /* default memory heap */
    var Memory = xdc.useModule('xdc.runtime.Memory');
    var HeapMem = xdc.useModule('ti.sysbios.heaps.HeapMem');
    var heapMemParams = new HeapMem.Params();
    heapMemParams.size = 0x600000;
    Memory.defaultHeapInstance = HeapMem.create(heapMemParams);
    Program.global.Heap = Memory.defaultHeapInstance;
    Program.sectMap["systemHeap"] = Program.platform.stackMemory;


    /*
    * Enable Event Groups here and registering of ISR for specific GEM INTC is done
    * using EventCombiner_dispatchPlug() and Hwi_eventMap() APIs
    */
    var exception = xdc.useModule('ti.sysbios.family.c64p.Exception');
    exception.enablePrint = true;

    /* ================ Task configuration ================ */

    /* No runtime stack checking is performed */
    Task.checkStackFlag = false;


    /* Reduce the number of task priorities */
    Task.numPriorities = 32;

    /* ================ Driver configuration ================ */

    /*use CSL package*/
    var socType = "am572x";
    var Csl = xdc.loadPackage('ti.csl');
    Csl.Settings.deviceType = socType;

    /* Load the OSAL package */
    var osType = "tirtos"
    var Osal = xdc.useModule('ti.osal.Settings');
    Osal.osType = osType;
    Osal.socType = socType;

    /* Load the gpio package */
    var GPIO = xdc.loadPackage('ti.drv.gpio');
    GPIO.Settings.socType = socType;

    /* Load the UART package */
    var Uart = xdc.loadPackage('ti.drv.uart');

    /* Load the I2C package */
    var I2c = xdc.loadPackage('ti.drv.i2c');

    /* Load the SPI package */
    var Spi = xdc.loadPackage('ti.drv.spi');


    * ======== IPC Configuration ========
    */
    xdc.useModule('ti.ipc.ipcmgr.IpcMgr');

    /* load the configuration shared across cores */
    Program.global.procName = "DSP1";
    var ipc_cfg = xdc.loadCapsule("../configs/ipc.cfg.xs");

    var BIOS = xdc.useModule('ti.sysbios.BIOS');
    BIOS.cpuFreq.lo = 600000000;
    /*
    * ======== SYS/BIOS Configuration ========
    */
    if (Program.build.profile == "debug") {
    BIOS.libType = BIOS.LibType_Debug;
    } else {
    BIOS.libType = BIOS.LibType_Custom;
    }

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

    /* no rts heap */
    Program.argSize = 1024; /* minimum size */
    //BWC increase stack size
    Program.stack = 0x80000;

    var Task = xdc.useModule('ti.sysbios.knl.Task');
    Task.common$.namedInstance = true;


    /* create a heap for MessageQ messages */
    var HeapBuf = xdc.useModule('ti.sysbios.heaps.HeapBuf');
    var params = new HeapBuf.Params;
    params.align = 8;
    params.blockSize = 512;
    params.numBlocks = 256;
    var msgHeap = HeapBuf.create(params);

    var MessageQ = xdc.useModule('ti.sdo.ipc.MessageQ');
    MessageQ.registerHeapMeta(msgHeap, 0);

    /* Setup MessageQ transport */
    var VirtioSetup = xdc.useModule('ti.ipc.transports.TransportRpmsgSetup');
    MessageQ.SetupTransportProxy = VirtioSetup;

    /* Setup NameServer remote proxy */
    var NameServer = xdc.useModule("ti.sdo.utils.NameServer");
    var NsRemote = xdc.useModule("ti.ipc.namesrv.NameServerRemoteRpmsg");
    NameServer.SetupProxy = NsRemote;

    /* Enable Memory Translation module that operates on the BIOS Resource Table */
    var Resource = xdc.useModule('ti.ipc.remoteproc.Resource');
    Resource.loadSegment = "EXT_CODE";

    /* Use SysMin because trace buffer address is required for Linux/QNX
    * trace debug driver, plus provides better performance.
    */
    var System = xdc.useModule('xdc.runtime.System');
    var SysMin = xdc.useModule('ti.trace.SysMin');
    System.SupportProxy = SysMin;
    SysMin.bufSize = 0x8000;

    Program.sectMap[".tracebuf"] = "TRACE_BUF";
    Program.sectMap[".errorbuf"] = "EXC_DATA";


    ti_sysbios_timers_dmtimer_Timer.checkFrequency = false;

    --------------------------------------------------------------------------------------------------------------------------------------------------------

    Thanks,

    Dimple

  • HI Dimple,

    Can you disable auto-run to main and see where it is causing the issue?
    Do the following steps to disable auto run:

    1) Run -> Debug Configurations
    2) Target -> AutoRun and Launch options
    3) Empty the field Run to Symbol

    ti_sysbios_timers_dmtimer_Timer.checkFrequency = false;

    This will make sure that you do not run to main and start at the reset vectors. You can single step from there to see what actually is causing the issue, which might explain why the above change is working.

    Regards,
    Parth

  • Hi Parth,

    I tried the steps you have listed. Even after that, the issue remains:

    When the Timer checkFrequency param is set as true, the program keeps running and does not reach main at all. I tried to set a break point at some location before the code reaches main - The code stops at the breakpoint, but when I single step further it again starts running continuously.

    The code stops at main during debug when the checkFrequency parameter is set as false. But simultaneously, another problem that has occurred is that a Timer that was previously working in the code is no longer working. There are no timer interrupts generated and as a result the tasks associated with the timer interrupts are not working. I am not sure, but it could be related to setting the checkFrequency to false. Prior to this change the code was working correctly.

    Note - These issues arose only after I installed CCS in Windows. Prior to this, I was using CCS on Ubuntu, and the program worked as expected even when the Timer checkFrequency param was set as true. Could the OS make any difference to the project/CCS settings?

    Thank you,

    Dimple

  • HI Dimple,

    Apologies for delay in response. Is this issue still open?

    Note - These issues arose only after I installed CCS in Windows. Prior to this, I was using CCS on Ubuntu, and the program worked as expected even when the Timer checkFrequency param was set as true. Could the OS make any difference to the project/CCS settings?


    Changing the OS should not impact this? Were you using the same CCS version in both Ubuntu and Windows?
    Also, cab you please try using an earlier version of CCS. Maybe try 9.3?

    Regards,
    Parth