主题中讨论的其他器件:C2000WARE
当 F28374S 在线升级时、升级将失败。 具体过程如下:
F28374S 引导程序说明:
1) F021_API_F2837xS_FPU32.lib 被分配到引导 RAM 区域。
2)应用和引导的系统时钟均为200MHz。
3)目前,当定位升级失败时,程序运行到 Fapi_setActiveFlashBank()函数,并且 Fapi_setActiveFlashBank 的返回值不等于 Fapi_Status_Success ,导致引导程序执行终止。
4) 4) Init_Flash_sectors 函数会分配给引导 RAM 区域。
启动代码如下:
void initial_Boot (void)
{
BootInitialSystem();
init_Flash_sectors ();
BootFlashUpdate();
}
静态空 BootInitialSystem (void)
{
Volatile UINT16 temp;
UINT16 I;
易失性结构 SCI_REGS * pBootComSciRegs;
pBootComSciRegs =&ScicRegs;
//禁用看门狗模块
Dint;
EALLOW;
Temp = WdRegs.WDCR.All & 0x0007;
WdRegs.WDCR.all = 0x0068 | temp;
EDIS;
Example_Memcopy (&FlashAPILoadStart、&FlashAPILoadEnd、&FlashAPIRunStart);
BootInitSysPll (XTAL_OSC、IMULT_20、FMULT_0、PLLCLK_BY_2);
BootInitPeripheralClocks();
BootInitGpio();
BootGPIO_SetupPinMux (43、GPIO_MUX_CPU1、0);
BootGPIO_SetupPinOptions (43、GPIO_output、GPIO_PushPull);
GpioDataRegs.GPBCLEAR .bit.GPIO43 = 1;
BootGPIO_SetupPinMux (90、GPIO_MUX_CPU1、6);
BootGPIO_SetupPinOptions (90、GPIO_input、GPIO_PushPull);
BootGPIO_SetupPinMux (89、GPIO_MUX_CPU1、6);
BootGPIO_SetupPinOptions (89、GPIO_output、GPIO_ASYNC);
BootGPIO_SetupPinMux (94、GPIO_MUX_CPU1、6);
BootGPIO_SetupPinOptions (94、GPIO_input、GPIO_PushPull);
BootGPIO_SetupPinMux (93、GPIO_MUX_CPU1、6);
BootGPIO_SetupPinOptions (93、GPIO_output、GPIO_ASYNC);
pBootComSciRegs->SCIFFTX.ALL = 0xA000;
pBootComSciRegs->SCIFFRX.ALL = 0x201F;//启用 SCIB_RXINT、FIFO 级别为1
pBootComSciRegs->SCIFFCT.all = 0;
pBootComSciRegs->SCICTL1.bit.SWRESET =0;
for (I=0;I<20;I++);
pBootComSciRegs->SCICTL1.bit.SWRESET = 1;
//对 sci 进行初始化
// 1个停止位,无奇偶校验,8位字符
//无回送
pBootComSciRegs->SCICCR.all =0x0007; // 1个停止位、 无回送
//无奇偶校验,8个字符位,
//异步模式,空闲线协议
pBootComSciRegs->SCICTL1.all =0x0003; //启用 TX、RX、内部 SCICLK、
//禁用 RX ERR、睡眠、TXWAKE
pBootComSciRegs->SCICTL2.all = 0;
pBootComSciRegs->SCIHBAUD.all = 0; //频带= 38400
pBootComSciRegs->SCILBAUD.all = 64;//ARM_BAUD&0x00ff;
pBootComSciRegs->SCICTL1.all =0x0023; //从复位中撤回 SCI
}
//
// Init_Flash_Sectors -初始化闪存扇区
//
静态空 Init_Flash_Sectors (void)
{
Fapi_StatusType oReturnCheck;
EALLOW;
Flash0EccRegs.ECC_ENABLE_bit.enable = 0x0;
oReturnCheck = Fapi_initializeAPI (F021_CPU0_W0_BASE_ADDRESS、200);
if (oReturnCheck!= Fapi_Status_Success)
{
__ asm (" ESTOP0" );
}
oReturnCheck = Fapi_setActiveFlashBank (Fapi_FlashBank0);
if (oReturnCheck!= Fapi_Status_Success)
{
__ asm (" ESTOP0" );
}
Flash0EccRegs.ECC_ENABLE_bit.enable = 0xA;
EDIS;
}
