1.将ucos_ii的源代码解压到c盘根目录下形成SOFTWARE文件夹(使用网上盛传的压缩文件SOFTWARE.RAR)
2.将bc45安装在c盘根目录下,形成bc45文件夹,从别的地方复制tasm.exe,编译asm文件用
3.建立一个工作文件夹比如叫c:\work\ucos,然后将解压目录C:\SOFTWARE\uCOS-II\SOURCE下的所有文件复制至该文件夹,有文件如下(不同版本文件可能不一样):
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,uCOS_II.C,uCOS_II.H
解压目录下的C:\SOFTWARE\uCOS-II\EX1_x86L\BC45\WORK\里的.h,.c,.asm文件拷贝到该文件夹,有文件如下:
INCLUDES.H,OS_CFG.H,OS_CPU.H,PC.H,UCOS_II.H
OS_CPU_C.C,PC.C,TEST.C,UCOS_II.C
OS_CPU_A.ASM
提示有文件重复,直接替换即可
4.修改c:\work\ucos下include.h:
//#i nclude "\SOFTWARE\ucos-ii\ix86l\os_cpu.h"
//#i nclude "os_cfg.h"
//#i nclude "\SOFTWARE\blocks\pc\source\pc.h"
//#i nclude "\SOFTWARE\ucos-ii\source\ucos_ii.h"
#i nclude "os_cpu.h"
#i nclude "os_cfg.h"
#i nclude "pc.h"
#i nclude "ucos_ii.h"
去掉前面的路径,引用当前路径下的文件(本例中指路径c:\work\ucos)
修改c:\work\ucos下UCOS_II.C:
#i nclude "\software\ucos-ii\source\os_core.c"
#i nclude "\software\ucos-ii\source\os_flag.c"
#i nclude "\software\ucos-ii\source\os_mbox.c"
#i nclude "\software\ucos-ii\source\os_mem.c"
#i nclude "\software\ucos-ii\source\os_mutex.c"
#i nclude "\s·oftware\ucos-ii\source\os_q.c"
#i nclude "\software\ucos-ii\source\os_sem.c"
#i nclude "\software\ucos-ii\source\os_task.c"
#i nclude "\software\ucos-ii\source\os_time.c"
将\software\ucos-ii\source\统统去掉,都引用当前路径下的文件(本例中指路径c:\work\ucos)
5.在bc45环境下建立工程文件ide,选择dos模式
因为.h文件都在c:\work\ucos文件夹下,需要设置一下include的路径(在bc45中选择菜单,options\project\Directories\,在窗口右边找到Include,增加路径,结果如下:c:\bc45\include;c:\work\ucos)
6.在工程文件中添加c:\work\ucos下的几个文件:
os_cpu_a.asm
os_cpu_c.c
pc.c
ucos_ii.c
test.c
7.编译运行,会出现很多警告,但可以生成exe文件