ke7c2mi
ke7c2mi
DIIDevHeads IoT Integration Server
Created by Sterling on 9/11/2024 in #firmware-and-baremetal
How to Manually Program an Interrupt Service Routine (ISR) for STM32F4 MCU Without Using Libraries?
This is declaring a "weak linkage" handler for each interrupt. It's important to understand this weak linkage as it can be a source of confusion - it means "if no other thing provides this symbol, provide this value for it" - this lets the startup code install default handlers for every interrupt. When you declare the symbol in your code i.e. make a function void RTC_WKUP_IRQHandler(void)... you override that linkage, and now your function instead of the default handler will be there. I want to call this part out in particular. It is a common mistake in my experience for people to misname an interrupt vector - there are not really warnings when this happens because no symbol is missing, just the interrupt handler isn't called anywhere - this will make it "just not work" and it wont be clear why - if you have a debugger you will see when the interrupt fires you get stuck in the default handler - that is the clue you messed up there! All of this is just a very long way to say - if you are using the ST startup code, you just need to define a function with a specific name and it will handle that interrupt - making your own interrupt handler for RTC wakeup events is as simple as creating the function RTC_WKUP_IRQHandler and doing any setup to get the interrupts
9 replies