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

Allow up to 496 interrupts on ARMv8-M #555

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cortex-m-rt/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ INCLUDE device.x"#
} else if target.starts_with("thumbv8m") {
println!("cargo:rustc-cfg=cortex_m");
println!("cargo:rustc-cfg=armv8m");
240
496
} else {
// Non ARM target. We assume you're just testing the syntax.
// This value seems as good as any.
Expand Down
19 changes: 16 additions & 3 deletions cortex-m-rt/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,8 @@
//!
//! - `__INTERRUPTS`. This is the device specific interrupt portion of the vector table; its exact
//! size depends on the target device but if the `"device"` feature has not been enabled it will
//! have a size of 32 vectors (on ARMv6-M) or 240 vectors (on ARMv7-M). This array is located after
//! `__EXCEPTIONS` in the `.vector_table` section.
//! have a size of 32 vectors (on ARMv6-M), 240 vectors (on ARMv7-M) or 496 vectors (on ARMv8-M).
//! This array is located after `__EXCEPTIONS` in the `.vector_table` section.
//!
//! - `__pre_init`. This is a function to be run before RAM is initialized. It defaults to an empty
//! function. As this runs before RAM is initialised, it is not sound to use a Rust function for
Expand Down Expand Up @@ -1234,7 +1234,7 @@ pub static __EXCEPTIONS: [Vector; 14] = [

// If we are not targeting a specific device we bind all the potential device specific interrupts
// to the default handler
#[cfg(all(any(not(feature = "device"), test), not(armv6m)))]
#[cfg(all(any(not(feature = "device"), test), not(armv6m), not(armv8m)))]
#[doc(hidden)]
#[cfg_attr(cortex_m, link_section = ".vector_table.interrupts")]
#[no_mangle]
Expand All @@ -1246,6 +1246,19 @@ pub static __INTERRUPTS: [unsafe extern "C" fn(); 240] = [{
DefaultHandler
}; 240];

// ARMv8-M can have up to 496 device specific interrupts
#[cfg(all(not(feature = "device"), armv8m))]
#[doc(hidden)]
#[cfg_attr(cortex_m, link_section = ".vector_table.interrupts")]
#[no_mangle]
pub static __INTERRUPTS: [unsafe extern "C" fn(); 496] = [{
extern "C" {
fn DefaultHandler();
}

DefaultHandler
}; 496];

// ARMv6-M can only have a maximum of 32 device specific interrupts
#[cfg(all(not(feature = "device"), armv6m))]
#[doc(hidden)]
Expand Down