Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Startup files for Hardware interrupts #473

Closed
SympathicCone opened this issue May 4, 2022 · 1 comment
Closed

Use Startup files for Hardware interrupts #473

SympathicCone opened this issue May 4, 2022 · 1 comment
Labels
Portenta question

Comments

@SympathicCone
Copy link

@SympathicCone SympathicCone commented May 4, 2022

I wish to use the hardware interrupts provided by the stm32h747xI within the portenta, so how and where do I add the startup_stm32h747.s where the IRQHandlers are defined to my code using ArduinoIDE? I am stuck within my project due to that since my code will just look forever for the said Handler and never get out of the interrupt . I looked it up online but no one uses Arduino IDE when it comes to implement .s files.

@facchinm
Copy link

@facchinm facchinm commented May 4, 2022

Hi @SympathicCone ,
can you elaborate a bit more 🙂 ? The vector table is already defined in the core
https://github.com/arduino/mbed-os/blob/extrapatches-6.15.1/targets/TARGET_STM/TARGET_STM32H7/TARGET_STM32H747xI/TARGET_STM32H747xI_CM7/TOOLCHAIN_GCC_ARM/startup_stm32h747xx.S#L124-L293

To attach your function to an interrupt, after enabling it, you can implement the weak callback (remember the extern "C" clause if you are in a .ino or .cpp file) or hook you function with NVIC_SetVector.

Let's say, for example, you want to hook to LTDC_ER_IRQn ; you can do it this way

extern "C" {
void LTDC_ER_IRQHandler() {
  // do something here
}
}

or this way

NVIC_SetVector(LTDC_ER_IRQn, (uint32_t)&my_function);

@facchinm facchinm closed this May 4, 2022
@facchinm facchinm added question Portenta labels May 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Portenta question
Projects
None yet
Development

No branches or pull requests

2 participants