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

1 ACCEPTED SOLUTION

Accepted Solutions
Marco Israel
Associate II
Posted on January 04, 2018 at 13:20

Yesterday I solved the problem already. I added the define also in the

stm32l4xx_ll_rcc

.c

lib source file. Not nice, but 'it works for me' and now the linker is also happy...  I don't know, why I need this only in this file, not in other ones which also need this flag ... 

Thank you for your help and 

kind regards.

View solution in original post

12 REPLIES 12
Posted on January 01, 2018 at 17:29

Linker complaining you don't provide source for the code you call, review what source is in the project.

Add 

stm32l4xx_ll_rcc.c 

to the project (or equivalent for STM32 family being used)

STM32Cube_FW_L4_V1.10.0\Drivers\STM32L4xx_HAL_Driver\Src\stm32l4xx_ll_rcc.c

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on January 01, 2018 at 18:09

Exactly the same way you'd solve it in any other toolchain!

This is basic programming stuff; not specific to Keil; not specific to embedded - not even specific to 'C' !

http://c-faq.com/decl/decldef.html

 
Marco Israel
Associate II
Posted on January 02, 2018 at 13:12

Hello and thank you for your replay !

I know that it is 'basic' stuff. But I defined the need Flag 'USE_FULL_LL_DRIVER', The file is in my project (like other files which compile without problems) and I add the needed lib paths to the project setting. I have currently no idea, which I forgot for this file... 

The function isn't also 'static' (but this would be an error in this stm file...)
Posted on January 02, 2018 at 14:37

How & where did you define that flag?

IS the file actually being compiled?

Marco Israel
Associate II
Posted on January 03, 2018 at 11:23

Hello Adrew,

I make the #define in my main.h, before the howl includes. The file compiles without erros, like all other ones and I get the object.o files. Other libs (like the ll_usart) works without errors (need the same #define 'USE_FULL_LL_DRIVER' ...

Posted on January 03, 2018 at 11:59

 ,

 ,

Marco Israel wrote:

I make the ♯ define in my main.h, before the howl (sic) includes.

Should that say, 'HAL includes' ?

But does it also need to be seen by the LL/HAL source files ... ?

Try it in Project defines ...

Posted on January 03, 2018 at 12:57

@Marco : maybe LL_RCC_GetUSARTClockFreq is not available for your specific chip model.

For example I have STM32F446xx and can't find it in CubeMx repository/drivers for this chip. (v 1.18)

This is the point with the LL stuff vs. HAL: it's very specific for the chip variant...

-- pa

Posted on January 03, 2018 at 13:08

pavel a wrote:

@Marco : maybe LL_RCC_GetUSARTClockFreq is not available for your specific chip model.

If that were the case, surely he'd get a compiler error saying so?

Marco Israel
Associate II
Posted on January 04, 2018 at 13:20

Yesterday I solved the problem already. I added the define also in the

stm32l4xx_ll_rcc

.c

lib source file. Not nice, but 'it works for me' and now the linker is also happy...  I don't know, why I need this only in this file, not in other ones which also need this flag ... 

Thank you for your help and 

kind regards.