各位好,在实现用户编写的BOOTLOADER的过程中,发现关于FLASH的两个问题,具体如下:
1、开始的引导位置问题。在编写CMD文件过程中,如果 BEGIN从扇区A\B开始,程序正常运行,但是将 BEGIN从扇区E开始,则程序无法实现引导?
BEGIN : origin = 0x088000, length = 0x000002
2、当完成用户APP的FLASH烧写后,在扇区B烧写了一个状态值,然后跳转到用户APP,程序正常执行,但是当板子重新上电后,在读取扇区B的状态值时,会导致DSP复位,程序重新执行,读取扇区C不存在该问题。查看FLASH的值,扇区B\C均烧写正常(不知啥原因,附不上图片)。
主程序如下:
uint32_t main(void)
{
Uint16 *Flash_ptr;
//SCIA Flush
while (!SciaRegs.SCICTL2.bit.TXEMPTY) {
}
// Step 1. Initialize System Control:
// Enable Peripheral Clocks
// This example function is found in the F2837xD_SysCtrl.c file.
InitSysCtrl(); //PLL activates
// Step 2. Initialize GPIO:
// This example function is found in the F2837xD_Gpio.c file and
// illustrates how to set the GPIO to it's default state.
InitGpio();
// For this example, only init the pins for the SCI-A port.
// GPIO_SetupPinMux() - Sets the GPxMUX1/2 and GPyMUX1/2 register bits
// GPIO_SetupPinOptions() - Sets the direction and configuration of the GPIOS
// These functions are found in the F2837xD_Gpio.c file.
GPIO_SetupPinMux(28, GPIO_MUX_CPU1, 1);
GPIO_SetupPinOptions(28, GPIO_INPUT, GPIO_PUSHPULL);
GPIO_SetupPinMux(29, GPIO_MUX_CPU1, 1);
GPIO_SetupPinOptions(29, GPIO_OUTPUT, GPIO_ASYNC);
/*// Step 3. Clear all interrupts and initialize PIE vector table:
// Disable CPU interrupts
DINT;*/
// Initialize the PIE control registers to their default state.
// The default state is all PIE interrupts disabled and flags
// are cleared.
// This function is found in the F2837xD_PieCtrl.c file.
InitPieCtrl();
// Disable CPU interrupts and clear all CPU interrupt flags:
IER = 0x0000;
IFR = 0x0000;
InitIpc();
InitFlash();
// Gain pump semaphore
SeizeFlashPump();
EALLOW;
SciaRegs.SCIFFTX.all = 0x8000;
scia_fifo_init(); // Initialize the SCI FIFO
scia_init(); // Initialize SCI for echoback
SCI_SendStatus("\n\n\r Communication kernel received and executing.");
SCI_SendStatus("\n\r Type 'a' to relock baud-rate: ");
SCIA_AutobaudLock();
EDIS;
SCI_SendStatus("\n\n\r*** baud-rate relocked ***");
SCI_SendStatus("\n\r Processor is unlocked.");
Flash_ptr = 0x82000;
/* check for update the App */
// if(m_Calibration_Parameter.u16_Calibration_Status == 0x0011)
if(*Flash_ptr == 0x0011)
{
SCI_SendStatus("\n\r ***** Start to implement APP ****** \n\r");
(*AppCode)();
}
/* Implement the Kernel */
else
{ /* implement the CKFA */
SCI_SendStatus("\n\r ***** Start to implement Bootloader ****** \n\r");
cBootloader();
}
while (1) {
}
}
麻烦群里的朋友,帮忙答疑一下,万分感谢。