STM32F3 Probleme mit Libraries

OP #4722893
Lesenswert?
• ▲
▼
Hi,

Ich habe einen STM32F3 Discovery und benütze Keil uVision5. Weiter habe 
ich nun die Standard Peripheral Library heruntergeladen und die 
benötigen Libraries eingebunden. Nun kann ich endlich GPIO_InitTypeDef 
etc. verwenden, doch es gibt noch einen Konflikt: Wenn ich #include 
"stm32f3xx.h" verwende, dann bekomme ich die Fehlermeldung unten, ohne 
lässt es sich durch auskommentieren einiger Funktionen compilieren. Ich 
sehe nicht ganz, warum da eine Überdefinition stattfindet?

Programm:
1
/**
2
  ******************************************************************************
3
  * @file    main.c 
4
  * @author  MCD Application Team
5
  * @version V1.2.2
6
  * @date    14-August-2015
7
  * @brief   Main program body
8
  ******************************************************************************/
9

10

11
/* Includes ------------------------------------------------------------------*/
12
#include "stm32f3xx.h"                   // Device header
13
#include "../inc/stm32f30x_gpio.h"
14
#include "../inc/stm32f30x_rcc.h"
15
#include "cmsis_os.h"                   // ARM::CMSIS:RTOS:Keil RTX ->ADD Threads
16

17

18
void Blinky (void const *argument) {
19
   while(1){
20
     GPIOE->BSRRL = (1<<9);    //LED on -> BSRRL is Bit Set Reset Register -> write 1 -> high
21
     osDelay(250);              //250ms Delay
22
     GPIOE->BSRRH = (1<<9);    //LED off
23
     osDelay(250);
24
   }
25
 }
26

27
osThreadDef(Blinky,osPriorityNormal,1,0);  //Define Thread on function Blinky
28
  
29
int main(void)
30
{
31
  osKernelInitialize ();                    // initialize CMSIS-RTOS
32
  //Enable clock for GPOIG
33
  RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOE, ENABLE);
34

35
  //Initialize struct
36
  GPIO_InitTypeDef GPIO_InitDef;
37
   
38
  //Pin9
39
  GPIO_InitDef.GPIO_Pin = GPIO_Pin_9;
40
  //Mode output
41
  GPIO_InitDef.GPIO_Mode = GPIO_Mode_OUT;
42
  //Output type push-pull
43
  GPIO_InitDef.GPIO_OType = GPIO_OType_PP;
44
  //Without pull resistors
45
  GPIO_InitDef.GPIO_PuPd = GPIO_PuPd_NOPULL;
46
  //50MHz pin speed
47
  GPIO_InitDef.GPIO_Speed = GPIO_Speed_50MHz;
48
   
49
  //Initialize pins on GPIOG port
50
  GPIO_Init(GPIOG, &GPIO_InitDef);
51

52
  // create 'thread' functions that start executing,
53
  // example: tid_name = osThreadCreate (osThread(name), NULL);
54
  osThreadCreate(osThread (Blinky),NULL);
55
  osKernelStart ();                         // start thread execution 
56
}

Fehlermeldung:
1
*** Using Compiler 'V5.06 update 3 (build 300)', folder: 'C:\Keil_v5\ARM\ARMCC\Bin'
2
Rebuild target 'STM32F3-Discovery'
3
compiling main.c...
4
STM32F0-Discovery_skeleton\project_files\../inc/../sys/stm32f30x.h(183): error:  #101: "NonMaskableInt_IRQn" has already been declared in the current scope
5
    NonMaskableInt_IRQn         = -14,    /*!< 2 Non Maskable Interrupt                                          */
6
STM32F0-Discovery_skeleton\project_files\../inc/../sys/stm32f30x.h(184): error:  #101: "MemoryManagement_IRQn" has already been declared in the current scope
7
    MemoryManagement_IRQn       = -12,    /*!< 4 Cortex-M4 Memory Management Interrupt                           */
8
STM32F0-Discovery_skeleton\project_files\../inc/../sys/stm32f30x.h(185): error:  #101: "BusFault_IRQn" has already been declared in the current scope
9
    BusFault_IRQn               = -11,    /*!< 5 Cortex-M4 Bus Fault Interrupt                                   */
10
STM32F0-Discovery_skeleton\project_files\../inc/../sys/stm32f30x.h(186): error:  #101: "UsageFault_IRQn" has already been declared in the current scope
11
    UsageFault_IRQn             = -10,    /*!< 6 Cortex-M4 Usage Fault Interrupt                                 */
12
STM32F0-Discovery_skeleton\project_files\../inc/../sys/stm32f30x.h(187): error:  #101: "SVCall_IRQn" has already been declared in the current scope
13
    SVCall_IRQn                 = -5,     /*!< 11 Cortex-M4 SV Call Interrupt                                    */
14
STM32F0-Discovery_skeleton\project_files\../inc/../sys/stm32f30x.h(188): error:  #101: "DebugMonitor_IRQn" has already been declared in the current scope
15
    DebugMonitor_IRQn           = -4,     /*!< 12 Cortex-M4 Debug Monitor Interrupt                              */
16
STM32F0-Discovery_skeleton\project_files\../inc/../sys/stm32f30x.h(189): error:  #101: "PendSV_IRQn" has already been declared in the current scope
17
    PendSV_IRQn                 = -2,     /*!< 14 Cortex-M4 Pend SV Interrupt                                    */
18
STM32F0-Discovery_skeleton\project_files\../inc/../sys/stm32f30x.h(190): error:  #101: "SysTick_IRQn" has already been declared in the current scope
19
    SysTick_IRQn                = -1,     /*!< 15 Cortex-M4 System Tick Interrupt                                */
20
STM32F0-Discovery_skeleton\project_files\../inc/../sys/stm32f30x.h(193): error:  #101: "WWDG_IRQn" has already been declared in the current scope
21
    WWDG_IRQn                   = 0,      /*!< Window WatchDog Interrupt                                         */
22
STM32F0-Discovery_skeleton\project_files\../inc/../sys/stm32f30x.h(194): error:  #101: "PVD_IRQn" has already been declared in the current scope
23
    PVD_IRQn                    = 1,      /*!< PVD through EXTI Line detection Interrupt                         */
24
STM32F0-Discovery_skeleton\project_files\../inc/../sys/stm32f30x.h(196): error:  #101: "RTC_WKUP_IRQn" has already been declared in the current scope
25
    RTC_WKUP_IRQn               = 3,      /*!< RTC Wakeup interrupt through the EXTI lines 17, 19 & 20           */
26
STM32F0-Discovery_skeleton\project_files\../inc/../sys/stm32f30x.h(197): error:  #101: "FLASH_IRQn" has already been declared in the current scope
27
    FLASH_IRQn                  = 4,      /*!< FLASH global Interrupt                                            */
28
STM32F0-Discovery_skeleton\project_files\../inc/../sys/stm32f30x.h(198): error:  #101: "RCC_IRQn" has already been declared in the current scope
29
    RCC_IRQn                    = 5,      /*!< RCC global Interrupt                                              */
30
STM32F0-Discovery_skeleton\project_files\../inc/../sys/stm32f30x.h(199): error:  #101: "EXTI0_IRQn" has already been declared in the current scope
31
    EXTI0_IRQn                  = 6,      /*!< EXTI Line0 Interrupt                                              */
32
STM32F0-Discovery_skeleton\project_files\../inc/../sys/stm32f30x.h(200): error:  #101: "EXTI1_IRQn" has already been declared in the current scope
33
    EXTI1_IRQn                  = 7,      /*!< EXTI Line1 Interrupt                                              */
34
STM32F0-Discovery_skeleton\project_files\../inc/../sys/stm32f30x.h(202): error:  #101: "EXTI3_IRQn" has already been declared in the current scope
35
    EXTI3_IRQn                  = 9,      /*!< EXTI Line3 Interrupt                                              */
36
STM32F0-Discovery_skeleton\project_files\../inc/../sys/stm32f30x.h(203): error:  #101: "EXTI4_IRQn" has already been declared in the current scope
37
    EXTI4_IRQn                  = 10,     /*!< EXTI Line4 Interrupt                                              */
38
STM32F0-Discovery_skeleton\project_files\../inc/../sys/stm32f30x.h(204): error:  #101: "DMA1_Channel1_IRQn" has already been declared in the current scope
39
    DMA1_Channel1_IRQn          = 11,     /*!< DMA1 Channel 1 Interrupt                                          */
