void Flash_Write(uint32_t address, uint32_t *data, uint32_t dataSize) {
HAL_FLASH_Unlock(); // 解锁Flash
for (uint32_t i = 0; i < dataSize; i++) {
// 写入数据
if (HAL_FLASH_Program(TYPEPROGRAM_WORD, address + (i * 4), data[i]) != HAL_OK) {
// 处理错误
}
}
HAL_FLASH_Lock(); // 锁定Flash
}
|