Skip to content

Commit

Permalink
Fix inline assembly for use with nightly
Browse files Browse the repository at this point in the history
  • Loading branch information
jannic committed Jul 9, 2022
1 parent dec5300 commit 9aa32ae
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -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"),
);
}
Expand Down

0 comments on commit 9aa32ae

Please sign in to comment.