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.

Problem with Task_sleep

Other Parts Discussed in Thread: SYSBIOS, OMAP3530

Salam alikum, 

I have a problem with Task_sleep
when I use it, it blocks the program and not come back and resume

So I tested it in the task example in sysbios examples in CCS

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

code:

#include <xdc/std.h>
#include <xdc/runtime/System.h>

#include <ti/sysbios/BIOS.h>
#include <ti/sysbios/knl/Clock.h>
#include <ti/sysbios/knl/Task.h>
#include <ti/sysbios/knl/Semaphore.h>

#include <xdc/cfg/global.h>

Void task1(UArg arg0, UArg arg1);

Task_Handle tsk1;
Task_Handle tsk2;


/*
* ======== main ========
*/
Void main()
{
Task_Params taskParams;

/* Create two tasks that share a resource*/
Task_Params_init(&taskParams);
tsk1 = Task_create (task1, &taskParams, NULL);

BIOS_start();
}

/*
* ======== task1 ========
*/
Void task1(UArg arg0, UArg arg1)
{
System_printf("Running task1 function\n");
Task_sleep(100);
System_printf("Finishing task1 function\n");
}

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

when I try to run this code, only the output of the first System_printf appears.

and this is the environment: 

- CCS5.0.0.00095.

- Project type: C6000.

- Generic C64x+ Device.

- RTSC Platform: evm3530.

- and when I simulate the program I use Texas Instruments Simulator ==> C64x+ CPU Cycle Accurate Simulator, Little Endian.

