2024-11-05 12:02 PM - edited 2024-11-05 12:17 PM
I am trying to write interrupts bare-metal style. When I try to set the interrupt vector for LPTIM1 (using B-L071Z-LRWAN1) using this method,
NVIC_SetVector(LPTIM1_IRQn, (uint32_t)&LPTIM1_IRQHandler);
the compiler gives me this error:
../Core/Src/main.c:87:48: error: 'LPTIM1_IRQHandler' undeclared (first use in this function); did you mean 'TIM6_IRQHandler'?
87 | NVIC_SetVector(LPTIM1_IRQn, (uint32_t)&LPTIM1_IRQHandler);
Which I find bizarre, since I am not using timer 6, and LPTIM1_IQRHandler is listed in startup_stm32l072czyx.s. I tried declaring LPTIM1_IRQHandler as an extern, but with no success. Attached is the startup file.
How do I fix this?
Solved! Go to Solution.
2024-11-05 01:08 PM
Where is main.c getting its prototype for the LPTIM1_IRQHandler() ?
The body is in the it.c file, do you have a prototype for it in main.h ?
This is the compiler complaining, not that the Linker can't find the body, weak or otherwise.
2024-11-05 01:12 PM
Thanks for your response, Tesla. It turns out that not having the prototypes in main.h was the exact problem. It makes sense in hindsight. Appreciate it!