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.

Craeting and using Task

Expert 1005 points
Other Parts Discussed in Thread: CCSTUDIO

Hello,

 I am new in DSP/BIOS and I want to learn how to create and use a task in DSP/BIOS. I am using 620sim target (a simulator). I wrote a simple hello world and it works well. Now I want to add a new task to it. I use visual configure to add a task to project ( with the name of Task).

My code is as follow:

#include <std.h>
#include <log.h>


extern LOG_Obj trace;
void main()
{
 LOG_printf(&trace,"Program started\n");
}

 

Void Task(Arg id_arg)
{

 LOG_printf(&trace,"In Task\n");
 TSK_disable();
 IDL_run();
 TSK_enable();
}

When I compile the code, I am getting the following warning:

[Linking...] "C:\ProgramFiles\CCStudio_v3.3\C6000\cgtools\bin\cl6x" -@"Debug.lkf"
<Linking>
>> C:\\ProgramFiles\\CCStudio_v3.3\\MyProjects\\TestTask\\TestTaskcfg.cmd, line 96: warning:
               symbol _Task from file
               C:\\ProgramFiles\\CCStudio_v3.3\\MyProjects\\TestTask\\Debug\\main.obj being redefined

and when I am running this code, the output is as follow:

0 Program started

 

This means that Task never called. What is the problem and how can I solve it?

I have another question: Is there any web page that has all the documents related to dsp/bios and their name and title, so I can go there and select the appropriate one for reading?

Regards

 

 

 

  • There are two things you need to change with the code snippet you posted. First, you need to make sure you include the BIOS-generated configuration header file. Second, you need to point the task object to the task function you create in your source file. For example, if you created a function named myTask() then the Task object would point to _myTask inside the .tcf file. 

    mans said:
    #include "bios_file_namecfg.h"

    Void myTask(Arg id_arg)
    {

     LOG_printf(&trace,"In Task\n");
     TSK_disable();
     IDL_run();
     TSK_enable();
    }



    *edit* I've tweaked my post a bit.

     

  • Thanks.

    Now my main.c is as follow:

     

     

     

    #include <std.h>
    #include <log.h>
    #include "TestTaskcfg.h"

    void main()
    {
     LOG_printf(&trace,"Program started\n");
    }

    Void Task1(Arg id_arg)
    {

      LOG_printf(&trace,"In Task1\n");
      TSK_disable();
      IDL_run();
      TSK_enable();

    }

    and my *.tcf  is as follow:

    /* The following DSP/BIOS Features are enabled.  */
    bios.enableMemoryHeaps(prog);
    bios.enableRealTimeAnalysis(prog);
    bios.enableRtdx(prog);
    bios.enableTskManager(prog);

    bios.MEM.instance("SDRAM0").createHeap = 1;
    bios.MEM.BIOSOBJSEG = prog.get("SDRAM0");
    bios.MEM.MALLOCSEG = prog.get("SDRAM0");
    bios.LOG.create("trace");
    bios.TSK.create("Task1");
    bios.TSK.instance("Task1").order = 1;
    bios.TSK.instance("Task1").allocateTaskName = 1;
    bios.TSK.instance("Task1").fxn = prog.extern("Task1");

     

    bios.TSK.instance("TSK_idle").order = 1;

     

    // !GRAPHICAL_CONFIG_TOOL_SCRIPT_INSERT_POINT!

    prog.gen();

     

    And I am getting this error:

     
    [main.c] "C:\ProgramFiles\CCStudio_v3.3\C6000\cgtools\bin\cl6x" -g -fr"C:/ProgramFiles/CCStudio_v3.3/MyProjects/TestTask/Debug" -d"_DEBUG" -@"Debug.lkf" "main.c"
    "main.c", line 19: error: declaration is incompatible with "TSK_Obj Task1" (declared at line 23 of "TestTaskcfg.h")
    1 error detected in the compilation of "main.c".

    Could you please help me?

    Best regards

  • I found the problem! The name of function and the name of task are the same. I renamed the task function (in main.c source code to Task_1 and it is working now.

     

  • Hi mans,

    I'm glad you found it! Right on target! The task name and the name of the function the Task calls can not be the same...

     

  • Thank you and Tim help.

    I have another question but I think I should open another topic as it is not about creating and using task but on task scheduling.