ModusToolbox Safety Test Library
Loading...
Searching...
No Matches

General Description

Functions

uint8_t SelfTest_CONTROL (void)
 This function tests the CONTROL register bits that are implemented and writable (SPSEL; also FPCA in FPU builds and SFPA in Secure FPU builds, unless SELFTEST_CONTROL_SKIP_FP_BITS is 1), and checks that the SPSEL bit switches the active stack pointer.

Function Documentation

◆ SelfTest_CONTROL()

uint8_t SelfTest_CONTROL ( void )

This function tests the CONTROL register bits that are implemented and writable (SPSEL; also FPCA in FPU builds and SFPA in Secure FPU builds, unless SELFTEST_CONTROL_SKIP_FP_BITS is 1), and checks that the SPSEL bit switches the active stack pointer.

The function masks interrupts for the duration of the test and restores the caller's PRIMASK value before it returns. NMI and HardFault can't be masked; if one of them occurs while PSP is selected, its exception frame is stacked on the library's test stack.

Note
Call this function only from privileged Thread mode. Otherwise it returns ERROR_INCORRECT_USAGE_STATUS without changing CONTROL.
If the function can't confirm that CONTROL, the stack pointer, and PSP were restored, it never returns: it stays in an endless loop with interrupts disabled. A watchdog must be running to reset the device in that case.
This test runs only in blocking mode.
Returns
OK_STATUS (0) - Test passed
ERROR_STATUS (1) - Test failed
ERROR_INCORRECT_USAGE_STATUS (4) - Called from Handler mode or from unprivileged Thread mode