-
Notifications
You must be signed in to change notification settings - Fork 50
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
Unified interrupt handler interface #12
Comments
For example, we could write an |
Whatever method we come up with, we need to be able to guarantee that the interrupt vector table will be linked before any other object file in any AVR-Rust program. The IVT always sits at the very first byte of a raw binary AVR program. |
I don't think this is strictly true if you are linking with the avr-gcc runtime glue. AIUI, in that case, that code provides the IVT and other routines like "copy static data from flash to memory".
I agree. Theoretically, people will want to do their own route for everything (hello, me) and baking anything in will make them annoyed.
I think the safe way to do this is via a linker script. You can see mine. The table is stored in a special section and then linked first in the code. |
A related aspect that we will need to deal with is model-specific aspects. For example, this linker script bakes in the amount of memory available. It also has a fixed set of interrupts which change depending on the model of processor. |
CC #9
Our interrupt handler story isn't super great; we require users to write their own interrupt vector table (IVT) in assembly, and then they define a set of
pub unsafe extern "avr-interrupt" fn <interrupt handler symbol name>() { }
that the IVT points to.Here's an example program that installs interrupt handlers.
We should come up with a single, unified method of defining interrupt handlers. All AVR-Rust programs should use the same interrupt handler function names, by convention. This is similar to AVR-GCC, which always uses the same function names, although GCC has much more abbreviated, hard-to-understand names. Let's be more descriptive.
The text was updated successfully, but these errors were encountered: