# NVM：地址0x08010000处发生不可纠正的ECC错误，检测到数据损坏

- **ID:** `embedded/nvm-ecc-uncorrectable-error`
- **领域:** embedded
- **类别:** data_error
- **验证级别:** ai_generated
- **修复率:** 78%

## 根因

闪存单元发生多次位翻转，超出ECC纠错能力（SEC-DED），表明永久性硬件退化或辐射引起的单粒子翻转。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| STM32Cube_FW_G4 v1.5.0 | active | — | — |
| ARM GCC v13.2.1 | active | — | — |
| HAL NVM driver v1.0.0 | active | — | — |

## 解决方案

1. ```
   映射出坏闪存扇区：使用闪存控制器将扇区标记为坏块表中的坏块，然后将应用程序数据重定位到备用扇区。示例：HAL_FLASHEx_Erase()擦除该扇区并将其地址存储在专用坏块区域中。
   ```
2. ```
   对关键数据使用Reed-Solomon码实现软件ECC，并在ECC错误时重试读取，从存储在单独扇区中的冗余副本重建数据。
   ```

## 无效尝试

- **Re-flash the entire firmware to overwrite corrupted data** — Re-flashing writes new data but does not repair the underlying bad flash cell; ECC error will recur at same address. (90% 失败率)
- **Disable ECC checking in flash controller** — Disabling ECC allows silent data corruption to propagate, leading to undefined behavior and potential system crashes. (95% 失败率)
