2023-10-27 08:40 AM - edited 2023-10-27 08:41 AM
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?
2023-10-27 09:02 AM - edited 2023-10-27 09:03 AM
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.
2023-10-27 09:18 AM
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
2023-10-27 09:22 AM
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.
2023-10-27 09:55 AM
> 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?
2023-10-27 10:08 AM
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.
2023-11-08 04:29 AM
It is part of the project in include paths, I can see it
2023-11-08 05:09 AM
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
2023-11-08 06:58 AM
Thanks for reply, I just checked its also included.
2023-11-08 07:08 AM - edited 2023-11-08 07:13 AM
/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.