From 9aa32ae9ebd55f19326a713c8f165cb7d6c6de5c Mon Sep 17 00:00:00 2001 From: Jan Niehusmann Date: Sat, 9 Jul 2022 08:43:57 +0000 Subject: [PATCH] Fix inline assembly for use with nightly https://github.com/rust-lang/rust/issues/99071 --- src/lib.rs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 98acb6f..b69d660 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -172,6 +172,9 @@ pub mod flash { rom_data::flash_enter_cmd_xip(); */ core::arch::asm!( + "mov r8, r0", + "mov r9, r2", + "mov r10, r1", "ldr r4, [{ptrs}, #0]", "blx r4", // connect_internal_flash() @@ -207,14 +210,14 @@ pub mod flash { // Registers r8-r15 are not allocated automatically, // so assign them manually. We need to use them as // otherwise there are not enough registers available. - in("r8") addr, - in("r9") data.map(|d| d.as_ptr()).unwrap_or(core::ptr::null()), - in("r10") len, - out("r0") _, - out("r1") _, - out("r2") _, + in("r0") addr, + in("r2") data.map(|d| d.as_ptr()).unwrap_or(core::ptr::null()), + in("r1") len, out("r3") _, out("r4") _, + lateout("r8") _, + lateout("r9") _, + lateout("r10") _, clobber_abi("C"), ); }