cancel
Showing results for 
Search instead for 
Did you mean: 

How to solve linker error ''Undefined symbol'' ? in KEIL uVision5 ?

Marco Israel
Associate II
Posted on January 01, 2018 at 17:01

Hello,

I implemented the folloing codesnipped (using to set the USART baudrate). :

    uint32_t periphclk = LL_RCC_GetUSARTClockFreq(LL_RCC_USART2_CLKSOURCE);

    uint32_t oversampling = LL_USART_GetOverSampling(USART2);

    if (periphclk != LL_RCC_PERIPH_FREQUENCY_NO)

    {

        LL_USART_SetBaudRate(USART2,

            periphclk,

            oversampling,

            BAUDRATE);

    }

But I get the following linking error out ouf the first snipping line:

.\Objects\simpel_gpio_test.axf: Error: L6218E: Undefined symbol LL_RCC_GetUSARTClockFreq (referred from main.o).

Not enough information to list image symbols.

Not enough information to list load addresses in the image map.

Can someone explain me, how to give the linker the needed information? If I use a hardcoded periphclk  or if I use  __LL_RCC_* macros like __LL_RCC_CALC_MSI_FREQ(), the code compile and link without erros....

I'm using KEIL uVison5.

Does some hase any idea? ...

Thank you so much

12 REPLIES 12
Posted on January 04, 2018 at 13:46

 ,

 ,

As noted previously, the correct place to do this is in the Project Defines - then you don't have to go manually editing individual files.

I guess this is what the User Manual means when it says (my emphasis):

5.14 How are LL initialization APIs enabled?

The definition of LL initialization APIs and associated resources (structure, literals and prototypes) is conditioned by the USE_FULL_LL_DRIVER compilation switch. To be able to use LL APIs,

add this switch in the toolchain compiler preprocessor.

It could be clearer.

http://www.st.com/content/ccc/resource/technical/document/user_manual/74/09/3d/80/f9/39/4c/c7/DM00157440.pdf/files/DM00157440.pdf/jcr:content/translations/en.DM00157440.pdf

 ,

Marco Israel wrote:

I don't know, why I need this only in this file

Did you not spot, right at the top of that file:

/**

 ,

******************************************************************************

 ,

* @file stm32l4xx_ll_rcc.c

 ,

* @author MCD Application Team

 ,

* @version V1.6.0

 ,

* @date 28-October-2016

 ,

* @brief RCC LL module driver.

 ,

******************************************************************************

 ,

:

:

*/

 ,

♯ if defined(USE_FULL_LL_DRIVER)

Posted on January 04, 2018 at 14:46

There should be Keil Template LL projects under the source/example trees, if those build correctly review the structure and project metadata (defines, include paths, etc)

ST usually passes a define for the CPU and the Library being used. Include path order can make a differences if you have multiple instance of the same files

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Marco Israel
Associate II
Posted on January 05, 2018 at 11:38

Thank you Andrew, and yes it works if I make the #define in the  project settings...

Easy, if you know where (in which document and in which part) you find the needed information and how to understand it, mostly is clear ...hopefully ... or not ... 

But mostly it feels like I search at the wrong places ...

:(

 

And thank you Clive, yes maybe I take the templates next time. I know about it... But I like to do it on may own to learn what I had/must do (or what I have not done and forgot) to learn my stuff... Out of errors you learn mostly the most in my opinion ... after you find the solution.... Sometimes this is a hard way to learn...

:(