1.Ucos2

1.1 ucos2

image.png
image.png
本文主要来讲ucos2

1.2 ucos3

image.png

2.启动程序

app.c

  1. int main(void)
  2. {
  3. CPU_INT08U os_err; //ucos2类型
  4. //BSP_IntDisAll(); /* Disable all ints until we are ready to accept them. */
  5. CPU_IntDis(); //CPU中断禁止
  6. OSInit(); //操作系统初始化 /* Initialize "uC/OS-II, The Real-Time Kernel". */
  7. BSP_Init(); //BSP初始化 /* Initialize BSP functions. */
  8. App_DispScr_SignOn();
  9. printf("OS Init OK!\r\n");
  10. os_err = OSTaskCreate((void (*) (void *)) App_TaskStart,
  11. /* Create the start task. */
  12. (void *) 0,
  13. (OS_STK *) &App_TaskStartStk[APP_TASK_START_STK_SIZE - 1],
  14. (INT8U) APP_TASK_START_PRIO);
  15. printf("Creat App_TaskStart!\r\n");
  16. #if (OS_TASK_NAME_SIZE >= 11)
  17. OSTaskNameSet(APP_TASK_START_PRIO, (CPU_INT08U *) "Start Task", &os_err);
  18. #endif
  19. // InfoSem = OSSemCreate(0);
  20. // Disp_Box = OSMboxCreate((void *) 0);
  21. OSTimeSet(0);
  22. OSStart(); /* Start multitasking (i.e. give control to uC/OS-II). */
  23. return (0);