Skip to main content
Associate
January 20, 2025
Solved

linker not seeing stm32f4xx_hal_tim.h when building project

  • January 20, 2025
  • 6 replies
  • 1603 views

here's a link to the GitHub issue containing the build output: https://github.com/giff25/MotorTest/issues

I double checked to make sure the HAL_TIM module was enabled, and followed the chain to the .h file itself and still haven't noticed any reason why the linker wouldn't see the TIM functions


Im using a nucleo board and the toolchain is as follows:

built the project using CubeMX (including configuring the timer and pwm channels)
Using VSCode with STM32 VS Code extension

any help would be appreciated

This topic has been closed for replies.
Best answer by Pavel A.

The linker does not see TIM functions likely because the stm32xxx_hal_tim.c or tim_ex.c file is not included in the project. Ensure that these files are included in build.

 

6 replies

Pavel A.
Pavel A.Best answer
January 21, 2025

The linker does not see TIM functions likely because the stm32xxx_hal_tim.c or tim_ex.c file is not included in the project. Ensure that these files are included in build.

 

vbut25Author
Associate
January 21, 2025

It looks like the .c files weren't added to the Makefile C_sources for some reason.

Senior II
January 21, 2025

Linkers don't really care about header files per se. They are looking for implementations. Can you show the specific negative output or error message?

 

Tesla DeLorean
Guru
January 21, 2025

Include files aren't code.

You need to ADD stm32xxx_hal_tim.c or tim_ex.c to the project, so the compiler can generate the objects for the linker to link against.

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

Actually I've been so tired and mad about these missing HAL .c files that made this little dirty trick (attached example for STM32H7) .  Build with only this one .c file in sources and remove all other references to the HAL .c files in the project. If some ...hal_.c file is missing, just add it to the list. Hoping no C language purists see us here.

 

 

Senior II
January 21, 2025

I don't use CubeMX but for CubeIDE there is a place to configure that you want the HAL files. Usually they are enabled but its worth a check.

Carl_G_0-1737421964272.png