Skip to content

Commit 7102bd4

Browse files
committed
Add some Armv8-M assembly routines
Adds access to MSP_NS and the BXNS instruction. Also adds __dsb which was missing. Signed-off-by: Hugues de Valon <[email protected]>
1 parent 43b9383 commit 7102bd4

18 files changed

+49
-0
lines changed

asm/inline.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,23 @@ mod v8m {
308308
asm!("ttat {target}, {target}", target = inout(reg) target);
309309
target
310310
}
311+
312+
#[inline(always)]
313+
pub unsafe fn __msp_ns_r() -> u32 {
314+
let r;
315+
asm!("mrs {}, MSP_NS", out(reg) r);
316+
r
317+
}
318+
319+
#[inline(always)]
320+
pub unsafe fn __msp_ns_w(val: u32) {
321+
asm!("msr MSP_NS, {}", in(reg) val);
322+
}
323+
324+
#[inline(always)]
325+
pub unsafe fn __bxns(val: u32) {
326+
asm!("BXNS {}", in(reg) val);
327+
}
311328
}
312329

313330
#[cfg(armv8m_main)]

asm/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ shims! {
6060
fn __cpsie();
6161
fn __delay(cyc: u32);
6262
fn __dmb();
63+
fn __dsb();
6364
fn __isb();
6465
fn __msp_r() -> u32;
6566
fn __msp_w(val: u32);
@@ -97,6 +98,9 @@ shims! {
9798
fn __ttt(target: u32) -> u32;
9899
fn __tta(target: u32) -> u32;
99100
fn __ttat(target: u32) -> u32;
101+
fn __msp_ns_r() -> u32;
102+
fn __msp_ns_w(val: u32);
103+
fn __bxns(val: u32);
100104
}
101105

102106
// Mainline only.

bin/thumbv6m-none-eabi-lto.a

348 Bytes
Binary file not shown.

bin/thumbv6m-none-eabi.a

444 Bytes
Binary file not shown.

bin/thumbv7em-none-eabi-lto.a

348 Bytes
Binary file not shown.

bin/thumbv7em-none-eabi.a

448 Bytes
Binary file not shown.

bin/thumbv7em-none-eabihf-lto.a

352 Bytes
Binary file not shown.

bin/thumbv7em-none-eabihf.a

448 Bytes
Binary file not shown.

bin/thumbv7m-none-eabi-lto.a

336 Bytes
Binary file not shown.

bin/thumbv7m-none-eabi.a

444 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)