We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 31a0e61 + 2e9892d commit 5bf528aCopy full SHA for 5bf528a
cortex-m/src/asm.rs
@@ -33,6 +33,10 @@ pub fn delay(cycles: u32) {
33
let real_cycles = 1 + cycles / 2;
34
unsafe {
35
asm!(
36
+ // The `bne` on some cores (eg Cortex-M4) will take a different number of instructions
37
+ // depending on the alignment of the branch target. Set the alignment of the top of the
38
+ // loop to prevent surprising timing changes when the alignment of the delay() changes.
39
+ ".p2align 3",
40
// Use local labels to avoid R_ARM_THM_JUMP8 relocations which fail on thumbv6m.
41
"1:",
42
"subs {}, #1",
0 commit comments