mikrocontroller.net

Forum: Mikrocontroller und Digitale Elektronik STM32F3 Probleme mit Libraries


Autor: Bert Siegfried (kautschuck)
Datum:

Bewertung
0 lesenswert
nicht 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:
/**
  ******************************************************************************
  * @file    main.c 
  * @author  MCD Application Team
  * @version V1.2.2
  * @date    14-August-2015
  * @brief   Main program body
  ******************************************************************************/


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


void Blinky (void const *argument) {
   while(1){
     GPIOE->BSRRL = (1<<9);    //LED on -> BSRRL is Bit Set Reset Register -> write 1 -> high
     osDelay(250);              //250ms Delay
     GPIOE->BSRRH = (1<<9);    //LED off
     osDelay(250);
   }
 }

osThreadDef(Blinky,osPriorityNormal,1,0);  //Define Thread on function Blinky
  
int main(void)
{
  osKernelInitialize ();                    // initialize CMSIS-RTOS
  //Enable clock for GPOIG
  RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOE, ENABLE);

  //Initialize struct
  GPIO_InitTypeDef GPIO_InitDef;
   
  //Pin9
  GPIO_InitDef.GPIO_Pin = GPIO_Pin_9;
  //Mode output
  GPIO_InitDef.GPIO_Mode = GPIO_Mode_OUT;
  //Output type push-pull
  GPIO_InitDef.GPIO_OType = GPIO_OType_PP;
  //Without pull resistors
  GPIO_InitDef.GPIO_PuPd = GPIO_PuPd_NOPULL;
  //50MHz pin speed
  GPIO_InitDef.GPIO_Speed = GPIO_Speed_50MHz;
   
  //Initialize pins on GPIOG port
  GPIO_Init(GPIOG, &GPIO_InitDef);

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




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

Autor: Nop (Gast)
Datum:

Bewertung
0 lesenswert
nicht lesenswert
im C-File:
#include "stm32f3xx.h"

in der Fehlermeldung:
stm32f30x.h

Das ist ein anderes Headerfile, was die Definitionen offenbar nochmal 
enthält.

Antwort schreiben

Die Angabe einer E-Mail-Adresse ist freiwillig. Wenn Sie automatisch per E-Mail über Antworten auf Ihren Beitrag informiert werden möchten, melden Sie sich bitte an.

Wichtige Regeln - erst lesen, dann posten!

  • Groß- und Kleinschreibung verwenden
  • Längeren Sourcecode nicht im Text einfügen, sondern als Dateianhang

Formatierung (mehr Informationen...)

  • [c]C-Code[/c]
  • [avrasm]AVR-Assembler-Code[/avrasm]
  • [code]Code in anderen Sprachen, ASCII-Zeichnungen[/code]
  • [math]Formel in LaTeX-Syntax[/math]
  • [[Titel]] - Link zu Artikel
  • Verweis auf anderen Beitrag einfügen: Rechtsklick auf Beitragstitel,
    "Adresse kopieren", und in den Text einfügen




Bild automatisch verkleinern, falls nötig
Bitte das JPG-Format nur für Fotos und Scans verwenden!
Zeichnungen und Screenshots im PNG- oder
GIF-Format hochladen. Siehe Bildformate.
Hinweis: der ursprüngliche Beitrag ist mehr als 6 Monate alt.
Bitte hier nur auf die ursprüngliche Frage antworten,
für neue Fragen einen neuen Beitrag erstellen.

Mit dem Abschicken bestätigst du, die Nutzungsbedingungen anzuerkennen.