主题中讨论的其他器件:C2000WARE
您好!
我一直在尝试使用为加载到闪存中的程序保留的地址创建校验和。 程序的位置位于以下寄存器中、具有以下长度:
FLASHB:origin = 0x082000,length = 0x002000 /*片上闪存*/
FLASHC:origin = 0x084000,length = 0x002000 /*片上闪存*/
FLASHD:origin = 0x086000,length = 0x002000 /*片上闪存*/
FLASHE:origin = 0x088000,length = 0x008000 /*片上闪存*/
然后、我已经尝试使用 C2000Ware 中提供的闪存 API、代码如下:
UINT32 Flash1Start = 0x20000008;
UINT32 Flash2Start = 0x40000008;
UINT32 Flash3Start = 0x60000008;
UINT32 Flash4Start = 0x80000008;
UINT16 FlashLength = 0x002000;
UINT16 FlashLength2 = 0x008000;
Fapi_initializeAPI (F021_CPU0_BASE_ADDRESS、200);
while (Fapi_checkFsmForReady()!= Fapi_Status_Fsm {}
G_structMeterData.Chksum_1 = Fapi_calculateFletcherChecksum (&Flash1Start、FlashLength);
G_structMeterData.Chksum_2 = Fapi_calculateFletcherChecksum (&Flash2Start、FlashLength);
G_structMeterData.Chksum_3 = Fapi_calculateFletcherChecksum (&Flash3Start、FlashLength);
G_structMeterData.Chksum_4 = Fapi_calculateFletcherChecksum (&Flash4Start、FlashLength2);
但我注意到 Fapi_calculateFletcherChecksum 有两个输入都是 uint16。 我假设这意味着它将我的32位地址转换为16位、因为当我对 main.c 进行更改时、它不会被视为校验和的更改。
考虑到这一点、我进入了 Fapu_calculateFletcherChecksum 函数、并将第一个输入更改为接受 Uint32... 在进行此更改之后、 g_structMeterData.Chksum_1 g_structMeterData.Chksum_2 g_structMeterData.Chksum_3 都是静态的、但每次使用调试器加载代码时、 g_structMeterData.Chksum_4都具有不同的值。
我的方向是否正确?或者我应该选择哪条不同的路线?
谢谢!
伊坦