I want to make new Tasks in a Task.

I want to make new Tasks in a Task.

Home Forums Real-Time Kernels I want to make new Tasks in a Task.

This topic contains 3 replies, has 4 voices, and was last updated by  Farukh Chaudhry 11 months, 4 weeks ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #25709

    GeunHa You
    Participant

    Hi, I’m using TMS320F28335 and CCSv6, uC/OS-II

    I counted a problem.

    I want to create App_TaskPong in App_TaskPing. Not in App_TaskStart.

    So instead I deleted OSTaskCreateExt(App_TaskPong) in App_TaskStart, inserted OSTaskCreateExt(App_TaskPong) in App_TaskPing. And to see results, I used printf function.

    But just 123 123 123 were written on console and the emulator was suspended. (No source available for “0x3ff6bd”

    Priority of Ping is 3u, it of Pong is 4u.

    If I exchange each priority, just 123 was written on console and the emulator was suspended with “Can’t find a source file at “/tmp/scratch/build_jenkins/workspace/BuildToolsLinux/build/ank/product/linux/lib-internal/src/cpy_tbl.c” and “No source available for “0x1f2000″” messages.

    All code is below.

    /*
    *********************************************************************************************************
    *                                           APPLICATION CODE
    *
    *                                             Delfino 28335
    *                                                on the
    *                                             TMDSDOCK28335
    *                                            Experimenter Kit
    *
    * Filename      : app.c
    * Version       : V1.00
    *********************************************************************************************************
    */
    
    /*
    *********************************************************************************************************
    *                                             INCLUDE FILES
    *********************************************************************************************************
    */
    
    #include  <app_cfg.h>
    
    #include  <ucos_ii.h>
    #include  <cpu_core.h>
    #include  <lib_def.h>
    
    #include  <bsp.h>
    
    #include <stdio.h>
    
                                                                    /* Start Task's stack.                                  */
    CPU_STK_SIZE  App_TaskStartStk[APP_CFG_TASK_STK_SIZE];
                                                                    /* Ping Task's stack.                                   */
    CPU_STK_SIZE  App_TaskPendStk[APP_CFG_TASK_STK_SIZE];
                                                                    /* Pong Task's stack.                                   */
    CPU_STK_SIZE  App_TaskPostStk[APP_CFG_TASK_STK_SIZE];
    
    static  OS_EVENT    *AppTaskObjSem;
    
                                                                    /* Start Task.*/
    static  void  App_TaskStart(void  *p_arg);
                                                                    /* Ping Task. */
    static  void  App_TaskPing (void  *p_arg);
                                                                    /* Pong Task. */
    static  void  App_TaskPong (void  *p_arg);
    
    int  main (void)
    {
        CPU_Init();
        BSP_Init();
        OSInit();
    
        OSTaskCreateExt(App_TaskStart,
                        (void    *)0,
                        (CPU_STK *)&App_TaskStartStk[0],
                        (INT8U    )APP_CFG_TASK_START_PRIO,
                        (INT16U   )APP_CFG_TASK_START_PRIO,
                        (CPU_STK *)&App_TaskStartStk[APP_CFG_TASK_STK_SIZE - 1u],
                        (INT32U   )APP_CFG_TASK_STK_SIZE,
                        (void    *)0,
                        (INT16U   )(OS_TASK_OPT_STK_CHK | OS_TASK_OPT_STK_CLR));
    
        OSStart();
    
    	while (DEF_TRUE) {
    		;
    	}
    }
    
    static  void  App_TaskStart (void *p_arg)
    {
        CPU_INT08U  os_err;
       (void)&p_arg;
    
        BSP_LED_Off(BSP_LED_ALL);
        BSP_Tick_Init();
    
        AppTaskObjSem = OSSemCreate(0);
    
        OSTaskCreateExt(App_TaskPing,
                        (void    *)0,
                        (CPU_STK *)&App_TaskPendStk[0],
                        (INT8U    )APP_CFG_TASK_PEND_PRIO,
                        (INT16U   )APP_CFG_TASK_PEND_PRIO,
                        (CPU_STK *)&App_TaskPendStk[APP_CFG_TASK_STK_SIZE - 1u],
                        (INT32U   )APP_CFG_TASK_STK_SIZE,
                        (void    *)0,
                        (INT16U   )(OS_TASK_OPT_STK_CHK | OS_TASK_OPT_STK_CLR));
    /*
        OSTaskCreateExt(App_TaskPong,
                        (void    *)0,
                        (CPU_STK *)&App_TaskPostStk[0],
                        (INT8U    )APP_CFG_TASK_POST_PRIO,
                        (INT16U   )APP_CFG_TASK_POST_PRIO,
                        (CPU_STK *)&App_TaskPostStk[APP_CFG_TASK_STK_SIZE - 1u],
                        (INT32U   )APP_CFG_TASK_STK_SIZE,
                        (void    *)0,
                        (INT16U   )(OS_TASK_OPT_STK_CHK | OS_TASK_OPT_STK_CLR));*/
                                                                    /* All tasks should be written as an infinite loop.     */
        while (DEF_TRUE) {
            os_err = OSSemPost(AppTaskObjSem);
            OSTimeDlyHMSM(0, 0, 0, 1);
        }
    }
    
    static  void  App_TaskPing (void *p_arg)
    {
        CPU_INT08U  os_err;
       (void)&p_arg;
    
        while (DEF_TRUE) {
            OSSemPend( AppTaskObjSem,
                       0,
                      &os_err);
            OSTaskCreateExt(App_TaskPong,
                            (void    *)0,
                            (CPU_STK *)&App_TaskPostStk[0],
                            (INT8U    )APP_CFG_TASK_POST_PRIO,
                            (INT16U   )APP_CFG_TASK_POST_PRIO,
                            (CPU_STK *)&App_TaskPostStk[APP_CFG_TASK_STK_SIZE - 1u],
                            (INT32U   )APP_CFG_TASK_STK_SIZE,
                            (void    *)0,
                            (INT16U   )(OS_TASK_OPT_STK_CHK | OS_TASK_OPT_STK_CLR));
        }
    }
    
    static  void  App_TaskPong (void *p_arg)
    {
       (void)&p_arg;
    
        while (DEF_TRUE) {
        	printf("123\n");
            OSTimeDlyHMSM(0, 0, 0, 300);
            BSP_LED_Toggle(BSP_LED_LD3);
        }
    }
    
    

    Thank you.

    #25729

    Andy Lin
    Participant

    Hi, may I ask a question.
    Have this forum been abandoned? Why nearly nobody discussing/answering post?
    uC/OS-III is one of largest operating system all over the world, such situation is not in my expectation.

    #25733

    Michael Dean
    Keymaster

    Hi,

    Please refer to the answer given in this post.

    Loops don't work.

    Thanks.

    #25739

    Farukh Chaudhry
    Participant

    Hello,

    I am responding to Andy’s question. It will be helpful in having more participants responding to questions to get feedback on issues.

    In response to the original post, creating tasks from a task is generally straight forward. Just make sure you follow the parameters and have enough stack for the new task. When a task’s stack overflows, your program may reach a RTOS error state.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.

View the complete site map

x
Loading...