1826 views|1 replies

1140

Posts

0

Resources
The OP
 

How to port uCOS-II to LPC17XX [Copy link]

1. Knowledge preparation To have a deeper understanding of the UCOS-II porting, two aspects of knowledge are required: (1) Target chip. Here is the LPC17xx series chip. They are all based on the ARMv7 Cortex-M3 core. So the UCOS-II porting of this type of chip is almost the same. To understand the Cortex-M3 core, we recommend "ARM Cortex-M3 Authoritative Guide" (translated by Song Yan); (2) UCOS-II core principle. We recommend "Embedded Real-Time Operating System uC/OS-II (2nd Edition)" (translated by Shao Beibei). 2. Download files The ucos-ii porting process mainly involves three files: os_cpu.h, os_cpu_a.asm and os_cpu_c.c In fact, under normal circumstances, the target chip we want to port has already been successfully ported by our predecessors, and all we need to do is download it. You need to download two types of files: (1) LPC17xx chip startup/initialization code: LPC17xx.h, system_LPC17xx.h, core_cm3.h, core_cm3.c, startup_LPC17xx.s and system_LPC17xx.c. These files can be found in any project of LPC17xx series chips from the LPC official website; (2) UCOS-II porting code: The uCOS-II porting code on LPC17xx can be found on the Micrium official website (IAR platform). 3. Create a project (1) Create a folder UCOS_II_V289, and create sub-directories APP, lpc17xx, Output, uC-CPU, UCOS-II in this directory. Create obj and list sub-directories under Output, and then add the files downloaded in step 2 to the corresponding folders. The file topology is as follows: UCOS_II_V289 (1) Create a folder UCOS_II_V289, and create sub-directories APP, lpc17xx, Output, uC-CPU, UCOS-II in this directory. Create sub-directories obj and list under Output, and then add the files downloaded in step 2 to the corresponding folders. The file topology is as follows: UCOS_II_V289 (1) Create a folder UCOS_II_V289, and create sub-directories APP, lpc17xx, Output, uC-CPU, UCOS-II in this directory. Create sub-directories obj and list under Output, and then add the files downloaded in step 2 to the corresponding folders. The file topology is as follows: hello.c ├─lpc17xx │ core_cm3.c │ core_cm3.h │ LPC17xx.h │ startup_LPC17xx.s │ system_LPC17xx.c │ system_LPC17xx.h │ type.h[ /backcolor] ├─Output │ ├─list[/ backcolor] │ └─obj ├─uC-CPU │ os_cpu.h [color=#00000 0]│ os_cpu_a.asm
│      os_cpu_c.c
│      os_dbg.c

└─uCOS-II
        app_cfg.h
        os_cfg.h
        os_core.c
        os_flag.c
        os_mbox.c
        os_mem.c
        os_mutex.c
        os_q.c
        os_sem.c
        os_task.c
        os_time.c
        os_tmr.c
        ucos_ii.h
其中,hello.c中的文件代码如下:


#includec
        ucos_ii.h
其中,hello.c中的文件代码如下:


#includec
        ucos_ii.h
其中,hello.c中的文件代码如下:


#include
#include
#define TASK_STK_SIZE 512
OS_STK TaskStartStk[TASK_STK_SIZE];
void TaskStart(void *data);
int main(void)
{
    OSInit();
    OSTaskCreate(TaskStart, (void *)0, &TaskStartStk[TASK_STK_SIZE - 1], 0);
    OSStart();
    return 0;
}
void  TaskStart(void *data)
{
    data=data;
    OS_CPU_SysTickInit(SystemFrequency/100);
    for(;;)
    {
        OSCtxSwCtr = 0;
        OSTimeDlyHMSM(0,0,0,10);
    }
}


(2)Keil uVision4创建新工程,选择UCOS_II_V289作为工程目录,选择芯片型号,需要注意的是当提示“Copy NXP LPC17xx Startup Code to Project Folder and Add File to Project?”时,选择“否”,因为我们已经有这个文件了。创建组,添加相应文件到组.

This post is from Microcontroller MCU

Latest reply

It would be better if you could elaborate on the process, thanks for sharing!  Details Published on 2019-3-9 21:21
 

1368

Posts

6

Resources
2
 
It would be better if you could elaborate on the process, thanks for sharing!
This post is from Microcontroller MCU
 
Personal signature专注智能产品的研究与开发,专注于电子电路的生产与制造……QQ:2912615383,电子爱好者群: void
 

Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list