Skip to content

Commit 7e83181

Browse files
committed
cortex-m-rt: Fix max_int_handlers on armv8m
Fixed interrupt count for Cortex-M23 (ARMv8-M Baseline, 240) and Cortex-M33 (ARMv8-M Mainline, 480) based on the technical reference manual. The original value of 496 referred to the entire vector table length, with exceptions length already included in the assert check.
1 parent b188019 commit 7e83181

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

cortex-m-rt/build.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,12 @@ INCLUDE device.x"#
6868
println!("cargo:rustc-cfg=cortex_m");
6969
println!("cargo:rustc-cfg=armv8m");
7070
println!("cargo:rustc-cfg=armv8m_base");
71-
496
71+
240
7272
} else if target.starts_with("thumbv8m.main") {
7373
println!("cargo:rustc-cfg=cortex_m");
7474
println!("cargo:rustc-cfg=armv8m");
7575
println!("cargo:rustc-cfg=armv8m_main");
76-
496
76+
480
7777
} else {
7878
// Non ARM target. We assume you're just testing the syntax.
7979
// This value seems as good as any.

cortex-m-rt/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1259,7 +1259,7 @@ pub static __EXCEPTIONS: [Vector; 14] = [
12591259

12601260
// If we are not targeting a specific device we bind all the potential device specific interrupts
12611261
// to the default handler
1262-
#[cfg(all(any(not(feature = "device"), test), not(armv6m), not(armv8m)))]
1262+
#[cfg(all(any(not(feature = "device"), test), not(armv6m), not(armv8m_main)))]
12631263
#[doc(hidden)]
12641264
#[cfg_attr(cortex_m, link_section = ".vector_table.interrupts")]
12651265
#[no_mangle]
@@ -1272,11 +1272,11 @@ pub static __INTERRUPTS: [unsafe extern "C" fn(); 240] = [{
12721272
}; 240];
12731273

12741274
// ARMv8-M can have up to 496 device specific interrupts
1275-
#[cfg(all(not(feature = "device"), armv8m))]
1275+
#[cfg(all(not(feature = "device"), armv8m_main))]
12761276
#[doc(hidden)]
12771277
#[cfg_attr(cortex_m, link_section = ".vector_table.interrupts")]
12781278
#[no_mangle]
1279-
pub static __INTERRUPTS: [unsafe extern "C" fn(); 496] = [{
1279+
pub static __INTERRUPTS: [unsafe extern "C" fn(); 480] = [{
12801280
extern "C" {
12811281
fn DefaultHandler();
12821282
}

0 commit comments

Comments
 (0)