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.

Plain task is not called in BIOS/SYS 6.33.6.50

Other Parts Discussed in Thread: SYSBIOS

Hi,

I am new to BIOS/SYS 6. The example: "SYS/BIOS/Typical" for C6678 EVM board has a dynamic created task. The generated .c code is:

........

/*

*  ======== taskFxn ========

*/

Void taskFxn(UArg a0, UArg a1)

{

    System_printf("enter taskFxn()\n");

    Task_sleep(10);

    System_printf("exit taskFxn()\n");

}

/*

*  ======== main ========

*/

Void main()

{

    Task_Handle task;

    Error_Block eb;

    System_printf("enter main()\n");

    Error_init(&eb);

    task = Task_create(taskFxn, NULL, &eb);

if (task == NULL) {

        System_printf("Task_create() failed!\n");

        BIOS_exit(0);

    }

    BIOS_start();    

/* enable interrupts and start SYS/BIOS */

}

...............

Ths task generates "enter task" and "exit task" once.

Now I want to add an idle task by inserting:

................

void cIdle(void);

void cIdle(void)

{

return;

}

...............

I find that the cidle does run by setting breakpoint at the last "}", but taskFxn still runs one time.

I suppose that task taskFxn has high priority than idle, it will run continuously by back to idle, run taskFxn, back to idle etc... I know that this task has no blocked, ready, run flags and branches. I think it still runs at a higher priority than idle(). What is wrong in the experiment?

Thanks

  • Hi Robert,

    When a task is created dynamically using taskFxn() function, this function is called and run only once. Once the task falls through to the bottom of the taskFxn() function it exits and is not going to run again unless you create a new task using the same function. The idle task function is different in that it gets called repeatedly if the OS has no pending tasks to run.

    Best,

    Ashish

  • Thanks.

    The example creates the task in the main function. I do not see usefulness to use dynamic task in that way. What is the normal way to creat task dynamically? A task, a SWI can creat a dynamic task, and delete it after execution? What is the advantage and difference of a dynamic task and a direct function call?

  • Robert W said:

    A task, a SWI can creat a dynamic task, and delete it after execution?

    A new task can be dynamically created withing another task thread but not from a Swi thread. You can have a look at the Calling Context section of the Task module API documentation for more details:

    http://software-dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/bios/sysbios/6_34_04_22/exports/bios_6_34_04_22/docs/cdoc/index.html

    Robert W said:

     What is the advantage and difference of a dynamic task and a direct function call?

    Having tasks is advantageous over making direct function calls as it enables Multitasking. You could have a main() function with an infinite loop that repeatedly calls your functions in a particular order but then if any one of the functions block, your system stalls waiting for it and the throughput goes down. On the contrary with an operating system, if a task is blocked, then some other ready task can start running.

    Best,

    Ashish