Other Parts Discussed in Thread: UCD3138, UCD3138128
Tool/software:
Dear Sirs,
I have a question to ask: Due to CRPS2.0 requirements, I need to develop a bootloader. Currently, the firmware download and Flash write operations are functioning properly, and the application (APP) can run independently. However, after the bootloader disables interrupts and jumps to the APP (located at Flash partition 0x2000-0xFFFF, while the bootloader occupies 0x0000-0x1FFF), the APP fails to work correctly. What critical steps should the bootloader perform before handing control to the APP?
The code of bootload was show as blew:
void main()
{
MiscAnalogRegs.CLKTRIM.bit.HFO_LN_FILTER_EN = 0;
read_dflash_Modelname_message();
read_dflash_upload_message();
volatile Uint32 check_sum=*(volatile Uint32 *)0x0000fffc;
if((BootLoaderStructRam.UpdateMode==0)&&(check_sum==(calculate_checksum(0,0xfffc))))
{
JumpToApp(FLASHPROGRAMBASE); //0x2000
}
else
{
FirmwareUpdate_Handler();
}
}
typedef void (*AppEntry)(void);
void JumpToApp(Uint32 app_address)
{
disable_interrupt();
disable_fast_interrupt();
AppEntry app_entry = (AppEntry)(*(volatile Uint32*)app_address);
app_entry();
}