| | |
| | | *******************************************************************************/ |
| | | #include "MCUFlash.h" |
| | | #include "stm32h7xx_hal.h" |
| | | #include "HIDO_Debug.h" |
| | | |
| | | /******************************************************************************* |
| | | * Macro * |
| | |
| | | HIDO_UINT32 remaining = _u32WriteLen; |
| | | HIDO_UINT32 addr = _u32WriteAddr; |
| | | HIDO_UINT8 const *src = _pu8WriteData; |
| | | HIDO_UINT8 wordBuf[MCU_FLASH_WORD_BYTES]; |
| | | |
| | | /* 使用32位数组确保4字节对齐,避免HAL_FLASH_Program中出现非对齐访问导致的HardFault */ |
| | | HIDO_UINT32 wordBuf32[MCU_FLASH_WORD_BYTES / 4]; |
| | | HIDO_UINT8 *wordBuf = (HIDO_UINT8 *)wordBuf32; |
| | | |
| | | while (remaining > 0) |
| | | { |