Skip to content

Commit

Permalink
Add comment regarding LDREX, STREX and exception behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulStoffregen committed Sep 14, 2021
1 parent 1c101f3 commit f452eb4
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions teensy4/EventResponder.cpp
Expand Up @@ -348,6 +348,13 @@ extern "C" void systick_isr(void)
systick_millis_count++;
}

// Entry to any ARM exception clears the LDREX exclusive access flag.
// So we do not need to do anything with "systick_safe_read" here, as
// this code depends on this Cortex-M7 hardware feature to cause any
// STREX instruction to return 1 (fail status) after returning to
// main program or lower priority interrupts.
// https://developer.arm.com/documentation/dui0646/c/the-cortex-m7-processor/memory-model/synchronization-primitives

extern "C" void systick_isr_with_timer_events(void)
{
systick_cycle_count = ARM_DWT_CYCCNT;
Expand Down

0 comments on commit f452eb4

Please sign in to comment.