这几天在做uc/os_ii的移植,和触摸屏驱动开发,遇到不少问题,通过网上给的问题。
编译环境 :PC: CodeWarrior for ARM (ADS1.2) Source Insight 3.5,bc4.5、友善之臂mini2440,H-JTAG仿真小板
1. C2857E: #include file "/software/ucos-ii/source/……" wouldn't open uCOS_II.C
Error : (Serious) C2857E: #include file "/software/ucos-ii/source/os_core.c" wouldn't open uCOS_II.C line 20
Error : (Serious) C2857E: #include file "/software/ucos-ii/source/os_flag.c" wouldn't open uCOS_II.C line 21
Error : (Serious) C2857E: #include file "/software/ucos-ii/source/os_mbox.c" wouldn't open uCOS_II.C line 22
Error : (Serious) C2857E: #include file "/software/ucos-ii/source/os_mem.c" wouldn't open uCOS_II.C line 23
Error : (Serious) C2857E: #include file "/software/ucos-ii/source/os_mutex.c" wouldn't open uCOS_II.C line 24
Error : (Serious) C2857E: #include file "/software/ucos-ii/source/os_q.c" wouldn't open uCOS_II.C line 25
Error : (Serious) C2857E: #include file "/software/ucos-ii/source/os_sem.c" wouldn't open uCOS_II.C line 26
Error : (Serious) C2857E: #include file "/software/ucos-ii/source/os_task.c" wouldn't open uCOS_II.C line 27
这个在刚移植的时候一般回遇到的问题。一看提示,恩是路径的问题,好吧都改了将这些文件相应的路径都改了。
#include "C:/ucos2_2440_LCD/ucos2_244/ucos/kernele/os_core.c" #include "C:/ucos2_2440_LCD/ucos2_2440/ucos/kernel/os_flag.c" #include "C:/ucos2_2440_LCD/ucos2_2440/ucos/kernel/os_mbox.c" #include "C:/ucos2_2440_LCD/ucos2_2440/ucos/kernel/os_mem.c" #include "C:/ucos2_2440_LCD/ucos2_2440/ucos/kernel/os_mutex.c" #include "C:/ucos2_2440_LCD/ucos2_2440/ucos/kernel/os_q.c" #include "C:/ucos2_2440_LCD/ucos2_2440/ucos/kernel/os_sem.c" #include "C:/ucos2_2440_LCD/ucos2_2440/ucos/kernel/os_task.c" #include "C:/ucos2_2440_LCD/ucos2_2440/ucos/kernel/os_time.c"
可是,改完更多的错误出现了。参考了http://www.cevx.com/bbs/thread-22348-1-1.html,于是把ucos_ii.c给从工程中去掉了。
2. Error : C2456E: undeclared name, inventing 'extern int ISR_Uart0RxD' 2440lib.c line 37
出现重复定义了。果然在2440addr.h和2440lib.c中都定义了,把后者中的定义给屏蔽就行了。
3 声明缺乏存储类型。
Error : C2225W: declaration lacks type/storage-class (assuming 'int'): 'MsgQueue' Main.c line 77
Error : C2225W: declaration lacks type/storage-class (assuming 'int'): 'OS_EVENT' Main.c line 77
解决方法:
4.说明因为我自己没有告诉编译器该函数的具体位置,所以如果不进行一次全面编译,那么该引用处对应的汇编跳转语句将不变。
Warning : C2207W: inventing 'extern int OSStatInit();'Main.c line 141
Warning : C2207W: inventing 'extern int OSQCreate();'Main.c line 143
Warning : C2207W: inventing 'extern int OSQPend();' Main.c line 219
Warning : C2207W: inventing 'extern int uprintf();' Main.c line 220
参考:http://hi.baidu.com/cumtsun/blog/item/2b2aa40efc4d88e336d122df.html
解决:出现该警告的一般是因为所调用的函数或变量在定义在其他的文件中,在本文件中调用是要进行声明;或者是重复定义了变量或宏,根据ADS中C函数调用汇编函数的原则(主要工作有两个,一是在C 中声明函数原型,并加extern 关键字;二是在汇编中用EXPORT 导出函数名,并用该函数名作为汇编代码段的标识,最后用mov pc, lr 返回。然后,就可以在C 中使用该函数了。从C 的角度,并不知道该函数的实现是用C 还是汇编。更深的原因是因为C 的函数名起到表明函数代码起始地址的左右,这个和汇编的label 是一致的)
在OS_CORE.C的前面加上这么一条声明语句:extern int OSQPend()警告消除,编译通过。
Error : C2456E: undeclared name, inventing 'extern int OSTickISR' 2440lib.c line 83