The APSR (Application Program Status Register) test detects stuck-at faults in the APSR bits that are implemented and writable on the core: the condition flags N, Z, C, and V, and, where the core has them, the sticky saturation flag Q and the greater-than-or-equal flags GE[3:0].
The test performs the following major tasks:
1) Saves the APSR value.
2) Writes a known pattern to the writable APSR bits, checks the N, Z, C, and V
flags with conditional branches, reads APSR back, masks the result to the
implemented bits, and compares it with the pattern.
3) Repeats step 2 with the complementary pattern, so that every tested bit is
checked at 0 and at 1.
4) Restores the saved APSR value, and checks the restored value.
The tested bits depend on the core, and are selected at compile time:
| Core | Tested bits |
|---|---|
| Armv6-M and Armv8-M Baseline (Cortex-M0+, M23) | N, Z, C, V |
| Armv7-M (Cortex-M3) | N, Z, C, V, Q |
| Cores with the DSP extension (Cortex-M4, M7, M33) | N, Z, C, V, Q, GE |
API Reference | |
| Functions | |