1.loader修复升级fw包缺少时重新启动

This commit is contained in:
payton 2023-12-27 10:28:35 +08:00
parent 142b18a7e9
commit b5c509d678

View File

@ -2744,22 +2744,24 @@ _THUMB2 unsigned int bl_process_all_in_one(UINT32 uiFwBuf, UINT32 uiFwBufSize, D
unsigned char *p_tmp = (unsigned char *)(uiFwBuf + ALIGN_CEIL(uiFwBufSize, 4)); unsigned char *p_tmp = (unsigned char *)(uiFwBuf + ALIGN_CEIL(uiFwBufSize, 4));
// load fdt // load fdt
er = bl_load_fdt_from_all_in_one((unsigned char *)uiFwBuf, uiFwBufSize, &p_fdt); er = bl_load_fdt_from_all_in_one((unsigned char *)uiFwBuf, uiFwBufSize, &p_fdt);
if (er == -2) { // try to load from nand if (er == -2) { // try to load from nand
debug_msg("fdt from flash.\r\n"); debug_msg("fdt from flash.\r\n");
// open flash // open flash
if (bl_flash_open() != 0) { // dont move flash open outside section, consider that T without flash device. if (bl_flash_open() != 0) { // dont move flash open outside section, consider that T without flash device.
bl_displayErrMsg("flash open failed\r\n"); bl_displayErrMsg("flash open failed\r\n");
} }
//p_tmp for the case of all-in-one without fdt or uboot
unsigned char *p_tmp = (unsigned char *)(uiFwBuf + ALIGN_CEIL(uiFwBufSize, 4));
er = bl_load_fdt_from_flash(p_tmp, 0x2000000, &p_fdt); // dtb size less than 32MB to be safer.
if (er != 0) {
bl_displayErrMsg("load fdt failed\r\n");
}
}
//p_tmp for the case of all-in-one without fdt or uboot
unsigned char *p_tmp = (unsigned char *)(uiFwBuf + ALIGN_CEIL(uiFwBufSize, 4));
er = bl_load_fdt_from_flash(p_tmp, 0x2000000, &p_fdt); // dtb size less than 32MB to be safer.
if (er != 0) {
bl_displayErrMsg("load fdt failed\r\n");
}
}
else if (er == -1){
return 0;
}
// update loader flag // update loader flag
bl_update_loader_flag(p_fdt, uiLoaderFunc); bl_update_loader_flag(p_fdt, uiLoaderFunc);
if (uiLoaderFunc & FUNC_UPDATE_FW) { if (uiLoaderFunc & FUNC_UPDATE_FW) {
@ -3501,6 +3503,12 @@ _THUMB2 UINT32 bl_mainFlow(void)
bl_displayErrMsg("cannot process all-in-one fw"); bl_displayErrMsg("cannot process all-in-one fw");
#else #else
uiFwBaseAddr = bl_process_all_in_one(uiUpdateMainBinBufAddr, uiUpdateFileLen, &p_dram_partition, uiLoaderFunc, &comp_addr, &comp_size); uiFwBaseAddr = bl_process_all_in_one(uiUpdateMainBinBufAddr, uiUpdateFileLen, &p_dram_partition, uiLoaderFunc, &comp_addr, &comp_size);
if(uiFwBaseAddr == 0){
debug_err("bl_process_all_in_one failed, boot from flash\n");
uiLoaderFunc &= ~(FUNC_RUN_CARD | FUNC_UPDATE_FW);
uiLoaderFunc |= FUNC_RUN_FLASH;
goto BOOT_FROM_FLASH;
}
#endif #endif
} else { } else {
// non-all-in-one flow // non-all-in-one flow
@ -3571,6 +3579,7 @@ _THUMB2 UINT32 bl_mainFlow(void)
} }
#else #else
BOOT_FROM_FLASH:
uiFwBaseAddr = bl_process_flash_boot((UINT8 *)SDRAM_Start_FW, &p_dram_partition, uiLoaderFunc, &comp_addr, &comp_size); uiFwBaseAddr = bl_process_flash_boot((UINT8 *)SDRAM_Start_FW, &p_dram_partition, uiLoaderFunc, &comp_addr, &comp_size);
if (comp_addr == 0) { if (comp_addr == 0) {
uiUpdateMainBinBufAddr = uiFwBaseAddr; uiUpdateMainBinBufAddr = uiFwBaseAddr;