I'm using libopenCM3 for my project on STM32F4. I've used previously Standard Peripheral Library and newer Hardware Abstraction Layer developed by ST.
In these libraries you have assembly file (startup file) with the definition of vector table.
This is what I'm missing for libopenCM3. Can you please show me where to find this table? Or is it done some another way?
I really need to use interrupts in my project.
Thanks.
Interrupt vector table is located in lib/cm3/vector.c:
And
IRQ_HANDLERS
for STM32F4 are defined inlib/stm32/f4/vector_nvic.c
file. This file will be available after building the library (it's generated with irq2nvic_h script). In this file you can see something like this:Functions like
dma1_stream0_isr()
andadc_isr()
are defined like this:So these functions are just blocking handlers by default. But they are defined as weak, so you can easily redefine them in your code.
As discussed above, it boils down to next: you just need to define interrupt handler function (ISR) with correct name in your code, and your function will be placed to interrupt vector table automatically.
For instance, if you want to handle UART2 interrupt, just implement
usart2_isr()
function somewhere in your code. For the whole list of ISR function names refer toinclude/libopencm3/stm32/f4/nvic.h
. But those names are usually pretty straight-forward.Also, check out the libopencm3-examples project. The chances are you will find just what you need there.