Skip to main content
Associate
Jan 20, 2025 10:49 PM UTC
Solved

linker not seeing stm32f4xx_hal_tim.h when building project

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.
Pavel A.
Pavel A.Best answer
Jan 21, 2025 12:18 AM UTC

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
Jan 21, 2025 12:18 AM UTC

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
Jan 21, 2025 8:26 PM UTC

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

Senior II
Jan 21, 2025 12:26 AM UTC

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
Jan 21, 2025 12:36 AM UTC

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.
Jan 21, 2025 12:53 AM UTC

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
Jan 21, 2025 1:13 AM UTC

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