搜索
bottom↓
回复: 7

ucosii高手请进,紧急求助

[复制链接]

出0入0汤圆

发表于 2009-9-26 20:55:24 | 显示全部楼层 |阅读模式
!E C:/icc/include/os_cpu.h(27): redeclaration of `BOOLEAN'
!E C:/icc/include/os_cpu.h(28): redeclaration of `INT8U'
!E C:/icc/include/os_cpu.h(28): redeclaration of `INT8U'
!E C:/icc/include/os_cpu.h(30): redeclaration of `INT16U'
!E C:/icc/include/os_cpu.h(31): redeclaration of `INT16S'
!E C:/icc/include/os_cpu.h(32): redeclaration of `INT32U'
!E C:/icc/include/os_cpu.h(33): redeclaration of `INT32S'
!E C:/icc/include/os_cpu.h(34): redeclaration of `FP32'
!E C:/icc/include/os_cpu.h(36): redeclaration of `OS_STK'
!E C:/icc/include/os_cpu.h(37): redeclaration of `OS_CPU_SR'
C:\icc\bin\imakew.exe: Error code 1
Done: there are error(s). Exit code: 1


我编译的时候编译器报这样的错误,我不知道怎么回事。哪位能不能指点一下啊 。觉得很奇怪。谢谢,使用的是ICCAVR的编译器,用的是从本网站上下载的实例代码ucosii_m128_iccavr。谢谢。

阿莫论坛20周年了!感谢大家的支持与爱护!!

一只鸟敢站在脆弱的枝条上歇脚,它依仗的不是枝条不会断,而是自己有翅膀,会飞。

出0入0汤圆

发表于 2009-9-26 21:00:07 | 显示全部楼层
OS_CPU.h  你的数据类型重定义了

出0入0汤圆

 楼主| 发表于 2009-9-26 21:04:26 | 显示全部楼层
谢谢楼上的Zwill 的回复
您说的重定义是什么意思啊
整个源文件是这样的  OS_CPU.H   您能不能帮我看看啊  谢谢
/*
*********************************************************************************************************
*                                               uC/OS-II
*                                         The Real-Time Kernel
*
*                                       ATmega128 Specific code
*
* File     : OS_CPU.H
* By       : Ole Saether
*            Jean J. Labrosse
*********************************************************************************************************
*/

#ifdef  OS_CPU_GLOBALS
#define OS_CPU_EXT
#else
#define OS_CPU_EXT  extern
#endif

/*
**********************************************************************************************************
*                                              DATA TYPES
*                                         (Compiler Specific)
**********************************************************************************************************
*/

typedef unsigned char  BOOLEAN;
typedef unsigned char  INT8U;                    /* Unsigned  8 bit quantity                            */
typedef signed   char  INT8S;                    /* Signed    8 bit quantity                            */
typedef unsigned int   INT16U;                   /* Unsigned 16 bit quantity                            */
typedef signed   int   INT16S;                   /* Signed   16 bit quantity                            */
typedef unsigned long  INT32U;                   /* Unsigned 32 bit quantity                            */
typedef signed   long  INT32S;                   /* Signed   32 bit quantity                            */
typedef float          FP32;                     /* Single precision floating point                     */

typedef unsigned char  OS_STK;                   /* Each stack entry is 8-bit wide                      */
typedef unsigned char  OS_CPU_SR;                /* Define size of CPU status register (PSW = 8 bits)   */

/*
*********************************************************************************************************
*                                             Atmel AVR
*
* Method #1:  Disable/Enable interrupts using simple instructions.  After critical section, interrupts
*             will be enabled even if they were disabled before entering the critical section.
*
* Method #2:  Disable/Enable interrupts by preserving the state of interrupts. In other words, if
*             interrupts were disabled before entering the critical section, they will be disabled when
*             leaving the critical section. The IAR compiler does not support inline assembly so I'm
*             using the _OPC() intrinsic function. Here are the instructions:
*
*             OS_ENTER_CRITICAL:
*                 ST      -Y,R16
*                 IN      R16,SREG
*                 CLI
*                 PUSH    R16
*                 LD      R16,Y+
*
*             OS_EXIT_CRITICAL:
*                 ST      -Y,R16
*                 POP     R16
*                 OUT     SREG,R16
*                 LD      R16,Y+
*
* Method #3:  Disable/Enable interrupts by preserving the state of interrupts.  Generally speaking you
*             would store the state of the interrupt disable flag in the local variable 'cpu_sr' and then
*             disable interrupts.  'cpu_sr' is allocated in all of uC/OS-II's functions that need to
*             disable interrupts.  You would restore the interrupt disable state by copying back 'cpu_sr'
*             into the CPU's status register.
*********************************************************************************************************
*/

