Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions cortex-m/src/asm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ pub fn delay(cycles: u32) {
let real_cycles = 1 + cycles / 2;
unsafe {
asm!(
// The `bne` on some cores (eg Cortex-M4) will take a different number of instructions
// depending on the alignment of the branch target. Set the alignment of the top of the
// loop to prevent surprising timing changes when the alignment of the delay() changes.
".p2align 3",
// Use local labels to avoid R_ARM_THM_JUMP8 relocations which fail on thumbv6m.
"1:",
"subs {}, #1",
Expand Down