Mikrocontroller und Digitale Elektronik
›
Thread
stm32 Problem
M
mark
Gast
14.07.2010 14:44
#1781557
Ich bin gerade dabei mich in die stm32 Welt einzuarbeiten,
mithilfe der von ST bereitgestellten API.
Leider scheitert es aber bereits beim simplen Versuch einen Port zu
konfigurieren.
Bei folgendem Code:
1 #include "stm32f10x.h"
2 #include "stm32f10x_gpio.h"
3
4 int main ( void )
5 {
6 while ( 1 )
7 {
8 GPIO_InitTypeDef test ;
9
10 test . GPIO_Speed = GPIO_Speed_10MHz ;
11 test . GPIO_Pin = GPIO_Pin_1 ;
12 test . GPIO_Mode = GPIO_Mode_Out_PP ;
13
14 GPIO_Init ( GPIOC , & test );
15 }
16 return ;
17 }
erhalte ich beim kompilieren die Meldung:
testing.axf: Error: L6218 E: Undefined symbol GPIO_Init (referred from
main.o).
Als IDE kommt Keil zum Einsatz.
Hallo Mark,
erstmal hast Du in der STM32F10x_CONF.h die benutzte Peripherie
freigegeben? (Defines)
Außerdem fehlt die Taktgeschichte.
Schau dir mal Beispielcode an und den Artikel hier im Forum über
die Standard-Lib von ST. Ist zwar erst im Entstehen, aber
deine ersten Fragen müssten abgedeckt werden.
Gut schwitz und Gruß Ruppi66
mark schrieb:
> testing.axf: Error: L6218 E: Undefined symbol GPIO_Init (referred from
> main.o).
stm32f10x_gpio.h muss mitkompiliert und -gelinkt werden. Darin ist diese
Funktion definiert.
M
Manfred
Gast
15.07.2010 18:55
#1783228
A. K. schrieb:
> stm32f10x_gpio.h muss mitkompiliert und -gelinkt werden.
Ist das nicht mit #include "stm32f10x_gpio.h" getan?
Sorry, cut-and-paste Fehler. Die .c war gemeint.
D
DerM
Gast
15.11.2014 16:51
#3884880
Habe dasselbe Problem mit einem STM32F0 Board, kann jemand helfen?
folgendes Programm:
#include "stm32f0xx.h" // Device header
#include "Board_LED.h" // ::Board Support:LED
#include "Board_Buttons.h" // ::Board Support:Buttons
#include "stm32f0xx_rcc.h"
#include "stm32f0xx_gpio.h"
int main(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOC, ENABLE);
GPIO_StructInit(&GPIO_InitStructure);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_Init(GPIOC, &GPIO_InitStructure);
GPIO_WriteBit(GPIOC, GPIO_Pin_9, Bit_SET);
while(1) {
}
}
folgender Fehler:
Rebuild target 'Target 1'
compiling main.c...
main.c(38): warning: #1-D: last line of file ends without a newline
}
main.c: 1 warning, 0 errors
compiling Buttons_STM32F0-Discovery.c...
compiling LED_STM32F0-Discovery.c...
assembling startup_stm32f051.s...
compiling system_stm32f0xx.c...
linking...
.\Objects\test.axf: Error: L6218 E: Undefined symbol GPIO_Init (referred
from main.o).
.\Objects\test.axf: Error: L6218 E: Undefined symbol GPIO_StructInit
(referred from main.o).
.\Objects\test.axf: Error: L6218 E: Undefined symbol GPIO_WriteBit
(referred from main.o).
.\Objects\test.axf: Error: L6218 E: Undefined symbol
RCC_AHBPeriphClockCmd (referred from main.o).
Not enough information to list image symbols.
Finished: 1 information, 0 warning and 4 error messages.
".\Objects\test.axf" - 4 Error(s), 1 Warning(s).
Target not created.
JM
Jim M.
(turboj)
15.11.2014 17:18
#3884914
DerM schrieb:
> Habe dasselbe Problem mit einem STM32F0 Board, kann jemand helfen?
Die Lösung steht direkt über Deinem Beitrag. Es fehlen die
entsprechenden .c Dateien der ST-Lib im Projekt.
D
DerM
Gast
15.11.2014 17:21
#3884919
Die sind jetzt drin, machts aber auch nicht besser:
Rebuild target 'Target 1'
compiling main.c...
main.c(38): warning: #1-D: last line of file ends without a newline
}
main.c: 1 warning, 0 errors
compiling stm32f0xx_gpio.c...
stm32f0xx_gpio.c(122): warning: #223-D: function "assert_param"
declared implicitly
assert_param(IS_GPIO_ALL_PERIPH(GPIOx));
stm32f0xx_gpio.c(174): warning: #223-D: function "assert_param"
declared implicitly
assert_param(IS_GPIO_ALL_PERIPH(GPIOx));
stm32f0xx_gpio.c(250): warning: #223-D: function "assert_param"
declared implicitly
assert_param(IS_GPIO_LIST_PERIPH(GPIOx));
stm32f0xx_gpio.c(299): warning: #223-D: function "assert_param"
declared implicitly
assert_param(IS_GPIO_ALL_PERIPH(GPIOx));
stm32f0xx_gpio.c(323): warning: #223-D: function "assert_param"
declared implicitly
assert_param(IS_GPIO_ALL_PERIPH(GPIOx));
stm32f0xx_gpio.c(345): warning: #223-D: function "assert_param"
declared implicitly
assert_param(IS_GPIO_ALL_PERIPH(GPIOx));
stm32f0xx_gpio.c(369): warning: #223-D: function "assert_param"
declared implicitly
assert_param(IS_GPIO_ALL_PERIPH(GPIOx));
stm32f0xx_gpio.c(389): warning: #223-D: function "assert_param"
declared implicitly
assert_param(IS_GPIO_ALL_PERIPH(GPIOx));
stm32f0xx_gpio.c(410): warning: #223-D: function "assert_param"
declared implicitly
assert_param(IS_GPIO_ALL_PERIPH(GPIOx));
stm32f0xx_gpio.c(435): warning: #223-D: function "assert_param"
declared implicitly
assert_param(IS_GPIO_ALL_PERIPH(GPIOx));
stm32f0xx_gpio.c(460): warning: #223-D: function "assert_param"
declared implicitly
assert_param(IS_GPIO_ALL_PERIPH(GPIOx));
stm32f0xx_gpio.c(516): warning: #223-D: function "assert_param"
declared implicitly
assert_param(IS_GPIO_ALL_PERIPH(GPIOx));
stm32f0xx_gpio.c: 12 warnings, 0 errors
compiling stm32f0xx_rcc.c...
stm32f0xx_rcc.c(204): warning: #223-D: function "assert_param" declared
implicitly
assert_param(IS_RCC_HSE(RCC_HSE));
stm32f0xx_rcc.c(266): warning: #223-D: function "assert_param" declared
implicitly
assert_param(IS_RCC_HSI_CALIBRATION_VALUE(HSICalibrationValue));
stm32f0xx_rcc.c(298): warning: #223-D: function "assert_param" declared
implicitly
assert_param(IS_FUNCTIONAL_STATE(NewState));
stm32f0xx_rcc.c(326): warning: #223-D: function "assert_param" declared
implicitly
assert_param(IS_RCC_HSI14_CALIBRATION_VALUE(HSI14CalibrationValue));
stm32f0xx_rcc.c(355): warning: #223-D: function "assert_param" declared
implicitly
assert_param(IS_FUNCTIONAL_STATE(NewState));
stm32f0xx_rcc.c(376): warning: #223-D: function "assert_param" declared
implicitly
assert_param(IS_FUNCTIONAL_STATE(NewState));
stm32f0xx_rcc.c(408): warning: #223-D: function "assert_param" declared
implicitly
assert_param(IS_RCC_LSE(RCC_LSE));
stm32f0xx_rcc.c(434): warning: #223-D: function "assert_param" declared
implicitly
assert_param(IS_RCC_LSE_DRIVE(RCC_LSEDrive));
stm32f0xx_rcc.c(458): warning: #223-D: function "assert_param" declared
implicitly
assert_param(IS_FUNCTIONAL_STATE(NewState));
stm32f0xx_rcc.c(491): warning: #223-D: function "assert_param" declared
implicitly
assert_param(IS_RCC_PLL_SOURCE(RCC_PLLSource));
stm32f0xx_rcc.c(515): warning: #223-D: function "assert_param" declared
implicitly
assert_param(IS_FUNCTIONAL_STATE(NewState));
stm32f0xx_rcc.c(541): warning: #223-D: function "assert_param" declared
implicitly
assert_param(IS_FUNCTIONAL_STATE(NewState));
stm32f0xx_rcc.c(565): warning: #223-D: function "assert_param" declared
implicitly
assert_param(IS_RCC_PREDIV1(RCC_PREDIV1_Div));
stm32f0xx_rcc.c(590): warning: #223-D: function "assert_param" declared
implicitly
assert_param(IS_FUNCTIONAL_STATE(NewState));
stm32f0xx_rcc.c(621): warning: #223-D: function "assert_param" declared
implicitly
assert_param(IS_RCC_MCO_SOURCE(RCC_MCOSource));
stm32f0xx_rcc.c(777): warning: #223-D: function "assert_param" declared
implicitly
assert_param(IS_RCC_SYSCLK_SOURCE(RCC_SYSCLKSource));
stm32f0xx_rcc.c(827): warning: #223-D: function "assert_param" declared
implicitly
assert_param(IS_RCC_HCLK(RCC_SYSCLK));
stm32f0xx_rcc.c(858): warning: #223-D: function "assert_param" declared
implicitly
assert_param(IS_RCC_PCLK(RCC_HCLK));
stm32f0xx_rcc.c(887): warning: #223-D: function "assert_param" declared
implicitly
assert_param(IS_RCC_ADCCLK(RCC_ADCCLK));
stm32f0xx_rcc.c(912): warning: #223-D: function "assert_param" declared
implicitly
assert_param(IS_RCC_CECCLK(RCC_CECCLK));
stm32f0xx_rcc.c(932): warning: #223-D: function "assert_param" declared
implicitly
assert_param(IS_RCC_I2CCLK(RCC_I2CCLK));
stm32f0xx_rcc.c(964): warning: #223-D: function "assert_param" declared
implicitly
assert_param(IS_RCC_USARTCLK(RCC_USARTCLK));
stm32f0xx_rcc.c(1003): warning: #223-D: function "assert_param"
declared implicitly
assert_param(IS_RCC_USBCLK(RCC_USBCLK));
stm32f0xx_rcc.c(1288): warning: #223-D: function "assert_param"
declared implicitly
assert_param(IS_RCC_RTCCLK_SOURCE(RCC_RTCCLKSource));
stm32f0xx_rcc.c(1305): warning: #223-D: function "assert_param"
declared implicitly
assert_param(IS_FUNCTIONAL_STATE(NewState));
stm32f0xx_rcc.c(1328): warning: #223-D: function "assert_param"
declared implicitly
assert_param(IS_FUNCTIONAL_STATE(NewState));
stm32f0xx_rcc.c(1366): warning: #223-D: function "assert_param"
declared implicitly
assert_param(IS_RCC_AHB_PERIPH(RCC_AHBPeriph));
stm32f0xx_rcc.c(1405): warning: #223-D: function "assert_param"
declared implicitly
assert_param(IS_RCC_APB2_PERIPH(RCC_APB2Periph));
stm32f0xx_rcc.c(1451): warning: #223-D: function "assert_param"
declared implicitly
assert_param(IS_RCC_APB1_PERIPH(RCC_APB1Periph));
stm32f0xx_rcc.c(1482): warning: #223-D: function "assert_param"
declared implicitly
assert_param(IS_RCC_AHB_RST_PERIPH(RCC_AHBPeriph));
stm32f0xx_rcc.c(1518): warning: #223-D: function "assert_param"
declared implicitly
assert_param(IS_RCC_APB2_PERIPH(RCC_APB2Periph));
stm32f0xx_rcc.c(1561): warning: #223-D: function "assert_param"
declared implicitly
assert_param(IS_RCC_APB1_PERIPH(RCC_APB1Periph));
stm32f0xx_rcc.c(1613): warning: #223-D: function "assert_param"
declared implicitly
assert_param(IS_RCC_IT(RCC_IT));
stm32f0xx_rcc.c(1656): warning: #223-D: function "assert_param"
declared implicitly
assert_param(IS_RCC_FLAG(RCC_FLAG));
stm32f0xx_rcc.c(1726): warning: #223-D: function "assert_param"
declared implicitly
assert_param(IS_RCC_GET_IT(RCC_IT));
stm32f0xx_rcc.c(1758): warning: #223-D: function "assert_param"
declared implicitly
assert_param(IS_RCC_CLEAR_IT(RCC_IT));
stm32f0xx_rcc.c: 36 warnings, 0 errors
compiling Buttons_STM32F0-Discovery.c...
compiling LED_STM32F0-Discovery.c...
assembling startup_stm32f051.s...
compiling system_stm32f0xx.c...
linking...
.\Objects\test.axf: Error: L6218 E: Undefined symbol assert_param
(referred from stm32f0xx_gpio.o).
Not enough information to list image symbols.
Finished: 1 information, 0 warning and 1 error messages.
".\Objects\test.axf" - 1 Error(s), 49 Warning(s).
Target not created.
D
DerM
Gast
15.11.2014 18:28
#3885011
Im Anhang ist der Programmaufbau zu sehen. Trotzdem kommen Tonnenweise
Warnings und Errors.
Rebuild target 'Target 1'
compiling main.c...
main.c(19): warning: #1-D: last line of file ends without a newline
}
main.c: 1 warning, 0 errors
compiling stm32f0xx_gpio.c...
src\stm32f0xx_gpio.c(122): warning: #223-D: function "assert_param"
declared implicitly
assert_param(IS_GPIO_ALL_PERIPH(GPIOx));
src\stm32f0xx_gpio.c(174): warning: #223-D: function "assert_param"
declared implicitly
assert_param(IS_GPIO_ALL_PERIPH(GPIOx));
src\stm32f0xx_gpio.c(250): warning: #223-D: function "assert_param"
declared implicitly
assert_param(IS_GPIO_LIST_PERIPH(GPIOx));
src\stm32f0xx_gpio.c(299): warning: #223-D: function "assert_param"
declared implicitly
assert_param(IS_GPIO_ALL_PERIPH(GPIOx));
src\stm32f0xx_gpio.c(323): warning: #223-D: function "assert_param"
declared implicitly
assert_param(IS_GPIO_ALL_PERIPH(GPIOx));
src\stm32f0xx_gpio.c(345): warning: #223-D: function "assert_param"
declared implicitly
assert_param(IS_GPIO_ALL_PERIPH(GPIOx));
src\stm32f0xx_gpio.c(369): warning: #223-D: function "assert_param"
declared implicitly
assert_param(IS_GPIO_ALL_PERIPH(GPIOx));
src\stm32f0xx_gpio.c(389): warning: #223-D: function "assert_param"
declared implicitly
assert_param(IS_GPIO_ALL_PERIPH(GPIOx));
src\stm32f0xx_gpio.c(410): warning: #223-D: function "assert_param"
declared implicitly
assert_param(IS_GPIO_ALL_PERIPH(GPIOx));
src\stm32f0xx_gpio.c(435): warning: #223-D: function "assert_param"
declared implicitly
assert_param(IS_GPIO_ALL_PERIPH(GPIOx));
src\stm32f0xx_gpio.c(460): warning: #223-D: function "assert_param"
declared implicitly
assert_param(IS_GPIO_ALL_PERIPH(GPIOx));
src\stm32f0xx_gpio.c(516): warning: #223-D: function "assert_param"
declared implicitly
assert_param(IS_GPIO_ALL_PERIPH(GPIOx));
src\stm32f0xx_gpio.c: 12 warnings, 0 errors
compiling stm32f0xx_rcc.c...
src\stm32f0xx_rcc.c(204): warning: #223-D: function "assert_param"
declared implicitly
assert_param(IS_RCC_HSE(RCC_HSE));
src\stm32f0xx_rcc.c(266): warning: #223-D: function "assert_param"
declared implicitly
assert_param(IS_RCC_HSI_CALIBRATION_VALUE(HSICalibrationValue));
src\stm32f0xx_rcc.c(298): warning: #223-D: function "assert_param"
declared implicitly
assert_param(IS_FUNCTIONAL_STATE(NewState));
src\stm32f0xx_rcc.c(326): warning: #223-D: function "assert_param"
declared implicitly
assert_param(IS_RCC_HSI14_CALIBRATION_VALUE(HSI14CalibrationValue));
src\stm32f0xx_rcc.c(355): warning: #223-D: function "assert_param"
declared implicitly
assert_param(IS_FUNCTIONAL_STATE(NewState));
src\stm32f0xx_rcc.c(376): warning: #223-D: function "assert_param"
declared implicitly
assert_param(IS_FUNCTIONAL_STATE(NewState));
src\stm32f0xx_rcc.c(408): warning: #223-D: function "assert_param"
declared implicitly
assert_param(IS_RCC_LSE(RCC_LSE));
src\stm32f0xx_rcc.c(434): warning: #223-D: function "assert_param"
declared implicitly
assert_param(IS_RCC_LSE_DRIVE(RCC_LSEDrive));
src\stm32f0xx_rcc.c(458): warning: #223-D: function "assert_param"
declared implicitly
assert_param(IS_FUNCTIONAL_STATE(NewState));
src\stm32f0xx_rcc.c(491): warning: #223-D: function "assert_param"
declared implicitly
assert_param(IS_RCC_PLL_SOURCE(RCC_PLLSource));
src\stm32f0xx_rcc.c(515): warning: #223-D: function "assert_param"
declared implicitly
assert_param(IS_FUNCTIONAL_STATE(NewState));
src\stm32f0xx_rcc.c(541): warning: #223-D: function "assert_param"
declared implicitly
assert_param(IS_FUNCTIONAL_STATE(NewState));
src\stm32f0xx_rcc.c(565): warning: #223-D: function "assert_param"
declared implicitly
assert_param(IS_RCC_PREDIV1(RCC_PREDIV1_Div));
src\stm32f0xx_rcc.c(590): warning: #223-D: function "assert_param"
declared implicitly
assert_param(IS_FUNCTIONAL_STATE(NewState));
src\stm32f0xx_rcc.c(621): warning: #223-D: function "assert_param"
declared implicitly
assert_param(IS_RCC_MCO_SOURCE(RCC_MCOSource));
src\stm32f0xx_rcc.c(777): warning: #223-D: function "assert_param"
declared implicitly
assert_param(IS_RCC_SYSCLK_SOURCE(RCC_SYSCLKSource));
src\stm32f0xx_rcc.c(827): warning: #223-D: function "assert_param"
declared implicitly
assert_param(IS_RCC_HCLK(RCC_SYSCLK));
src\stm32f0xx_rcc.c(858): warning: #223-D: function "assert_param"
declared implicitly
assert_param(IS_RCC_PCLK(RCC_HCLK));
src\stm32f0xx_rcc.c(887): warning: #223-D: function "assert_param"
declared implicitly
assert_param(IS_RCC_ADCCLK(RCC_ADCCLK));
src\stm32f0xx_rcc.c(912): warning: #223-D: function "assert_param"
declared implicitly
assert_param(IS_RCC_CECCLK(RCC_CECCLK));
src\stm32f0xx_rcc.c(932): warning: #223-D: function "assert_param"
declared implicitly
assert_param(IS_RCC_I2CCLK(RCC_I2CCLK));
src\stm32f0xx_rcc.c(964): warning: #223-D: function "assert_param"
declared implicitly
assert_param(IS_RCC_USARTCLK(RCC_USARTCLK));
src\stm32f0xx_rcc.c(1003): warning: #223-D: function "assert_param"
declared implicitly
assert_param(IS_RCC_USBCLK(RCC_USBCLK));
src\stm32f0xx_rcc.c(1288): warning: #223-D: function "assert_param"
declared implicitly
assert_param(IS_RCC_RTCCLK_SOURCE(RCC_RTCCLKSource));
src\stm32f0xx_rcc.c(1305): warning: #223-D: function "assert_param"
declared implicitly
assert_param(IS_FUNCTIONAL_STATE(NewState));
src\stm32f0xx_rcc.c(1328): warning: #223-D: function "assert_param"
declared implicitly
assert_param(IS_FUNCTIONAL_STATE(NewState));
src\stm32f0xx_rcc.c(1366): warning: #223-D: function "assert_param"
declared implicitly
assert_param(IS_RCC_AHB_PERIPH(RCC_AHBPeriph));
src\stm32f0xx_rcc.c(1405): warning: #223-D: function "assert_param"
declared implicitly
assert_param(IS_RCC_APB2_PERIPH(RCC_APB2Periph));
src\stm32f0xx_rcc.c(1451): warning: #223-D: function "assert_param"
declared implicitly
assert_param(IS_RCC_APB1_PERIPH(RCC_APB1Periph));
src\stm32f0xx_rcc.c(1482): warning: #223-D: function "assert_param"
declared implicitly
assert_param(IS_RCC_AHB_RST_PERIPH(RCC_AHBPeriph));
src\stm32f0xx_rcc.c(1518): warning: #223-D: function "assert_param"
declared implicitly
assert_param(IS_RCC_APB2_PERIPH(RCC_APB2Periph));
src\stm32f0xx_rcc.c(1561): warning: #223-D: function "assert_param"
declared implicitly
assert_param(IS_RCC_APB1_PERIPH(RCC_APB1Periph));
src\stm32f0xx_rcc.c(1613): warning: #223-D: function "assert_param"
declared implicitly
assert_param(IS_RCC_IT(RCC_IT));
src\stm32f0xx_rcc.c(1656): warning: #223-D: function "assert_param"
declared implicitly
assert_param(IS_RCC_FLAG(RCC_FLAG));
src\stm32f0xx_rcc.c(1726): warning: #223-D: function "assert_param"
declared implicitly
assert_param(IS_RCC_GET_IT(RCC_IT));
src\stm32f0xx_rcc.c(1758): warning: #223-D: function "assert_param"
declared implicitly
assert_param(IS_RCC_CLEAR_IT(RCC_IT));
src\stm32f0xx_rcc.c: 36 warnings, 0 errors
compiling Buttons_STM32F0-Discovery.c...
compiling LED_STM32F0-Discovery.c...
assembling startup_stm32f051.s...
compiling system_stm32f0xx.c...
linking...
.\Objects\test.axf: Error: L6218 E: Undefined symbol assert_param
(referred from stm32f0xx_gpio.o).
Not enough information to list image symbols.
Finished: 1 information, 0 warning and 1 error messages.
".\Objects\test.axf" - 1 Error(s), 49 Warning(s).
Target not created.
K
komisch
Gast
15.11.2014 18:35
#3885021
Stell einmal das vollständige uVision Projekt ein und gib den genauen
Typ vom STM32 an.
W
W.S.
Gast
15.11.2014 18:35
#3885022
mark schrieb:
> Ich bin gerade dabei mich in die stm32 Welt einzuarbeiten,
> mithilfe der von ST bereitgestellten API.
Ja, eben.
Probiere das doch erstmal schlicht und einfach zu Fuß, indem du selber
auf die Peripherie zugreifst und dort einstellst, was du denn eigentlich
so haben willst. Dann lernst du auch, wie die Peripherie so aussieht,
wie sie funktioniert und wie man damit umgeht. Hardware ist schließlich
kein Hexenwerk.
Mit dem Herumhampeln an der ST-Lib kriegst du die eigentlichen Lernziele
ja gar nicht mit.
W.S
D
DerM
Gast
15.11.2014 18:46
#3885032
Hier das komplette Teil als Anhang...
Bei dem Board handelt es sich um ein STM32F0Discovery-Board mit einem
STM32F051R8 -Chip darauf
H
holger
Gast
15.11.2014 19:07
#3885051
Mach einfach folgendes define bevor du die STM Header includierst:
#define assert_param(expr) ((void)0)
#include "stm32f10x.h"
#include "stm32f10x_gpio.h"
D
DerM
Gast
15.11.2014 19:12
#3885056
1 #include "stm32f0xx.h"
2 #include "stm32f0xx_gpio.h"
3 #include "stm32f0xx_rcc.h"
4
5 int main ( void )
6 {
7 GPIO_InitTypeDef GPIO_InitStructure ;
8
9 RCC_AHBPeriphClockCmd ( RCC_AHBPeriph_GPIOC , ENABLE );
10 GPIO_StructInit ( & GPIO_InitStructure );
11 GPIO_InitStructure . GPIO_Pin = GPIO_Pin_8 ;
12 GPIO_InitStructure . GPIO_Mode = GPIO_Mode_OUT ;
13 GPIO_InitStructure . GPIO_OType = GPIO_OType_PP ;
14 GPIO_InitStructure . GPIO_Speed = GPIO_Speed_50MHz ;
15 GPIO_InitStructure . GPIO_PuPd = GPIO_PuPd_NOPULL ;
16 GPIO_Init ( GPIOC , & GPIO_InitStructure );
17 GPIO_WriteBit ( GPIOC , GPIO_Pin_8 , Bit_SET );}
18
19 #ifdef USE_FULL_ASSERT
20 void assert_failed ( uint8_t * file , uint32_t line ){
21 /* Infinite loop */
22 /* Use GDB to find out why we're here */
23 while ( 1 );
24 }
25 #endif
Mit dem letzten part:
1 #ifdef USE_FULL_ASSERT
2 void assert_failed ( uint8_t * file , uint32_t line ){
3 /* Infinite loop */
4 /* Use GDB to find out why we're here */
5 while ( 1 );
6 }
7 #endif
läuft es, keine Ahnung wieso, hab das irgendwo im Netz ausgegraben. Kann
das vielleicht jemand kurz erläutern?
Danke schon einmal!
J
Jope
Gast
15.11.2014 20:02
#3885119
Wirf mal einen Blick in die Datei stm32f0xx_conf.h, vielleicht geht Dir
dann ein Licht auf.
D
DerM
Gast
15.11.2014 21:15
#3885227
dort steht 1 /* Exported types ------------------------------------------------------------*/
2 /* Exported constants --------------------------------------------------------*/
3 /* Uncomment the line below to expanse the "assert_param" macro in the
4 Standard Peripheral Library drivers code */
5 /* #define USE_FULL_ASSERT 1 */
6
7 /* Exported macro ------------------------------------------------------------*/
8 #ifdef USE_FULL_ASSERT
9
10 /**
11 * @brief The assert_param macro is used for function's parameters check.
12 * @param expr: If expr is false, it calls assert_failed function which reports
13 * the name of the source file and the source line number of the call
14 * that failed. If expr is true, it returns no value.
15 * @retval None
16 */
17 #define assert_param(expr) ((expr) ? (void)0 : assert_failed((uint8_t *)__FILE__, __LINE__))
18 /* Exported functions ------------------------------------------------------- */
19 void assert_failed ( uint8_t * file , uint32_t line );
20 #else
21 #define assert_param(expr) ((void)0)
22 #endif /* USE_FULL_ASSERT */
Wenn ich meinen Code mit dem letzten Abschnitt laufen lasse funktioniert
es.
Wenn ich aber in meinem Code den letzten Abschnitt auskommentiere und
dafür die stm32f0xx_conf.h includiere dann funktioniert es nicht obwohl
dort dasselbe steht! Warum ist das so?
J
Jope
Gast
15.11.2014 21:37
#3885254
In Deinem Projekt ist ganz offensichtlich USE_FULL_ASSERT definiert.
Dass führt dazu, dass durch das Makro assert_param die Funktion
assert_failed() aufgerufen wird. Diese Funktion ist in der Headerdatei
aber nur deklariert, nicht definiert, also muss sie irgendwo auch
definiert werden.
I
Ich
Gast
15.11.2014 21:47
#3885271
I
Ich
Gast
15.11.2014 21:48
#3885272
USE_STDPERIPH_DRIVER wird Dich beglücken.
D
DerM
Gast
16.11.2014 14:14
#3885907
Vielen lieben Dank!
USE_STDPERIPH_DRIVER
Daran lags und es funktioniert nun alles wie es soll!
SUPER!
Antwort schreiben
Bitte melde dich an, um einen Beitrag zu schreiben.
Noch kein Account?
Die Registrierung ist kostenlos und dauert nur eine Minute.
Jetzt registrieren