1

The answer to this question here
Libopencm3 interrupt table on STM32F4
explains the whole mechanism nicely but what I get is whole vector table filled with blocking handlers.

I know that because I see it in debugger (apart from the whole thing not working): disassembly screenshot showing vector table.

It is as though linker simply ignores my nicely defined interrupt handler function(s), e.g.:

void sys_tick_handler(void)
{
...
}

void tim1_up_isr(void)
{
...
}

I am using EmBitz IDE and have followed this tutorial here to get libopencm3 to work (and it does work except for this issue).

I have checked the function names n-fold and have tried several online examples including those from the libopencm3-examples project.

Everything compiles without a glitch and loads into the target board (STM32F103C8) and runs fine - except no ISRs get invoked (I do get interrupt(s) but they get stuck in blocking handlers).

Does anyone have an idea why is this happening?

Community
  • 1
  • 1
spacer
  • 1,347
  • 1
  • 9
  • 20
  • Is it correct that you have the same issue when building and running projects from libopencm3-examples? If so, how are you building them? Just by running `make` in corresponding project directory? And which OS are you using? – Sam Protsenko Jan 07 '17 at 17:16
  • @Sam, I'm using EmBitz IDE, as stated in the question. I'm running it on a Win 7 VM but don't see how could that be related. Could it be EmBitz issue? – spacer Jan 09 '17 at 15:23

1 Answers1

0

It looks like linking with standard vector table (from ST's SPL or HAL).

To check this, try to rename your sys_tick_handler() to SysTick_Handler() and tim1_up_isr() to TIM1_UP_IRQHandler().

If it works, find file with this SysTick_Handler and TIM1_UP_IRQHandler (I think, that will be startup*.s) and delete it from your project.

Alexey Esaulenko
  • 499
  • 2
  • 10
  • When I rename `sys_tick_handler()` to `SysTick_Handler()` it works. The `SysTick_Handler` symbol is used only in the file "startup_stm32f10x_md.s" which contains the startup code and the vector table definition - are you suggesting to remove this file? – spacer Jan 09 '17 at 16:47
  • Actually, this is starting to make sense - the "startup_stm32f10x_md.s" file uses `SysTick_Handler` symbol to populate the vector table but the symbol is defined **only** in that file (as blocking handler) **and** there is no link between it and the `sys_tick_handler` symbol - so no wonder it does not work. It all comes from the tutorial I followed [link](https://github.com/OliviliK/STM32F103/wiki/Tutorial2_LOCM3Template) which suggests to remove LibOpenCM3's "vector_nvic.c" file and introduces the startup file (which apparently is supposed to define the vector table itself). – spacer Jan 09 '17 at 17:15
  • OK, found the way how to make it work: at the start of "startup_stm32f10x_md.S" file add `#include ` (which contains only #define's of IRQ handler alternative names), add `#define SysTick_Handler sys_tick_handler` (because it is not defined in "irqhandlers.h" for some reason) and add another search path to the project options ("C:\CommonLibs\libopencm3\include\libopencmsis\stm32\f1"). – spacer Jan 09 '17 at 22:33
  • I'll accept this answer as it led to the solution. Thanks Alexey! – spacer Jan 09 '17 at 22:38