Question
Undefined symbol assert_param (referred from misc.o) in keil with stm32f407
Posted on March 22, 2014 at 08:29
Hi everyone,
I'm trying to compile and run an example found on the internet implementing USART on an stm32f4Discovery kit, I'm using keil uV5here is the code <p>#include <stm32f4xx.h>#include <misc.h> // I recommend you have a look at these in the ST firmware folder#include <stm32f4xx_usart.h> // under Libraries/STM32F4xx_StdPeriph_Driver/inc and src#include <stm32f4xx_rcc.h>#include <stm32f4xx_gpio.h>#include <system_stm32f4xx.h>#include ''stm32f4xx_conf.h''#define MAX_STRLEN 12 // this is the maximum string length of our string in charactersvolatile char received_string[MAX_STRLEN+1]; // this will hold the recieved stringvoid Delay(__IO uint32_t nCount) { while(nCount--) { }}void init_USART1(uint32_t baudrate){ GPIO_InitTypeDef GPIO_InitStruct; // this is for the GPIO pins used as TX and RX USART_InitTypeDef USART_InitStruct; // this is for the USART1 initialization //NVIC_InitTypeDef NVIC_InitStructure; // this is used to configure the NVIC (nested vector interrupt controller) RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1, ENABLE); RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOB, ENABLE); GPIO_InitStruct.GPIO_Pin = GPIO_Pin_6 | GPIO_Pin_7; // Pins 6 (TX) and 7 (RX) are used GPIO_InitStruct.GPIO_Mode = GPIO_Mode_AF; // the pins are configured as alternate function so the USART peripheral has access to them GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz; // this defines the IO speed and has nothing to do with the baudrate! GPIO_InitStruct.GPIO_OType = GPIO_OType_PP; // this defines the output type as push pull mode (as opposed to open drain) GPIO_InitStruct.GPIO_PuPd = GPIO_PuPd_UP; // this activates the pullup resistors on the IO pins GPIO_Init(GPIOB, &GPIO_InitStruct); // now all the values are passed to the GPIO_Init() function which sets the GPIO registers GPIO_PinAFConfig(GPIOB, GPIO_PinSource6, GPIO_AF_USART1); // GPIO_PinAFConfig(GPIOB, GPIO_PinSource7, GPIO_AF_USART1); USART_InitStruct.USART_BaudRate = baudrate; // the baudrate is set to the value we passed into this init function USART_InitStruct.USART_WordLength = USART_WordLength_8b;// we want the data frame size to be 8 bits (standard) USART_InitStruct.USART_StopBits = USART_StopBits_1; // we want 1 stop bit (standard) USART_InitStruct.USART_Parity = USART_Parity_No; // we don't want a parity bit (standard) USART_InitStruct.USART_HardwareFlowControl = USART_HardwareFlowControl_None; // we don't want flow control (standard) USART_InitStruct.USART_Mode = USART_Mode_Tx | USART_Mode_Rx; // we want to enable the transmitter and the receiver USART_Init(USART1, &USART_InitStruct); // again all the properties are passed to the USART_Init function which takes care of all the bit setting//
USART_ITConfig(USART1, USART_IT_RXNE, ENABLE); // enable the USART1 receive interrupt //NVIC_InitStructure.NVIC_IRQChannel = USART1_IRQn; // we want to configure the USART1 interrupts //NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;// this sets the priority group of the USART1 interrupts //NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0; // this sets the subpriority inside the group //NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; // the USART1 interrupts are globally enabled //NVIC_Init(&NVIC_InitStructure); // the properties are passed to the NVIC_Init function which takes care of the low level stuff USART_Cmd(USART1, ENABLE);}void USART_puts(USART_TypeDef* USARTx, volatile char *s){ while(*s){ while( !(USARTx->SR & 0x00000040) ); USART_SendData(USARTx, *s); *s++; }}int main(void) { init_USART1(9600); // initialize USART1 @ 9600 baud USART_puts(USART1, ''Init complete! Hello World!rn''); // just send a message to indicate that it works while (1){ }}</p>I've worked for a long time to eliminate too many errors appeared because of linking and finally I've solved all of them except one error<p>Build target 'STM32F407 Flash'
compiling stm32f4xx_gpio.c...compiling stm32f4xx_rcc.c...compiling stm32f4xx_usart.c...linking....\Flash\Blinky.axf: Error: L6218E: Undefined symbol assert_param (referred from misc.o).Not enough information to list image symbols.Finished: 1 information, 0 warning and 1 error messages.''.\Flash\Blinky.axf'' - 1 Error(s), 0 Warning(s).Target not created</p>I searched a lot for a solution for this assert_param issue but I couldn't Here are my questions -How to solve this error ?-What is the importance of these two header files? stm32f4xx_conf.h and misc.h-Where is the definition of assert_failed function as I used ''go to the definition'' of assert_failed but it wasn't found Really I'll appreciate any help Thanks a lot