cancel
Showing results for 
Search instead for 
Did you mean: 

I am getting undefined reference to `HAL_WWDG_IRQHandler error even after defining #define HAL_WWDG_

anumathews7
Associate II
 

I am working with a project which does not have .ioc file from STM32 cube mx, so I have to enable HAL functions and make these changes manually. I wanted to add a watchdog timer. Somehow the Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_wwdg.c file is not getting included in the build.

What I have done so far:

- Enabled wwdg module in conf file
- I have removed and included the HAL_Driver folder with HAL function includes and source in Include directories. Similary I have also done the same for folder with conf file.

 

Could anyone please guide me in understanding the issue?

9 REPLIES 9
TDK
Guru

You should include #include "stm32l4xx.h" from your main file and have the appropriate hal conf file and defines. That will get includes correct.

You could generate a cubemx project to understand the way HAL expects things to be included.

Would be good to see the exact error with relevant surrounding information, as the title suggests one thing and the post suggests another.

If you feel a post has answered your question, please click "Accept as Solution".

I have done this already. Title got somehow messed up, but I meant is that even though I have included changes in conf file, Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_wwdg.c file is not getting included in the build and I am getting undefined reference error for my HAL_WWDG_IRQHandler

Using any C++ or .cpp files in the compilation here? Managing name mangling? Using extern "C"?

startup.s being pulled in correctly? ie where it's referenced and typically weak linkage provided.

stm32l4xx_it.c being pulled? ie where the body might normally live.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
TDK
Guru

> I am getting undefined reference error for my HAL_WWDG_IRQHandler

Yes but from what file? And is it a linker error or compiler error?

If you feel a post has answered your question, please click "Accept as Solution".

Sounds like a Linker error..

>>Somehow the Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_wwdg.c file is not getting included in the build.

You might have to explicitly add files to a build, the stm32l4xx_hal_conf.h does not pull source files, but gates include files, and code generation. Make sure the file with the body of the code is actually part of the project, either as a .C file, or in a .LIB / .A file

In the Keil IDE you can see if code is built or not built via shading/graying of code in the editor, you can then go look of the #ifdef or #if defined() type pre-processor gating of code inclusion.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

It is part of the project in include paths, I can see it

That's for the INCLUDE files, you still need the SOURCE file to be explicitly part of the project. And it needs to be pulling the same includes and stm32xyz_hal_conf.h

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

Thanks for reply, I just checked its also included.

anumathews7
Associate II

anumathews7_0-1699456102303.png

/Core/Src/stm32l4xx_it.c:291: undefined reference to `HAL_WWDG_IRQHandler'
collect2: error: ld returned 1 exit status
make: *** [makefile:79: FreeRTOS_IPv6UDP.elf] Error 1
"make all" terminated with exit code 2. Build might be incomplete.