当前位置:网站首页>UCOSII (learning notes)

UCOSII (learning notes)

2022-06-23 09:12:00 July meteor

ucosii Embedded system

    characteristic : Suitable for small control systems , High efficiency of execution , Small footprint , Excellent real-time performance and strong scalability .

1. Declaration of the task stack :

    ucos-ii Create a separate task stack for each task , And the task stack needs to be declared by the user , The data type is OS_STK, Stack structure is generally implemented by array .

        #define TASK_STK_SIZE 512

        OS_STK TaskStk[N_TASKS][TASK_STK_SIZE];    // Stack Size

2. Declaration of random semaphores :

    Before building a semaphore , You need to declare a OS_EVENT* Type pointer , Used to store only event control blocks ECB The address of .

    OS_EVENT   *RandomSem;

3. Task and function prototype declaration :

    Declare the task function , It doesn't mean that a task is a function , Just borrow the form of function .

   (1) Mission statement :

        void Task(void *data);              // Create task array

        void TaskStart(void *data);     // Task start

    (2) Function declaration :

        static void TaskStartCreateTasks(void);         // Set up tasks

        static void  TaskStartDispInit(void);                // Task initialization

4.main function

    complete ucos-ii System initialization ,DOS Environmental preservation , Interrupt vector setting , Appoint ucos-ii Task switching processing function in , Resume of first task and start multi task system .

 

 

原网站

版权声明
本文为[July meteor]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/174/202206230858452913.html