2018-01-22 05:24 PM
I want to add crc function in STM32F030RC, so I add HAL_CRC_Init, and related functions. But there is always 'no definition for 'HAL_CRC_Init'' error when link. I have include 'stm32f0xx_hal.h','stm32f0xx_hal_crc.h','stm32f0xx_hal_crc_ex.h', but it seems useless. I don't know why, and how to fix this problem. Please help!
Below is my related code.
/* Includes ------------------------------------------------------------------*/
#include 'main.h'#include 'stm32f0xx_hal.h'#include 'stm32f0xx_hal_crc.h'#include 'stm32f0xx_hal_crc_ex.h'#include 'cmsis_os.h'
#include 'app_header.h'
#include 'app_main.h'#include 'gps.h'#include 'at.h'#include 'network.h'#include 'uart.h'#include 'memory.h'#include 'log.h'ADC_HandleTypeDef hadc;
I2C_HandleTypeDef hi2c1;
RTC_HandleTypeDef hrtc;
UART_HandleTypeDef huart1;
UART_HandleTypeDef huart2;UART_HandleTypeDef huart3;UART_HandleTypeDef huart5;/* CRC handler declaration */
CRC_HandleTypeDef CrcHandle;static void MX_CRC_Init(void);
static void MX_CRC_Init(void)
{ CrcHandle.Instance = CRC;/* The default polynomial is not used. It is required to defined it in CrcHandle.Init.GeneratingPolynomial*/
CrcHandle.Init.DefaultPolynomialUse = DEFAULT_POLYNOMIAL_ENABLE;/* Set the value of the polynomial */
CrcHandle.Init.GeneratingPolynomial = DEFAULT_POLYNOMIAL_ENABLE;/* The size of the polynomial to configure the IP is 8b*/
CrcHandle.Init.CRCLength = CRC_POLYLENGTH_32B;/* The default init value is used */
CrcHandle.Init.DefaultInitValueUse = DEFAULT_INIT_VALUE_DISABLE;/* The input data are not inverted */
CrcHandle.Init.InputDataInversionMode = CRC_INPUTDATA_INVERSION_NONE;/* The output data are not inverted */
CrcHandle.Init.OutputDataInversionMode = CRC_OUTPUTDATA_INVERSION_DISABLE;/* The input data are 32 bits lenght */
CrcHandle.InputDataFormat = CRC_INPUTDATA_FORMAT_WORDS;if (HAL_CRC_Init(&CrcHandle) != HAL_OK)
{ /* Initialization Error */ Error_Handler(); }}
Solved! Go to Solution.
2018-01-22 06:59 PM
Make sure you have added the following files to the project tree
stm32f0xx_hal_crc.c
stm32f0xx_hal_crc_ex.c
Linker error suggests you don't provide the function bodies.
2018-01-22 05:33 PM
You need to make sure the stm32f0xx_hal_conf.h file in your project has the following line uncommented
#define HAL_CRC_MODULE_ENABLED
You should just need to #include
'stm32f0xx_hal.h'
2018-01-22 05:53 PM
I have add
#define HAL_CRC_MODULE_ENABLED
instm32f0xx_hal_conf.h
(this was commentted before, now I modified it), but still the same problem(no definition for 'HAL_CRC_Init' )2018-01-22 06:08 PM
Yes, no stm32f0xx_hal_crc.c,stm32f0xx_hal_crc_ex.c in the project tree. Now it has been fixed. Thanks a lot!
2018-01-22 06:59 PM
Make sure you have added the following files to the project tree
stm32f0xx_hal_crc.c
stm32f0xx_hal_crc_ex.c
Linker error suggests you don't provide the function bodies.