Hey everyone, I know this post has been done a lot of times, but people solve it by adding the .c files after including the header file in the corresponding file. The thing is, I've already done this. I just got the STM32 Nucleo with the VL6180 Expansion Board (academic purposes), and I'm trying to communicate with it via UART. I keep getting this error:
*** Using Compiler 'V5.06 update 4 (build 422)', folder: 'C:\Keil_v5\ARM\ARMCC\Bin' Rebuild target 'NucleoF401RangingAndALS' compiling vl6180x_i2c.c... compiling vl6180x_api.c... assembling startup_stm32f401xe.s... compiling stm32f4xx_it.c... compiling stm32f4xx_hal_tim_ex.c... compiling stm32f4xx_hal_msp.c... compiling system_stm32f4xx.c... compiling stm32f4xx_hal_tim.c... compiling x-nucleo-6180xa1.c... compiling main.c... compiling stm32f4xx_hal_gpio.c... compiling stm32f4xx_hal_uart.c... compiling stm32f4xx_hal_pwr.c... compiling stm32f4xx_hal_flash.c... compiling stm32f4xx_hal_usart.c... compiling stm32f4xx_hal_rcc.c... compiling stm32f4xx_hal_i2c.c... compiling stm32f4xx_hal_dma.c... compiling stm32f4xx_hal_i2c_ex.c... compiling stm32f4xx_hal_dma_ex.c... compiling stm32f4xx_hal_pwr_ex.c... compiling stm32f4xx_hal_flash_ramfunc.c... compiling stm32f4xx_hal.c... compiling stm32f4xx_hal_flash_ex.c... compiling stm32f4xx_hal_rcc_ex.c... compiling stm32f4xx_hal_cortex.c... linking... NucleoF401RangingAndALS\NucleoF401RangingAndALS.axf: Error: L6218E: Undefined symbol HAL_TIMEx_MasterConfigSynchronization (referred from main.o). NucleoF401RangingAndALS\NucleoF401RangingAndALS.axf: Error: L6218E: Undefined symbol HAL_TIM_Base_Init (referred from main.o). NucleoF401RangingAndALS\NucleoF401RangingAndALS.axf: Error: L6218E: Undefined symbol HAL_TIM_ConfigClockSource (referred from main.o). NucleoF401RangingAndALS\NucleoF401RangingAndALS.axf: Error: L6218E: Undefined symbol HAL_UART_Init (referred from main.o). NucleoF401RangingAndALS\NucleoF401RangingAndALS.axf: Error: L6218E: Undefined symbol HAL_UART_Transmit (referred from main.o). Not enough information to list image symbols. Finished: 1 information, 0 warning and 5 error messages. "NucleoF401RangingAndALS\NucleoF401RangingAndALS.axf" - 5 Error(s), 0 Warning(s). Target not created. Build Time Elapsed: 00:00:13
Those "undefined symbols" are defined on the bold files, and are being compiled. Did I add them incorrectly of something? I'm using Keil uVision 5. (I added the source files by adding them to the file tree on the left. Screenshot of the tree -> i66.tinypic.com/a5j38p.jpg What am I doing wrong?
Thanks for the help, Alan.
Hello Alan,
ST's HAL layer's function definitions often depend on macros defined in stm32f4xx_hal_conf.h. Sometimes these are defined elsewhere, like in Options for Target (blue wand icon) => C/C++ tab => "Define:". I'd look over some CubeMX examples in ST's repository, to understand how to enable their peripherals, using the CubeMX HAL layer.
The L6218E error can also be returned if the function's output/input in the extern line does not match it's defined parameters or output types.
To assure header files can be found, an easier way is to include the directories to the header files in Options for Target => C/C++ tab => Include paths. This is only necessary if the header files are stored in a different location than the source file trying to use it.
Thanks, Zack
Hi,
I am facing same problem. For that I enable UART module in stm32f4xxx_hal_conf.h file like "#define HAL_UART_MODULE_ENABLED" but still I am facing same issue.
Thank You
Are the header files for these definitions also included at the top of main.c?
You may also want to look at the following dialog: http://www.keil.com/support/man/docs/uv4/uv4_ca_rtemanager.htm
to see if the peripherals were enabled there, under Device => STM32Cube HAL.
I got this solved by downgrading some libraries, apparently there are conflicts between different versions of the libraries. And I will honk I wasn't importing them correctly or placing them in the correct directories. Moved them tons of times until it worked. Hope it helps.
Thanks Zack for the advice, I'll be reading the link you posted to actually know what exactly went wrong in the first place. Hehe thanks again!