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.

What project setup prevents deviceConfig() while loop from completing?

Other Parts Discussed in Thread: SYSBIOS, CCSTUDIO

Hello,

Please see the background details in this post:

http://e2e.ti.com/support/development_tools/code_composer_studio/f/81/t/161349.aspx

When I start the debugger it consistently gets stuck in a sysbios function called deviceConfig() which is in a Timer.c file.

From bios_6_32_05_54\packages\ti\sysbios\timers\dmtimer\Timer.c, deviceConfig():

 /* if doing SOFTRESET: do it first before setting other flags */

    if (obj->tiocpCfg & TIMER_TIOCP_CFG_SOFTRESET_FLAG) {

        timer->tiocpCfg = TIMER_TIOCP_CFG_SOFTRESET_FLAG;

        while (timer->tiocpCfg & TIMER_TIOCP_CFG_SOFTRESET_FLAG)

                ;

    }

The while loop never ends (timer->tiocpCfg is always 0).

What project setup could be missing?

A temporary workaround is to change the .cfg file based on advice in this thread:

http://e2e.ti.com/support/embedded/bios/f/355/t/135119.aspx#485813

With the temporary change, the debugger successfully jumps to main().

Without the temporary change the debugger consistently gets lost and it is stuck in the while loop above

The temporary change (commented out in the version below):

/* TEMP!!!!!!!!!!!!!!!!!!!

*

var Clock = xdc.useModule('ti.sysbios.knl.Clock');

Clock.tickSource = Clock.TickSource_NULL;

* TEMP END!!!!!!!!!!!!!!!!!!!

*/

Setup details:

CCS 5.1.0.09000
SYS/BIOS 6.32.05.54
XDC tools 3.22.04.46
Loading code on C674x on a DM816x EVM.

Thanks,