40
STM32F0-Discovery_skeleton\project_files\../inc/../sys/stm32f30x.h(205): error:  #101: "DMA1_Channel2_IRQn" has already been declared in the current scope
41
    DMA1_Channel2_IRQn          = 12,     /*!< DMA1 Channel 2 Interrupt                                          */
42
STM32F0-Discovery_skeleton\project_files\../inc/../sys/stm32f30x.h(206): error:  #101: "DMA1_Channel3_IRQn" has already been declared in the current scope
43
    DMA1_Channel3_IRQn          = 13,     /*!< DMA1 Channel 3 Interrupt                                          */
44
STM32F0-Discovery_skeleton\project_files\../inc/../sys/stm32f30x.h(207): error:  #101: "DMA1_Channel4_IRQn" has already been declared in the current scope
45
    DMA1_Channel4_IRQn          = 14,     /*!< DMA1 Channel 4 Interrupt                                          */
46
STM32F0-Discovery_skeleton\project_files\../inc/../sys/stm32f30x.h(208): error:  #101: "DMA1_Channel5_IRQn" has already been declared in the current scope
47
    DMA1_Channel5_IRQn          = 15,     /*!< DMA1 Channel 5 Interrupt                                          */
48
STM32F0-Discovery_skeleton\project_files\../inc/../sys/stm32f30x.h(209): error:  #101: "DMA1_Channel6_IRQn" has already been declared in the current scope
49
    DMA1_Channel6_IRQn          = 16,     /*!< DMA1 Channel 6 Interrupt                                          */
50
STM32F0-Discovery_skeleton\project_files\../inc/../sys/stm32f30x.h(210): error:  #101: "DMA1_Channel7_IRQn" has already been declared in the current scope
51
    DMA1_Channel7_IRQn          = 17,     /*!< DMA1 Channel 7 Interrupt                                          */
52
STM32F0-Discovery_skeleton\project_files\../inc/../sys/stm32f30x.h(211): error:  #101: "ADC1_2_IRQn" has already been declared in the current scope
53
    ADC1_2_IRQn                 = 18,     /*!< ADC1 & ADC2 Interrupts                                            */
54
STM32F0-Discovery_skeleton\project_files\../inc/../sys/stm32f30x.h(216): error:  #101: "EXTI9_5_IRQn" has already been declared in the current scope
55
    EXTI9_5_IRQn                = 23,     /*!< External Line[9:5] Interrupts                                     */
56
STM32F0-Discovery_skeleton\project_files\../inc/../sys/stm32f30x.h(217): error:  #101: "TIM1_BRK_TIM15_IRQn" has already been declared in the current scope
57
    TIM1_BRK_TIM15_IRQn         = 24,     /*!< TIM1 Break and TIM15 Interrupts                                   */
58
STM32F0-Discovery_skeleton\project_files\../inc/../sys/stm32f30x.h(218): error:  #101: "TIM1_UP_TIM16_IRQn" has already been declared in the current scope
59
    TIM1_UP_TIM16_IRQn          = 25,     /*!< TIM1 Update and TIM16 Interrupts                                  */
60
STM32F0-Discovery_skeleton\project_files\../inc/../sys/stm32f30x.h(219): error:  #101: "TIM1_TRG_COM_TIM17_IRQn" has already been declared in the current scope
61
    TIM1_TRG_COM_TIM17_IRQn     = 26,     /*!< TIM1 Trigger and Commutation and TIM17 Interrupt                  */
62
STM32F0-Discovery_skeleton\project_files\../inc/../sys/stm32f30x.h(220): error:  #101: "TIM1_CC_IRQn" has already been declared in the current scope
63
    TIM1_CC_IRQn                = 27,     /*!< TIM1 Capture Compare Interrupt                                    */
64
STM32F0-Discovery_skeleton\project_files\main.c: 0 warnings, 30 errors
65
compiling stm32f30x_gpio.c...
66
compiling RTX_Conf_CM.c...
67
compiling stm32f30x_rcc.c...
68
assembling startup_stm32f303xc.s...
69
compiling stm32f30x_usart.c...
70
compiling system_stm32f3xx.c...
71
".\Objects\Basic_Setup.axf" - 30 Error(s), 0 Warning(s).
72
Target not created.
73
Build Time Elapsed:  00:00:02

Antwort schreiben

Bitte melde dich an, um einen Beitrag zu schreiben.

oder

Mit Google-Account einloggen

Die Registrierung ist kostenlos und dauert nur eine Minute.

Jetzt registrieren