Skip to main content
Visitor II
January 20, 2025
Solved

linker not seeing stm32f4xx_hal_tim.h when building project

  • January 20, 2025
  • 4 replies
  • 1558 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.

     

    4 replies

    Pavel A.Answer
    Super User
    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
    Visitor II
    January 21, 2025

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

    Graduate 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?

     

    Graduate II
    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.

    Super User
    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.

     

     

    Graduate 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