You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We do not use interrupts in our code, but they are necessary for features like Direct Memory Access and efficient communication message buffering.
Our entire firmware architecture has a top-down function call model: the app level calls functions in the platform level. Interrupts are fundamentally different as they are platform hardware events triggering an app-level response.
Desired State
A cross platform mechanism for calling app level functions from the platform layer's interrupt handlers.
Linux C uses signal() to register functions as interrupt handlers and kill() to trigger those interrupts.
STM32 devices have Interrupt Handler functions which can be overridden to execute the app level function.
Your solution must connect the app-level function to either platform's interrupt handler.
I am not sure exactly what this will look like, but it likely will involve adding the app function to bindings.h and calling it in the platforms' bindings.cc file within an interrupt handler.
/***** bindings.h *****/voidAppLevelFunction(void);
/***** main.cc *****/
#include"bindings.h"voidAppLevelFunction(void) {
do_stuff_on_interrupt();
}
/***** platforms/linux/bindings.cc *****/
#include"bindings.h"signal(INTERRUPT_NUMBER, &AppLevelFunction)l
/***** platforms/stm32f767/bindings.cc *****/
#include"bindings.h"voidHAL_InterruptHandler(void) { // there is one of these for every interruptAppLevelFunction();
}
Tasks
1. Understand the existing project structure (few hours)
Are there any existing methods for cross-platform interrupt handling? Document any findings in a Markdown document for https://macformula.github.io/racecar/
3. Prototype (~4 weeks)
Make branch in racecar/ and start a new project (see instruction article above). Get interrupts working for that project. Start with the cli / linux platform since you can run it locally. Once that is working, implement it for STM32f767.
4. Merge to main
Make a PR with your demo project from step 3. Include a README in the project explaining how it works, and add to the docs/docs documentation to add your findings to our website.
Open Questions
Is there a "clean" way to guarantee (at compile time) that the bindings.cc file has included the app-level function in an interrupt handler?
This might be possible by defining an "InterruptHandler" peripheral class which accepts a function pointer in its constructor. This would be a cool solution, but IDK if it will work.
The text was updated successfully, but these errors were encountered:
Interrupt Hooks
Number of members: 1
Relevant skills: C++, microcontroller interrupts
Timeline: Mid November
Description
Current State
We do not use interrupts in our code, but they are necessary for features like Direct Memory Access and efficient communication message buffering.
Our entire firmware architecture has a top-down function call model: the app level calls functions in the platform level. Interrupts are fundamentally different as they are platform hardware events triggering an app-level response.
Desired State
A cross platform mechanism for calling app level functions from the platform layer's interrupt handlers.
signal()
to register functions as interrupt handlers andkill()
to trigger those interrupts.Your solution must connect the app-level function to either platform's interrupt handler.
I am not sure exactly what this will look like, but it likely will involve adding the app function to
bindings.h
and calling it in the platforms'bindings.cc
file within an interrupt handler.Tasks
1. Understand the existing project structure (few hours)
See these two articles
2. Research (~1 week)
Are there any existing methods for cross-platform interrupt handling? Document any findings in a Markdown document for https://macformula.github.io/racecar/
3. Prototype (~4 weeks)
Make branch in
racecar/
and start a new project (see instruction article above). Get interrupts working for that project. Start with thecli / linux
platform since you can run it locally. Once that is working, implement it for STM32f767.4. Merge to
main
Make a PR with your demo project from step 3. Include a README in the project explaining how it works, and add to the
docs/docs
documentation to add your findings to our website.Open Questions
Is there a "clean" way to guarantee (at compile time) that the
bindings.cc
file has included the app-level function in an interrupt handler?The text was updated successfully, but these errors were encountered: