Hardware Abstraction Layer (HAL)
NVM (Onboard Non-Volatile Memory)

Blank check

mtb_hal_nvm_is_blank() reports whether a region is fully erased without ever escalating a partially-erased cell into a CPU fault. The erased state is determined with the SROM hardware blank check, which never reads the flash through the CPU bus and is therefore safe on partially-erased cells.

Corruption probe

mtb_hal_nvm_is_sector_corrupt() detects a non-correctable ECC / bus-access fault left behind by an interrupted erase. All device-specific register handling (fault-structure arming, silent mode and cache maintenance) is done internally, and the region is never read in a way that would escalate a detected error into a CPU fault. A blank region, and any memory without per-word ECC, is reported as not corrupt.

Note
mtb_hal_nvm_is_sector_corrupt() transiently weakens global fault state and shares FAULT_STRUCT0, so the caller must invoke it with interrupts disabled and serialized against all other NVM operations.
Collaboration diagram for NVM (Onboard Non-Volatile Memory):