cancel
Showing results for 
Search instead for 
Did you mean: 

Static library selects the weak function instead of the implementation in the user file

Tme.1
Associate

IDE: STM32CubeIDE Version: 1.10.1

Board: NUCLEO H743ZI2

Created STM32 Executable project as follow (Targeted Project Type: STM32Cube):

0693W00000Sv4gMQAR.pngAnd configure the device as needed, it runs great without any issues.

Now I wanted this project to be static library so I can use it as base to other projects, I changed the Build Artifact from Executable to Static Library as follow:

0693W00000Sv4fdQAB.pngThen I created new STM32 Executable project as follow (Targeted Project Type: Empty):

0693W00000Sv4gvQAB.pngand linked it with the static library of the first project.

The Executable project have temp file with function just to have something, I'm using the main function from the StaticLibrary Project

Now when I run the new executable it goes to function:

__weak void HAL_MspInit(void)

at the file stm32h7xx_hal.c which is empty function and not to the function:

void HAL_MspInit(void)

at file stm32h7xx_hal_msp.c which as the actual code needed

I'v seen topics with this issue, they talk about the flag -ffunction-sections that should resolve the problem, it doesn't help me.

Attach small workspace with the projects that show the problem.

Any suggestions?

1 REPLY 1
MM..1
Chief III