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 can I define the array for Task_hanlde

Other Parts Discussed in Thread: SYSBIOS, OMAPL138

Hello, all

In the sysbios porting, I  am facing a issue about define the array  which is used to store all the task handle in the runtime.

something like following

const  Task_Handle TskList[3] = { (Task_Handle)SPA ,   (Task_Handle)SYSX , (Task_Handle)TXPX  };

but there is the a error in the build process.error: #28 expression must have a constant value in my env:

CCS 5.3.00090

SYSBIOS: 6.34.02.18

CGT:7.4.1

----

In the DSP/BIOS, It is OK.

 

 

  • Hi WEI Alex,

    I did some quick experimenting. I was able to update the SYS/BIOS Task Mutex example project for OMAPL138 ARM9:

    Void main()
    {
        Task_Handle TskList[2];

        Task_Params taskParams;
            
        /* Create a Semaphore object to be use as a resource lock */
        sem = Semaphore_create(1, NULL, NULL);

        /* Create two tasks that share a resource*/
        Task_Params_init(&taskParams);
        taskParams.priority = 1;
        tsk1 = Task_create (task1, &taskParams, NULL);
        
        Task_Params_init(&taskParams);
        taskParams.priority = 2;
        tsk2 = Task_create (task2, &taskParams, NULL);

        TskList[0] = tsk1;
        TskList[1] = tsk2;

        BIOS_start();
    }

    Can you try that?

    ...

    I also made a DSP/BIOS 5.x project for OMAPL138 DSP and added the following code:

    TSK_Handle tsk1;
    TSK_Handle tsk2;

    TSK_Handle TskList[2] = {tsk1, tsk2};

    This resulted in the same compilation error that you reported for SYS/BIOS:

    "../tsk.c", line 27: error #28: expression must have a constant value
    "../tsk.c", line 27: error #28: expression must have a constant value

    I was able to create the array of task pointers like this:

    extern far TSK_Obj task0;
    extern far TSK_Obj task1;

    TSK_Handle TskList[] = {&task0, &task1};

    Steve