RTX OS在NANO130中的实现

来源:互联网 发布:linux数据库备份命令 编辑:程序博客网 时间:2024/05/21 22:22

RTX OS在NANO130中的实现

用MDK建立RTX的OS系统,本文主要介绍如何建立最小工程,在使用时,再添加任务即刻。附原码

/****************************************************************************** * @file     system_Nano100Series.c * @version  V1.00 * $Revision: 4 $ * $Date: 14/01/29 4:09p $ * @brief    Nano100 series system clock init code and assert handler * * @note * Copyright (C) 2017 CK.HUANG.*****************************************************************************/#include "Nano100Series.h"#include "uart0Common.h"//#include "cmsis_os.h"                   // ARM::CMSIS:RTOS:Keil RTX5#include "cmsis_os2.h"                  // ARM::CMSIS:RTOS2:Keil RTX5#include"stdio.h"extern void SYS_Init(void);uint16_t  temp;  void task1() {     while(1)     {         UART_Write(UART0,"This is task1 runing!\n", 23);         temp++;          osDelay(1000);                            /* delay  800ms                   */     } }   void task2() {     while(1)     {         UART_Write(UART0,"This is task2 runing!\n", 23);         temp++;          osDelay(800);                            /* delay  800ms                   */     } }int main(void){    SYS_Init();    uart0Init();    osKernelInitialize();    osThreadNew(task1, NULL, NULL);    osThreadNew(task2, NULL, NULL);     osKernelStart();                    // Start thread execution    while(1);}

在使用keil时,按平时的工程先好芯片,再用PACK添加RTX,如下图:
这里写图片描述
这里写图片描述
注意事项:不要在设置中,选用RTX Kemel
这里写图片描述

通过以上几步,就可以建立有RTX的操作系统了,是不是很简单,不用任何的配置,就实现了OS。上手是快,但遗憾的是介绍的资料太少了。
完整的代码:http://download.csdn.net/download/shuishou47/9961158

原创粉丝点击