#define  OS_CRITICAL_METHOD    3


#if      OS_CRITICAL_METHOD == 3
#define  OS_ENTER_CRITICAL()  (cpu_sr = OS_CPU_SR_Save()) /* Disable interrupts                        */
#define  OS_EXIT_CRITICAL()   (OS_CPU_SR_Restore(cpu_sr)) /* Enable  interrupts                        */
#endif

/*
**********************************************************************************************************
*                                          AVR Miscellaneous
**********************************************************************************************************
*/

#define  OS_STK_GROWTH      1                       /* Stack grows from HIGH to LOW memory on AVR       */

#define  OS_TASK_SW()       OSCtxSw()

/*
**********************************************************************************************************
*                                          GLOBAL VARIABLES
**********************************************************************************************************
*/

OS_CPU_EXT  INT16U  OSTaskStkSize;                  /* Used to set the total stack size of a task       */
OS_CPU_EXT  INT16U  OSTaskHardStkSize;              /* Used to set the hardware stack size of a task    */

/*
**********************************************************************************************************
*                                         Function Prototypes
**********************************************************************************************************
*/

#if OS_CRITICAL_METHOD == 3
OS_CPU_SR  OS_CPU_SR_Save(void);
void       OS_CPU_SR_Restore(OS_CPU_SR cpu_sr);
#endif

void       OSTickISR_Init(void);
void       OSTickISR_Handler(void);

出0入0汤圆

发表于 2009-9-27 00:11:34 | 显示全部楼层
你看看有没有其他地方定义过那几个数据类型,估计是某个头文件定义过数据类型了,AVR的没做过,我的是ARM7的板

出0入0汤圆

发表于 2009-9-27 08:32:40 | 显示全部楼层
估计头文件重复包含造成的。LZ可能把所有的.C文件加到工程里了,我记得好像只要加一个ucos.C就行了,这个文件把所有的.C文件都包含进去了。

出0入0汤圆

 楼主| 发表于 2009-9-27 19:45:01 | 显示全部楼层
谢谢两位的回复
我自己检查了一下,重复定义应该是没有,应该是头文件重复包含了
可ucos-ii这么多头文件,要怎么来组织呢,我是新手,以前做的项目都没几个文件,现在用rtos,文件这么多,我有点头晕。呵呵。
ucos-ii整个文件是什么样的结构,包括.C和.H,能不能讲解一下。谢谢。

出0入0汤圆

发表于 2009-10-13 00:40:20 | 显示全部楼层
ucos-ii很多代码
但头文件只有一个就是ucos_ii.h
每个内核源文件都有include ucos_ii.h
既有变量定义又有变量声明
其中的奥妙就在下面的这段条件编译
#ifdef  OS_CPU_GLOBALS
#define OS_CPU_EXT
#else
#define OS_CPU_EXT  extern
#endif

出0入0汤圆

发表于 2009-11-14 08:16:29 | 显示全部楼层
帅哥,你说得太好了
回帖提示: 反政府言论将被立即封锁ID 在按“提交”前,请自问一下:我这样表达会给举报吗,会给自己惹麻烦吗? 另外:尽量不要使用Mark、顶等没有意义的回复。不得大量使用大字体和彩色字。【本论坛不允许直接上传手机拍摄图片,浪费大家下载带宽和论坛服务器空间,请压缩后(图片小于1兆)才上传。压缩方法可以在微信里面发给自己(不要勾选“原图),然后下载,就能得到压缩后的图片】。另外,手机版只能上传图片,要上传附件需要切换到电脑版(不需要使用电脑,手机上切换到电脑版就行,页面底部)。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|Archiver|amobbs.com 阿莫电子技术论坛 ( 粤ICP备2022115958号, 版权所有:东莞阿莫电子贸易商行 创办于2004年 (公安交互式论坛备案:44190002001997 ) )

GMT+8, 2024-5-20 18:57

© Since 2004 www.amobbs.com, 原www.ourdev.cn, 原www.ouravr.com

快速回复 返回顶部 返回列表