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.

How do we use task construction for multi-task?

I initialed  multi task like below, but GWtaskFxn does not operate, how can i use dual tasks on CC26xx EVK?

what is wrong? please help me.

 

Void main()

{  

Task_Params taskParams,taskParams1;

 

  // Configure task.  

Task_Params_init(&taskParams);  

taskParams.stack = myTaskStack;  

taskParams.stackSize = MSA_TASK_STACK_SIZE;

  taskParams.priority = 1;  

Task_construct(&myTask, taskFxn, &taskParams, NULL); 

 

  // Configure task.  

Task_Params_init(&taskParams1);  

taskParams1.stack = myGWTaskStack;  

taskParams1.stackSize = MSA_TASK_STACK_SIZE;  

taskParams1.priority = 2;  

Task_construct(&myGWTask, GWtaskFxn, &taskParams1, NULL);

 

  BIOS_start();     /* enable interrupts and start SYS/BIOS */

}

 

Void taskFxn(UArg a0, UArg a1) {  

  /* Initialize ICall module */

  ICall_init();

  /* Start tasks of external images */  

ICall_createRemoteTasks();  

  /* Kick off GW application */

  msa_task();    

}

Void GWtaskFxn(UArg a0, UArg a1) {  

  /* Initialize ICall module */

  ICall_init();

  /* Start tasks of external images */  

ICall_createRemoteTasks();  

  /* Kick off GW application */

  msa_GWtask();    

}

  • 1) When you say the GWtaskFxn "does not operate", does that mean you've set a breakpoint at GWtaskFxn and you never got there?
    2) Do you have any other tasks of higher priority than 2 defined in your application? If so, are they every blocking so that lower priority tasks can run?
    3) Can you share the .cfg file you're using for this application?

    Alan
  • Where and how are myTaskStack and myGWTaskStack defined? What is the value of "MSA_TASK_STACK_SIZE"?
    Which version of TI-RTOS are you using?
  • I am using like below..

    #define MSA_TASK_STACK_SIZE 704
    Task_Struct myTask;
    Char myTaskStack[MSA_TASK_STACK_SIZE];
    #if 1
    #define MSA_TASK_STACK_SIZE1 512//704
    Task_Struct myGWTask;
    Char myGWTaskStack[MSA_TASK_STACK_SIZE1];

    verision is 'tirtos_simplelink_2_11_01_09'.

    And, there is not other task to have more high priority.

  • Perhaps it's a typo but it looks to me like you used the wrong stack size macro for the gwTask.

    I mean, you used MSA_TASK_STACK_SIZE1 to define the stack array, but you used MSA_TASK_STACK_SIZE as the stackSize in the task params you passed to the Task_construct() call for the myGwTask task.

    Alan

  • Thank you for your response.

    When i change the stack size to 704 both of them, i got the below buid error.

    Linking
    Error[Lp011]: section placement failed
              unable to allocate space for sections/blocks with a total estimated minimum size of 0x2457 bytes (max align 0x8) in <[0x200000c8-0x200027ff]> 
    (total uncommitted space 0x2434).
              Uncommitted:
                [0x200000c8-0x200027ff]: 0x2738
                [0x20000200-0x200027ff]: 0x23fc

    And then, when i change size 512 ,it doesn't occur.

    How can i change size to allocate space? where is configuration?

     

  • If you need more RAM for your task stacks, you might try reducing your heap size which is currently being set to 1924 bytes in your .cfg file:

          BIOS.heapSize = 1924;

    It is OK to set the stack size for the myGWTask task to 512 bytes.

    The problem in your code is in this line:

        taskParams1.stackSize = MSA_TASK_STACK_SIZE;   <---- Should be MSA_TASK_STACK_SIZE1

    Because you used the wrong stack size macro, you told Task_construct() that the size of the myGWTaskStack buffer is 704 bytes, but the myGWTaskStack array is really only 512 bytes. This will result in Task_construct() initializing memory outside the myGWTaskStack[] array, probably leading to a crash of the application.

    Alan