I have interrupt lockup problems. STM32F423ZHT6. Bare metal assembly. Despair. SOLVED.
update (a week later, after a vacation to clear head):
This was solved by changing the entry in the vector table from ".word timer7"
to ".word timer7+1". The +1 is to set bit 1 of the handler address to signal that it is a 16 bit
thumb instruction. (obviously the same must be done for the fault handler address....)
What clued me in was that the CFSR was showing an invalid ESPR fault, which implies mixing up 16 and 32 bit instructions. I am AMAZED that several days of searching online for examples of interrupt handler code in assembly, and appealing to experts on several sites did not reveal this. Doesn't anybody do bare metal assembly anymore???
----------original post below---------------
I am migrating NXP ARM7 to STM32. I've played with G031 and F423 so far. I've got a F423 on my own testboard now, clocked to 100 MHz (w/ 3 flash wait states, boosted from 20 MHz crystal), using J-Link Plus on SWD port. It works great as I fill my toolbox with cool tricks, until I try to implement interrupts. It always halts on the interrupt. (Free running timers continue spinning, but code stops executing.)
Only interrupt enabled is TIM7 reload, enabled on timer configure and on NVIC #55. The vector points to code that increments a location in SRAM that I can watch on mem probe. If I understand, all context saving is done by syscode, I don't need to push on entry (if only using R0, R1), and exit is only "BX LR".
Examination of the stack shows two frames pushed. First frame pushed was from one or two lines in the 4 line main loop, with an 0xFFFFFFFF LR. Second frame pushed was from the first line of the timer handler with an 0xFFFFFFF9 LR. Examination of status register shows a UFSR=0002, implying an illegal instruction. I should be in privileged mode - I can write to the NVIC registers, and I haven't touched the modes since reset. I've added ".align" to make sure we are aligned, I've tried bypassing the clock boosts, I've got all sorts of telltale sram pokes scattered to let me know if it is bouncing anywhere. Plain vanilla code in the handler, accessing only the SRAM (0x200000xx), the GPIO (40021418), and clearing the UIF bit on the timer and the pending interrupt bit on the NVIC (E000E284)...don't know if I need that last one since it hasn't worked yet.
The entire rest of the vector table points to a single handler that just goes infinite loop spinning one sram counter as a telltale -- no evidence it was called.
(edit: i've tried with and without "cpsie f" or "cpsie i" in the setup. i've tried with and without changing the NVIC priority reset at 0xE000E434 to FF (lowest possible). no effect .)
Clearly I'm missing some crucial setup. Help? Don't tell me to program in C, it is irrelevant and doesn't help. I need to understand what is going on here.
Thanks! Jeff