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

General Description

Functions

uint8_t SelfTest_SRAM (stl_sram_test_mode_t type, uint8_t *startAddr, uint32_t size, uint8_t *buffAddr, uint32_t buffSize)
 This function performs the self test on a block of RAM.
uint8_t SelfTest_SRAM_March_Full (uint32_t startAddress, uint32_t endAddress, uint32_t blockSize, uint32_t backupAddress, stl_sram_march_mode_t mode)
 Full SRAM test using March algorithm (assembly implementation, no stack usage during the test).
uint8_t SelfTest_SRAM_March_Runtime (uint32_t startAddress, uint32_t endAddress, uint32_t *currentAddress, uint32_t blockSize, uint32_t backupAddress, stl_sram_march_mode_t mode)
 Runtime SRAM test using March algorithm (assembly implementation, no stack usage during the test).

Function Documentation

◆ SelfTest_SRAM()

uint8_t SelfTest_SRAM ( stl_sram_test_mode_t type,
uint8_t * startAddr,
uint32_t size,
uint8_t * buffAddr,
uint32_t buffSize )

This function performs the self test on a block of RAM.

It can detect stuck-at faults and direct coupling faults. The RAM tests are destructible in nature, so the function also accepts a temporary buffer that can be used to store/restore memory block under test. The RAM block under test must not overlap with memory that is not supposed to be overwritten for e.g. stack. This kind of situation must be tested at the startup. Because of RAM destructible behavior, it is advisable to disable the interrupts before starting the test.

Parameters
typeThe type of RAM test to run.
startAddrThe pointer to the start of the RAM block to test.
sizeThe size of RAM block to test.
buffAddrThe pointer to the start of the buffer to use for store/restore data of RAM block to test. If NULL, test would be performed without store/restore being performed.
buffSizeThe size of the buffer, which is used for store/restore. If buffSize is smaller than the size, the test internally loops through the RAM block operating on memory size equal to buffSize in each iteration.
Returns
OK_STATUS (0) - Test passed
ERROR_STATUS (1) - Test failed

◆ SelfTest_SRAM_March_Full()

uint8_t SelfTest_SRAM_March_Full ( uint32_t startAddress,
uint32_t endAddress,
uint32_t blockSize,
uint32_t backupAddress,
stl_sram_march_mode_t mode )

Full SRAM test using March algorithm (assembly implementation, no stack usage during the test).

Tests the entire RAM range from startAddress to endAddress. The backup area is tested first to ensure its integrity.

This function is suitable for testing both variable RAM and stack regions because it does not use the stack during the March test execution.

Parameters
startAddressStart of RAM region to test (must be 4-byte aligned).
endAddressEnd of RAM region to test (must be 4-byte aligned).
blockSizeSize of each test block in bytes (must be 4-byte aligned).
backupAddressBackup area address. Must be outside the tested region and at least blockSize bytes.
modeMarch algorithm to use, see stl_sram_march_mode_t
Returns
OK_STATUS (0) - Test passed
ERROR_STATUS (1) - Test failed
Note
Interrupts should be disabled before calling this function.
Ensure no active DMA transfers to/from the test region during test.
All addresses and sizes MUST be 4-byte aligned. Unaligned values may cause HardFault or test beyond intended memory region.
No runtime parameter validation is performed. Ensure all parameters are valid before calling this function.
On devices with D-cache (XMC7000 series), disable the data cache before calling this function.
This function is compiler-specific. Supported compilers: GCC_ARM, ARM, and IAR.

◆ SelfTest_SRAM_March_Runtime()

uint8_t SelfTest_SRAM_March_Runtime ( uint32_t startAddress,
uint32_t endAddress,
uint32_t * currentAddress,
uint32_t blockSize,
uint32_t backupAddress,
stl_sram_march_mode_t mode )

Runtime SRAM test using March algorithm (assembly implementation, no stack usage during the test).

Tests one block per call for periodic runtime testing. Maintains test progress via currentAddress pointer.

When currentAddress equals startAddress, the backup area is tested. After testing the last block, currentAddress wraps back to startAddress.

This function is suitable for testing both variable RAM and stack regions because it does not use the stack during the March test execution.

Parameters
startAddressStart of RAM region to test (must be 4-byte aligned).
endAddressEnd of RAM region to test (must be 4-byte aligned).
currentAddressPointer to current test position. Initialize to startAddress before first call. Updated by the function to track progress. Wraps to startAddress after full range is tested.
blockSizeSize of each test block in bytes (must be 4-byte aligned).
backupAddressBackup area address. Must be outside the tested region and at least blockSize bytes.
modeMarch algorithm to use, see stl_sram_march_mode_t
Returns
OK_STATUS (0) - Test passed
ERROR_STATUS (1) - Test failed
Note
Interrupts should be disabled before calling this function.
Ensure no active DMA transfers to/from the test region during test.
All addresses and sizes MUST be 4-byte aligned. Unaligned values may cause HardFault or test beyond intended memory region.
No runtime parameter validation is performed. Ensure all parameters are valid before calling this function.
On devices with D-cache (XMC7000 series), disable the data cache before calling this function.
This function is compiler-specific. Supported compilers: GCC_ARM, ARM, and IAR.