Annie

  • Annie,

    What gel file(s) are you using? Does the infinite loop occur every time when you connect, load and run on the DSP?

    Can you list your exact steps you are doing to get into this situation.

    Todd

  • 7317.evm816x.txt

    Hello Todd,

    I got the gel file from here: http://support.spectrumdigital.com/boards/evm816x/revg/files/evm816x.gel

    I am attaching it (renamed to evm816x.txt).

    The infinite loop occurs with a large project which I have been porting from CCS 3.3. and BiOS 5.41. The infinite loop does not occur when I create a very simple project based on a helloWorld example.

    The steps I follow are:

    Launch the target configuration (I have cut and paste the target configuration source EvmWithC674x.ccxml below).

    Connect to the Cortex A8. The Debug windows shows the state as "Suspended" for the Cortex A8.

    Run the script EVM816x CPUs BRINGUP – C674x.

    Connect to the C674x DSP.

    Load my code.

    When the debugger options are set so that Auto Run Options, Run to Symbol = "main", then the debugger shows that it is running but it does not reach main(). If I pause the debugger I see that it is in the while loop mentioned in my original post.

    When the debugger options are set so that Auto Run Options, Run to Symbol = "c_int00", then the debugger stops in c_int00 and I can single-step through the initialization code. If I press the Run button then it shows that it is running, and if I pause the debugger I see that it is in the while loop mentioned in my original post.

    I have also cut and paste the contents of the project .cfg file below.

    Regards,

    Annie

    Source of EvmWithC674x.ccxml

    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <configurations XML_version="1.2" id="configurations_0">
    <configuration XML_version="1.2" id="Spectrum Digital XDS510USB Emulator_0">
            <instance XML_version="1.2" desc="Spectrum Digital XDS510USB Emulator_0" href="connections/SD510USB_Connection.xml" id="Spectrum Digital XDS510USB Emulator_0" xml="SD510USB_Connection.xml" xmlpath="connections"/>
            <connection XML_version="1.2" id="Spectrum Digital XDS510USB Emulator_0">
                <instance XML_version="1.2" href="drivers/sdgoicepickusb_d.xml" id="drivers" xml="sdgoicepickusb_d.xml" xmlpath="drivers"/>
                <instance XML_version="1.2" href="drivers/sdgo674xpusb.xml" id="drivers" xml="sdgo674xpusb.xml" xmlpath="drivers"/>
                <instance XML_version="1.2" href="drivers/sdgocs_dapusb.xml" id="drivers" xml="sdgocs_dapusb.xml" xmlpath="drivers"/>
                <instance XML_version="1.2" href="drivers/sdgocortexAusb.xml" id="drivers" xml="sdgocortexAusb.xml" xmlpath="drivers"/>
                <instance XML_version="1.2" href="drivers/sdgocschildusb.xml" id="drivers" xml="sdgocschildusb.xml" xmlpath="drivers"/>
                <instance XML_version="1.2" href="drivers/sdgocsstmusb.xml" id="drivers" xml="sdgocsstmusb.xml" xmlpath="drivers"/>
                <instance XML_version="1.2" href="drivers/sdgoetbcsusb.xml" id="drivers" xml="sdgoetbcsusb.xml" xmlpath="drivers"/>
                <platform XML_version="1.2" id="platform_0">
                    <instance XML_version="1.2" desc="DM8168_0" href="devices/dm8168.xml" id="DM8168_0" xml="dm8168.xml" xmlpath="devices"/>
                    <device HW_revision="1" XML_version="1.2" description="DaVinci DM81xx - Cortex A8 and C64x+ Fixed-point DSP" id="DM8168_0" partnum="DM8168">
                        <router HW_revision="1.0" XML_version="1.2" description="ICEPick_D Router" id="IcePick_D_0" isa="ICEPICK_D">
                            <subpath id="subpath_12">
                                <router HW_revision="1.0" XML_version="1.2" description="CS_DAP Router" id="CS_DAP_0" isa="CS_DAP">
                                    <subpath id="ModenaSS">
                                        <cpu HW_revision="1.0" XML_version="1.2" description="Cortex_A8 CPU" id="CortexA8" isa="Cortex_A8">
                                            <property Type="filepathfield" Value="..\..\emulation\boards\gel\evm816x.gel" id="GEL File"/>
                                        </cpu>
                                    </subpath>
                                </router>
                            </subpath>
                        </router>
                    </device>
                </platform>
            </connection>
        </configuration>
    </configurations>

    Contents of .cfg file

    var Semaphore = xdc.useModule('ti.sysbios.knl.Semaphore');
    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 LoggerBuf = xdc.useModule('xdc.runtime.LoggerBuf');
    var Main = xdc.useModule('xdc.runtime.Main');
    var Memory = xdc.useModule('xdc.runtime.Memory')
    var SysMin = xdc.useModule('xdc.runtime.SysMin');
    var System = xdc.useModule('xdc.runtime.System');
    var Text = xdc.useModule('xdc.runtime.Text');

    var BIOS = xdc.useModule('ti.sysbios.BIOS');
    var Hwi = xdc.useModule('ti.sysbios.hal.Hwi');
    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');

    Program.global.SEM_AudioProc = Semaphore.create(0);
    Program.global.SEM_AudioHDI = Semaphore.create(0);


  • "The infinite loop occurs with a large project which I have been porting from CCS 3.3. and BiOS 5.41. The infinite loop does not occur when I create a very simple project based on a helloWorld example."

    Is the above contents of your examples .cfg file complete? I'd like to compare it against the generated hello.cfg file.

    Todd

  • Yes, the .cfg file contents are complete.

    I'm attaching the hello.cfg (renamed to .txt) from my environment.

    Regards,
    Annie1781.hello.cfg.txt

  • Annie,

    Unfortunately the expert on this is out of the office today. Can you take a look at this thread: http://e2e.ti.com/support/embedded/bios/f/355/t/91062.aspx

    Could this be related?

    Todd

  • Todd,

    I looked at the thread in your latest post. No timers are defined in my .cfg file. Is that a problem? There are also no timers in the hello.cfg file for the simple project which works.

    I can try redefining the timer base addresses but I'm not sure where the other poster found the "timer mapping table for ducati as shown in RTSC package documentation". I would need to find the mapping for C674x. I've looked on http://rtsc.eclipse.org/cdoc-tip/index.html but have not found the right link yet. Where can I find the RTSC timer mapping for C674x?

    I would also need to know the correct timer base addresses. I see a list of timer register addresses in section 8.19.1 Timer Peripheral Register Descriptions in sprs614a.pdf (TMS320DM816x DaVinci Digital Media Processors). Are these the correct base addresses? If so, which row in the table should I use?

    Thanks,
    Annie

  • Annie,

    I believe the problem is that your gel file does not enable the timers. Can you try adding something like the following and execute the enableGpTimers before you run the test? The address may be slightly different, so please check the datasheet.

    hotmenu enableGpTimers()

    {

        /* enable GPTIMER 3 (CM_L4PER_GPTIMER3_CLKCTRL) */

          *(int *)0x4a009440 = 0x00000002;

         

          /* route suspend src to ducati core 0 (DRM SUSPEND CTRL REGISTER 18) */

          *(int *)0x54160248 = 0x00000041;

     

        /* enable GPTIMER 4 (CM_L4PER_GPTIMER4_CLKCTRL) */

          *(int *)0x4a009448 = 0x00000002;

     

          /* route suspend src to ducati core 0 (DRM SUSPEND CTRL REGISTER 19) */

          *(int *)0x5416024C = 0x00000041;

     

        /* enable GPTIMER 9 (CM_L4PER_GPTIMER9_CLKCTRL) */

          *(int *)0x4a009450 = 0x00000002;

     

          /* route suspend src to ducati core 0 (DRM SUSPEND CTRL REGISTER 20) */

          *(int *)0x54160250 = 0x00000041;

     

        /* enable GPTIMER 11 (CM_L4PER_GPTIMER11_CLKCTRL) */

          *(int *)0x4a009430 = 0x00000002;

     

          /* route suspend src to ducati core 0 (DRM SUSPEND CTRL REGISTER 22) */

          *(int *)0x54160258 = 0x00000041;

    }

  • Todd,

    Thanks for your reply.

    I am still stuck on this problem. I went back to a TI sample program taken from this folder on my PC:

    C:\CCStudio_v5.1\bios_6_32_05_54\packages\ti\sysbios\examples\generic\mutex

    I found that this sample project also fails when I launch the debugger, and it is stuck inside the WHILE loop in deviceConfig() in C:\CCStudio_v5.1\bios_6_32_05_54\packages\ti\sysbios\timers\dmtimer\Timer.c.  So it is behaving the same way as my large project but it is easier to work with.

    I significantly simplified the mutex.c file so that basically all it has is this:

    #include <xdc/std.h>

    Void main()
    {
    int i;
    i = 0;
    }

    I experimented with removing lines from mutex.cfg.  I found that when ANY line with ti.sysbios... is added, the debugger gets stuck in the WHILE loop.

    Having these lines in mutex.cfg works i.e. the debugger runs to main():

    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 LoggerBuf = xdc.useModule('xdc.runtime.LoggerBuf');
    var Main = xdc.useModule('xdc.runtime.Main');
    var Memory = xdc.useModule('xdc.runtime.Memory')
    var SysMin = xdc.useModule('xdc.runtime.SysMin');
    var System = xdc.useModule('xdc.runtime.System');
    var Text = xdc.useModule('xdc.runtime.Text');

    Adding any single one of these lines in mutex.cfg causes the debugger to get stuck:

    var BIOS = xdc.useModule('ti.sysbios.BIOS');
    var Clock = xdc.useModule('ti.sysbios.knl.Clock');
    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 HeapMem = xdc.useModule('ti.sysbios.heaps.HeapMem');

    I am attaching the zipped project folder. If you open mutex.cfg you will see that the lines above which use ti.sysbios... have been commented out and in this state the project jumps to main successfully in the debugger.

    I have spent some time trying to figure out how to implement your suggestion about timers. It would REALLY help if you gave me the required gel file function for loading code on the C674x on a DM816x EVM. I have looked at the DM816x data sheet (sprs614a.pdf) which describes seven timers, none of which is called "general purpose". Which timers should I use? In your suggestion above GP timers 3, 4, 9 and 11 are used. Which ones should I use for my case? Also, in your suggestion above there are lines which "route suspend src to ducati core" registers. What does this mean and do I need to do something similar in my case? I think I'm missing a reference document or something. Or is there a sample gel file for the DM816x EVM which sets up the timers correctly??

    Thanks,
    Annie

    1778.mutexTest.zip

  • Hi Annie,

    Here is the gel file that we use on the A8 to enable the timers. Note: in your simplified code, you still need BIOS_start at the end of main().

    7183.ti816x_ddr.gel.txt

  • FINALLY!!!

    YAY!!!!!

    :-)

    Thank you. Running your enableTimers() hotMenu function just once after the EVM powers up allows my DSP code to consistently run to main() when I launch the debugger.

    I think this gel file should be made available to others.

    Annie.

  • I am attaching a target configuration file and gel file which will start the required timers when the you connect to the CortexA8 (both renamed to .txt to allow attaching).

    5700.evm.gel.txt

  • 0743.evmC674x.ccxml.txt

    The original file names were: polydspEvm.gel and polydspEvmC674x.ccxml.  Use these names.