2010-09-01 10:41 AM
I squeezed the error down to ' assert_param'
#preprocessor-output2011-05-17 05:05 AM
asssert_param macro calls assert_failed function which you need to define in order to send error information to serial port or LCD or monitor or whatever you like (this is user specific).
e.g if you've got printf available you could do this void assert_failed(u8* file, u32 line) { printf( ''\r\nassert_failed(). file: %s, line: %ld\r\n'', file, line ); while (1) {} }2011-05-17 05:05 AM
undefined reference to `assert_param'
hello , thank you for your answer what I wanted to ask is why it still gives error although I defined the ''assert param'' macro ?2011-05-17 05:05 AM
''why it still gives error although I defined the assert_param macro ?''
Clearly, the compiler is not ''seeing'' your definition at the points where it is reporting this error! For preprocessor problems like this, you need to examine the preprocessor output to see exactly what's happening. See the Documentation for your particular compiler for how to see the preprocessor output eg,see:2011-05-17 05:05 AM
Can you show how you have defined assert_param? Maybe you should attach your stm3210x_conf.h as I'm not sure what you have done. As I said all you have to do is define assert_failed -- you don't do anything to assert_param macro.
In stm3210x_conf.h assert_param is defined like so #ifdef USE_FULL_ASSERT #define assert_param(expr) ((expr) ? (void)0 : assert_failed((uint8_t *)__FILE__, __LINE__)) void assert_failed(uint8_t* file, uint32_t line); #else #define assert_param(expr) ((void)0) #endif2011-05-17 05:05 AM
unbelievable but I compiled one project successfully
I simply included #include ''stm32f10x_conf.h'' line in every library file like ..._usart.c or ..._gpio.c secondly also I wrote the line #include ''stm32f10x_conf.h'' on top of other include files lines ( it means the order of include lines is also important for the compiler ) --------------------------- ok - now I have other questions I dont have eval boards of ST instead I have this boardhttp://www.futurlec.com/ET-STM32_Stamp.shtml
in gpio_toggle example of peripeheral library it says main.c -----------------------------------/* Initialize Leds mounted on STM3210X-EVAL board */
STM_EVAL_LEDInit(LED1); ---------------------------------------------------------- in stm3210e_eval.c --------------------------------------------- void STM_EVAL_LEDInit(Led_TypeDef Led) { GPIO_InitTypeDef GPIO_InitStructure; /* Enable the GPIO_LED Clock */ RCC_APB2PeriphClockCmd(GPIO_CLK[Led], ENABLE);/* Configure the GPIO_LED pin */
GPIO_InitStructure.GPIO_Pin = GPIO_PIN[Led]; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;GPIO_Init(GPIO_PORT[Led], &GPIO_InitStructure);
} how I must change this code to put a LED to Port PA0 for example ?2011-05-17 05:05 AM
>>how I must change this code to put a LED to Port PA0 for example ?
Try downloading and looking at ALL the example code provided in the STM32 Firmware Library?
GPIO_InitTypeDef GPIO_InitStructure;
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE); /* Configure the PA.00 pin */ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_Init(GPIOA, &GPIO_InitStructure);2011-05-17 05:05 AM
''it means the order of include lines is also important for the compiler''
Note that #include and macro expansion is handled by the preprocessor -not
the compiler! And, of course, any symbol needs to be declared before it can be used - so, if a macro definition is made in a header file, then that header file has to be included before anything else that uses the macro! That's what I meant about the compiler ''seeing'' your definition.2012-02-27 05:15 AM
The better way (in my opinion) is uncomment the line:
#ifdef USE_STDPERIPH_DRIVER
#include ''stm32f4xx_conf.h'' #endifin stm32f4xx.h file
or set the USE_STDPERIPH_DRIVER flag
2012-02-27 07:35 AM
That, or send -DUSE_STDPERIPH_DRIVER to the compiler.