From b5c509d6789894bf474c9b422b85895bf5c1ccc0 Mon Sep 17 00:00:00 2001 From: payton Date: Wed, 27 Dec 2023 10:28:35 +0800 Subject: [PATCH] =?UTF-8?q?1.loader=E4=BF=AE=E5=A4=8D=E5=8D=87=E7=BA=A7fw?= =?UTF-8?q?=E5=8C=85=E7=BC=BA=E5=B0=91=E6=97=B6=E9=87=8D=E6=96=B0=E5=90=AF?= =?UTF-8?q?=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- loader/LibExt/LIBExt_src/Ctrl_Flow/bl_func.c | 39 ++++++++++++-------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/loader/LibExt/LIBExt_src/Ctrl_Flow/bl_func.c b/loader/LibExt/LIBExt_src/Ctrl_Flow/bl_func.c index bcf7c3a6e..c40c15e04 100755 --- a/loader/LibExt/LIBExt_src/Ctrl_Flow/bl_func.c +++ b/loader/LibExt/LIBExt_src/Ctrl_Flow/bl_func.c @@ -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)); // load fdt - er = bl_load_fdt_from_all_in_one((unsigned char *)uiFwBuf, uiFwBufSize, &p_fdt); - if (er == -2) { // try to load from nand - debug_msg("fdt from flash.\r\n"); - // open flash - if (bl_flash_open() != 0) { // dont move flash open outside section, consider that T without flash device. - 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"); - } - } + er = bl_load_fdt_from_all_in_one((unsigned char *)uiFwBuf, uiFwBufSize, &p_fdt); + if (er == -2) { // try to load from nand + debug_msg("fdt from flash.\r\n"); + // open flash + if (bl_flash_open() != 0) { // dont move flash open outside section, consider that T without flash device. + 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"); + } + } + else if (er == -1){ + return 0; + } // update loader flag bl_update_loader_flag(p_fdt, uiLoaderFunc); if (uiLoaderFunc & FUNC_UPDATE_FW) { @@ -3501,6 +3503,12 @@ _THUMB2 UINT32 bl_mainFlow(void) bl_displayErrMsg("cannot process all-in-one fw"); #else 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 } else { // non-all-in-one flow @@ -3571,6 +3579,7 @@ _THUMB2 UINT32 bl_mainFlow(void) } #else +BOOT_FROM_FLASH: uiFwBaseAddr = bl_process_flash_boot((UINT8 *)SDRAM_Start_FW, &p_dram_partition, uiLoaderFunc, &comp_addr, &comp_size); if (comp_addr == 0) { uiUpdateMainBinBufAddr = uiFwBaseAddr;