Thanks in advance (: 

  • Hi Reda,

    Can you look at the Clock module in Tools->ROV (also called Tools->RTOS Object View). In one of Clock "Module" tabs, can you see if the "ticks" field is increasing? Can you attach your .cfg file also? I want to see the configuration you have for the SYS/BIOS clock module.

    Todd

  • Thanks my dear ToddMullanix.

    I do not edit in the cfg file of task example

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

    /*
    * Copyright (c) 2010, Texas Instruments Incorporated
    * All rights reserved.
    *
    * Redistribution and use in source and binary forms, with or without
    * modification, are permitted provided that the following conditions
    * are met:
    *
    * * Redistributions of source code must retain the above copyright
    * notice, this list of conditions and the following disclaimer.
    *
    * * Redistributions in binary form must reproduce the above copyright
    * notice, this list of conditions and the following disclaimer in the
    * documentation and/or other materials provided with the distribution.
    *
    * * Neither the name of Texas Instruments Incorporated nor the names of
    * its contributors may be used to endorse or promote products derived
    * from this software without specific prior written permission.
    *
    * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
    * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
    * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
    * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
    * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
    * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
    * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
    * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
    * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
    * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
    * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    * */
    /*
    * ======== mutex.cfg ========
    *
    */
    /* Include function that helps minimize code and data footprint */
    xdc.includeFile("sizing.cfg.xs");
    /*
    * Use BASIC or MINIMAL footprint settings. Uncomment following
    * lines to reduce code and data footprint if needed. See sizing.cfg.xs for more
    * details
    */
    //sizingConfig("BASIC");
    //sizingConfig("MINIMAL");

    var Memory = xdc.useModule('xdc.runtime.Memory');
    var System = xdc.useModule('xdc.runtime.System');
    var SysStd = xdc.useModule('xdc.runtime.SysStd');
    var LoggerBuf = xdc.useModule('xdc.runtime.LoggerBuf');
    var Main = xdc.useModule('xdc.runtime.Main');
    var Defaults = xdc.useModule('xdc.runtime.Defaults');
    var Diags = xdc.useModule('xdc.runtime.Diags');

    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');

    /* Create default heap and hook it into Memory */
    var heapMemParams = new HeapMem.Params;
    var targName = Program.build.target.$name;
    if (targName.indexOf("C28") != -1) {
    /*
    * 28x targets have limited memory and require Task stacks to be placed
    * in memory entirely below the address 0x10000.
    * Setting 'sectionName' to '.taskStackSection' accomplishes this.
    */
    heapMemParams.size = 0x800;
    var heap0 = HeapMem.create(heapMemParams);
    heap0.sectionName = ".taskStackSection";
    }
    else if (targName.indexOf("MSP430") != -1) {
    var heapMemParams = new HeapMem.Params;
    heapMemParams.size = 0x800;
    var heap0 = HeapMem.create(heapMemParams);
    }
    else {
    var heapMemParams = new HeapMem.Params;
    heapMemParams.size = 8192;
    var heap0 = HeapMem.create(heapMemParams);
    }

    Memory.defaultHeapInstance = heap0;

    /*
    * Create and install logger for the whole system
    */
    var loggerBufParams = new LoggerBuf.Params();
    loggerBufParams.numEntries = 32;
    logger0 = LoggerBuf.create(loggerBufParams);
    Defaults.common$.logger = logger0;
    Main.common$.diags_INFO = Diags.ALWAYS_ON;

    /* Configure SysStd to send System_printfs to standard out */
    System.SupportProxy = SysStd;

    /*
    * @(#) ti.sysbios.examples; 2, 0, 0, 0,49; 9-16-2010 11:50:16; /db/vtree/library/trees/avala/avala-n48x/src/ xlibrary

    */


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

    and when I pressing on ROV , this is what appears

    where is the "ticks" field ??

  • To see data in ROV, you have to stop the target.

    Did you comment out the Clock module in the .cfg file? Can you uncomment the line and rebuild?

    Todd

     

     

  • I have rebuilt the project after uncommenting the line of  Clock module
    but in ROV when I choose Clock Module, in the Basic tab there is "No data to display"
    and in Module tab "ticks" remains zero before and after running. 

    Reda

  • Reda,

    I believe the problem is that the simulator you're running the program on does not model the timers assumed to be there by the SYS/BIOS application.

    Usage of the evm3530 platform informs SYS/BIOS that certain timers are available for use to generate the periodic tick.

    If you ran your application on a board with an actual OMAP3530 device on it (ie a beagleboard), I think it would run correctly.

    If you switch to using the DA830 Device Cycle Accurate Simulator for your CCS target, and switch to the RTSC evmDA830 platform to build your application against I think you'll have better luck.

    Alan

  • Thanks Alan,

    I ran my application on beagle board using JTAG, but the same problem occurred ):

    Reda

  • What gel file are you using? What is the state of the ARM?

  • This is the gel files which I use:

    And I follow the following steps to run my application:

    1- Click on the ARM processor and choose "Connect target"

    2- scripts --> IVA2200_Startup --> IVA22_GEM_startup 

    3- Click on DSP and choose Connect target 

    4- load  the program then resume 

  • Reda,

    Hmmm.

    I ran an unmodified task example built for the evm3530 on my beagleboard yesterday while trying to reproduce your results. That's how I discovered that the same application doesn't run on the C64+ simulator.

    I followed the same emulation procedure as you: Connect to the A8, run the gem startup gel function, connect to the dsp, download and run the application.

    When you created your target, what device did you select?

    Alan

  • Alan,

    If you mean the Target Configuration File, when I created it I choosed " Texas Instruments XDS100v2 USB Emulator "  in Connection box

    and "OMAP3530" in Device box.

    Reda 

  • The target configuration I use with my beagleboard has the "OMAP3430" selected in the device box. This pulls in a different set of GEL files.

    Can you try selecting the OMAP3430 device and see if it makes a difference?

    Alan

  • Alan,

    I tried by OMAP3430 in device box, but the same problem occurred. The first printf output appeared on the console but after Task_sleep the program blocked

    Did you use Task_sleep in your code  and it ran correctly , or you used the task example without Task_sleep???

    my problem with Task_sleep.

  • I'm building the Task example that includes mutex.c as the main source file.

    Both tasks invoke Task_sleep(10) successfully.

    After the example exits, I use ROV to verify the the Clock module tick count has increased.

    Alan

  • Hmmmmm,

    What about my problem??

    I use single task as shown above and I used your device but the same problem occurred.

    Do you have any suggestions to solve this problem??

    Reda

  • Please post either your entire CCS project or just the .out file and I'll try to run it on my beagleboard.

    If it runs, then its probably an emulation/GEL file issue in your setup.

    If not, its probably some kind of build issue.

    Alan

  • Alan,

    please find my entire CCS project in the following link:

    http://www.mediafire.com/?o1jvb77joo6uqi4

    Reda

  • Reda,

    Sadly, TI's internet host filtering mechanism is blocking me from accessing www.mediafire.com.

    If you use File->Export to export the project as a General->Archive File and post it to this forum I can download it.

    Alan

  • Alan,

    I am so sorry, I did not know about this rule.

    Please find it here:

    my Project

    Reda

  • It ran fine on my beagleboard. Here is the output:

     Running task1 function
     Finishing task1 function

    At this point I suspect GEL file issues in your setup.

    I suggest that you upgrade to the latest CCS 5.3 to obtain the latest everything:

        http://processors.wiki.ti.com/index.php/Download_CCS

    If your beagleboard normally boots into linux, try this:

      After you connect to the A8 and before you release the DSP from reset, try issuing a System Reset to the board thru the Run->Reset menu.

      Hit 'Pause' immediately after issuing the System Reset. This will halt the normal Linux climbup sequence.

      Then proceed as usual and see if you get better results.

    Which version of beagleboard do you have? Mine is a rev B4.

    Alan