结构中类型冲突的编译器错误

时间:2020-02-13 17:53:05

标签: compiler-errors

我正在为自己想学习的微控制器(stm32f4)编写自己的驱动程序。我的代码一切正常,直到我将驱动程序头添加到main.c中,编译器都没有错误

错误: enter image description here

错误所在的代码:

    typedef struct
{
    __vo uint32_t MODER;                    //GPIO port mode register offset: 0x00
    __vo uint32_t OTYPER;               //GPIO port output type register offset : 0x04
    __vo uint32_t OSPEEDR;              //GPIO port output speed register offset: 0x08
    __vo uint32_t PUPDR;                    //GPIO port pull-up/pull-down register offset: 0x0C
    __vo uint32_t IDR;                  //GPIO port input data register offset: 0x10
    __vo uint32_t ODR;                  //GPIO port output data register offset: 0x14
    __vo uint32_t BSRR;                 //GPIO port bit set/reset register offset: 0x18
    __vo uint32_t LCKR;                 //GPIO port configuration lock register offset: 0x1C
    __vo uint32_t AFR[2];               //GPIO alternate function low/high register offset: AF[0] low register 0x20 AF[1] high register 0x24

}GPIO_RegDef_t;

//GPIO_RegDef_t *pGPIOA = (GPIO_RegDef_t*)0x40020000U;


/***************************************************************************************
**************Reset and Clock Control RCC Register Definition Structure*****************
***************************************************************************************/

typedef struct
{
    __vo uint32_t CR;               //clock control register offset : 0x00
    __vo uint32_t PLLCFGR;          //PLL configuration register offset: 0x04
    __vo uint32_t CFGR;             //clock configuration register  offset: 0x08
    __vo uint32_t CIR;              //clock interrupt register offset: 0x0C
    __vo uint32_t AHB1RSTR;         // AHB1 peripheral reset register offset: 0x10
    __vo uint32_t AHB2RSTR;         //AHB2 peripheral reset register offset: 0x14
    __vo uint32_t RESERVED0[2];
    __vo uint32_t APB1RSTR;         //APB1 peripheral reset register offset: 0x20
    __vo uint32_t APB2RSTR;         //APB2 peripheral reset register offset: 0x24
    __vo uint32_t RESERVED1[2];
    __vo uint32_t AHB1ENR;          //AHB1 peripheral clock enable register offset: 0x30
    __vo uint32_t AHB2ENR;          //AHB2 peripheral clock enable register offset: 0x34
    __vo uint32_t RESERVED2[2];
    __vo uint32_t APB1ENR;          //APB1 peripheral clock enable register offset: 0x40
    __vo uint32_t APB2ENR;          //APB2 peripheral clock enable register offset: 0x44
    __vo uint32_t RESERVED3[2];
    __vo uint32_t AHB1LPENR;        //AHB1 peripheral clock enable in low power mode register offset: 0x50
    __vo uint32_t AHB2LPENR;        //AHB2 peripheral clock enable in low power mode register offset: 0x54
    __vo uint32_t RESERVED4[2];
    __vo uint32_t APB1LPENR;        //APB1 peripheral clock enable in low power mode register offset: 0x60
    __vo uint32_t APB2LPENR;        //APB2 peripheral clock enable in low power mode register offset: 0x64
    __vo uint32_t RESERVED5[2];
    __vo uint32_t BDCR;             //Backup domain control register offset: 0x70
    __vo uint32_t CSR;              //clock control & status register offset: 0x74
    __vo uint32_t RESERVED6[2];
    __vo uint32_t SSCGR;            //spread spectrum clock generation register offset: 0x80
    __vo uint32_t PLLI2SCFGR;       //PLLI2S configuration register offset: 0x84
    __vo uint32_t RESERVED7;
    __vo uint32_t DCKCFGR;          //Dedicated Clocks Configuration Register offset: 0x8C

}RCC_RegDef_t;

如果我理解正确,那么错误就是告诉我要么用错误的数据类型的成员声明结构,要么稍后再重新定义结构。对我来说,奇怪的是编译器说先前的声明在同一位置吗?

任何帮助或发现错误的提示都将非常有用,因为在解决此问题之前我无能为力。我应该寻找什么来帮助确定有问题的代码? 谢谢

0 个答案:

没有答案