1.46 CLASSB_FlashCRCTest

Function

CLASSB_TEST_STATUS CLASSB_FlashCRCTest(uint32_t start_addr, uint32_t test_size, uint32_t crc_val, bool running_context);

Summary

This self-test checks the internal Flash program memory to detect single bit faults.

Description

This self-test generates CRC-32 checksum for the given memory area and compares it with the expected checksum.

Precondition

None.

Parameters

start_addr - Starting address of the memory block.

test_size - Size of the memory block.

crc_val - Expected CRC-32 checksum.

running_context - False for startup test. True for run-time test.

Returns

CLASSB_TEST_STATUS - Status of the test.

Example

CLASSB_TEST_STATUS classb_test_status = CLASSB_TEST_NOT_EXECUTED;
// Perform run-time test of the internal Flash
classb_test_status = CLASSB_FlashCRCTest(0, 0xFE000, *(uint32_t *)FLASH_CRC32_ADDR, true);

Remarks

This self-test can be used during startup as well as run-time. If a failure is detected, this self-test remains in an infinite loop to avoid unsafe code execution.