The section on atomic access gets some important things wrong about Cortex-M. Here's the language:
Atomic Access
On some platforms, special atomic instructions are available, which provide
guarantees about read-modify-write operations. Specifically for Cortex-M: thumbv6
(Cortex-M0, Cortex-M0+) only provide atomic load and store instructions,
while thumbv7 (Cortex-M3 and above) provide full Compare and Swap (CAS)
instructions. These CAS instructions give an alternative to the heavy-handed
disabling of all interrupts: we can attempt the increment, it will succeed most
of the time, but if it was interrupted it will automatically retry the entire
increment operation. These atomic operations are safe even across multiple
cores.
- The Cortex-M0, Cortex-M0+ does not have atomic load and store. These processors must use critical sections.
- Cortex-M3 and and above have atomic load and store via the
LDREX\STREX instructions.
- Atomic load/store will work across processors if the implementer has included an exclusive access monitor. At the time of this writing, NXP and ST Micro do not implement this feature.
- LDREX/STREX do not retry automatically.
Proposed language
Some platforms include special atomic instructions to guarantee read-modify-write operations. Within the Cortex-M family, thumbv6 (Cortex-M0, Cortex-M0+) must make use of critical sections. thumbv7 (Cortex-M3 and above) include atomic load and store (LDREX/STREX) instructions. These instructions are an alternative to the heavy-handed disabling of all interrupts: we can attempt the increment, it will succeed most of the time, but if it was interrupted the firmware can automatically retry the entire increment operation. These atomic may be supported across multiple cores. Check your device reference manual for more details.
The section on atomic access gets some important things wrong about Cortex-M. Here's the language:
Atomic Access
On some platforms, special atomic instructions are available, which provide
guarantees about read-modify-write operations. Specifically for Cortex-M:
thumbv6(Cortex-M0, Cortex-M0+) only provide atomic load and store instructions,
while
thumbv7(Cortex-M3 and above) provide full Compare and Swap (CAS)instructions. These CAS instructions give an alternative to the heavy-handed
disabling of all interrupts: we can attempt the increment, it will succeed most
of the time, but if it was interrupted it will automatically retry the entire
increment operation. These atomic operations are safe even across multiple
cores.
LDREX\STREXinstructions.Proposed language
Some platforms include special atomic instructions to guarantee read-modify-write operations. Within the Cortex-M family,
thumbv6(Cortex-M0, Cortex-M0+) must make use of critical sections.thumbv7(Cortex-M3 and above) include atomic load and store (LDREX/STREX) instructions. These instructions are an alternative to the heavy-handed disabling of all interrupts: we can attempt the increment, it will succeed most of the time, but if it was interrupted the firmware can automatically retry the entire increment operation. These atomic may be supported across multiple cores. Check your device reference manual for more details.