Skip to main content
septembeer
Associate
December 25, 2015
Question

Error: L6218E: Undefined symbol HAL_ADC_Init (referred from main.o).

  • December 25, 2015
  • 3 replies
  • 5104 views
Posted on December 25, 2015 at 03:47

Hi,

I got a keil C project and try to add ADC peripheral into this peoject.

I do believe this original project was made from STM Cube and did not enable ADC function in the begining.

When I just add ADC init function into main.c, error L6218E appears.

linking...

.\Objects\charger_stm32f0.axf: Error: L6218E: Undefined symbol HAL_ADC_ConfigChannel (referred from main.o).

.\Objects\charger_stm32f0.axf: Error: L6218E: Undefined symbol HAL_ADC_Init (referred from main.o).

Not enough information to list image symbols.

Finished: 1 information, 0 warning and 2 error messages.

I do include ''stm32f0xx_hal_adc.h'' and ''stm32f0xx_hal_adc_ex.h'' in my project, but what i wonder about is the file version, ''stm32f0xx_hal_adc.h'' is V1.2.0 while ''stm32f0xx_hal_adc.c'' is V1.3.0. 

This difference could make this compiling error?

I develop this project under MDK-ARM V5.15

#!stm32-!cubemx #l6218e
    This topic has been closed for replies.

    3 replies

    Tesla DeLorean
    Guru
    December 25, 2015
    Posted on December 25, 2015 at 04:22

    You'd need to also ensure HAL_ADC_MODULE_ENABLED is defined.

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    septembeer
    Associate
    December 25, 2015
    Posted on December 25, 2015 at 05:04

    Hi Clive,

    thanks for your reply

    When I enable 'HAL_ADC_MODULE_ENABLED' and also update adc c file and h file to same verison (v1.3.0), some undefined errors show, 

    such as 

    error:  #20: identifier ''ADC_CCR_ALL'' is undefined

    error:  #20: identifier ''ADC_CHANNEL_TEMPSENSOR'' is undefined

    STM32F0xx_HAL_Driver\Src\stm32f0xx_hal_adc_ex.c(238): error:  #20: identifier ''HAL_ADC_STATE_ERROR'' is undefined

    ........

     I could not find these parameters in 'stm32f0xx_hal_adc.h' file but only in 'stm32f0xx_hal_adc.c' or 'stm32f0xx_hal_adc_ex.c'.

    I may need to figure out what version of HAL driver i used.

    Tesla DeLorean
    Guru
    December 25, 2015
    Posted on December 25, 2015 at 16:18

    Yeah, I don't understand, it would generally take MORE effort to get a project to use two mismatched versions of the library than one.

    Suggest you use a current, singular, library and make sure your project has the right include paths and pulls source files from the same tree.

    Look at the Include Paths settings, remove all extraneous paths which might be pulling random Keil supplied includes over the ones you want, and modify the search order to prefer the library you are using.

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..