This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
您好!
您可以使用 F021闪存 API 向闪存写入密钥或标志。 在写入闪存之前、需要首先擦除闪存扇区。 您不能向内容不是0xFFFFFFFF 的闪存位置写入值。
请参阅 DCAN 引导加载程序:
http://software-dl.ti.com/hercules/hercules_docs/latest/hercules/Examples/Examples.html#bootloader
bl_flash.c:调用闪存 API 以擦除闪存并将数据写入闪存的函数
FLASH_defines.h:闪存扇区定义
BL_DCAN.c 的第629行是将状态写入闪存:
oReturnCheck = Fapi_UpdateStatusProgram (g_ulUpdateStatusAddr、(uint32_t)&g_pulUpdateSuccesss[0]、g_ulUpdateBufferSize);
您可以参阅引导加载程序代码中使用的示例。 如果标志不是魔术词、则图像将被覆盖。 如果已对魔术字进行编程、则可以跳过图像编程、或者可以将图像编程到其他位置:
例如:
//检查是否需要更新
if (0 = CheckGPIOForceUpdate()&&(*(uint32_t *) app_status_address)= 0x5A5A5A5A)
{
//跳过覆盖,跳转到应用程序
G_ulTransferAddress =(uint32_t) APP_START_ADDRESS;
((void (*)(void)) g_ulTransferAddress)();
}否则{
//对图像进行编程
一
}