diff --git a/loader/LibExt/LIBExt_src/Ctrl_Flow/bl_func.c b/loader/LibExt/LIBExt_src/Ctrl_Flow/bl_func.c index 274dc7dcb..fbdaf9005 100755 --- a/loader/LibExt/LIBExt_src/Ctrl_Flow/bl_func.c +++ b/loader/LibExt/LIBExt_src/Ctrl_Flow/bl_func.c @@ -115,6 +115,8 @@ static LDR_RECOVERY_TRIGGER_CB gRecoveryTriggerCallBack = NULL; //#if (STORAGE_EXT_TYPE != STORAGE_EXT_USB) //static BOOL g_is_recovery_triggered = FALSE; // indicate recovery flow is triggered. //#endif + + _THUMB2 static int bl_is_smp(unsigned char *p_fdt); static UINT32 g_uiStartBlkUpdateFW = StartNandBlkUpdateFW; static UINT32 g_uiNandBlkSize = 0; @@ -2963,6 +2965,7 @@ _THUMB2 static unsigned int bl_process_flash_boot(unsigned char *p_tmp, DRAM_PAR if (er != 0) { bl_displayErrMsg("boot uboot failed\r\n"); } + } #endif else { @@ -3143,53 +3146,10 @@ _THUMB2 UINT32 bl_mainFlow(void) // rtc reset shutdown timer // rtc_resetShutDownTimer(); - - - -#if 0 - // adjust PAD driving (if required) - bl_adjustDriving(); - /* - - @b RTC_PWR_SW_STS: Power on source is PWR_SW - - @b RTC_PWR_VBAT_STS: Power on source is PWR_VBAT - - @b RTC_PWR_VBUS_STS: Power on source is PWR_VBUS - */ - uiPowerOnSrc = rtc_getPWRONSource(); - - if (uiPowerOnSrc & RTC_PWR_SW_STS) { - uart_putSystemUARTStr("\r\nSW PON\r\n"); - } else if (uiPowerOnSrc & RTC_PWR_VBAT_STS) { - uart_putSystemUARTStr("\r\nVBAT PON\r\n"); - } else if (uiPowerOnSrc & RTC_PWR_VBUS_STS) { - uart_putSystemUARTStr("\r\nVBUS PON\r\n"); - } else if (rtc_getIsAlarmPowerOn()) { - uart_putSystemUARTStr("\r\nPwrAlarm PON\r\n"); - } else { - uart_putSystemUARTStr("\r\nPOR PON\r\n"); - } -#endif - // Display Loader Version + // Display Loader Version debug_msg((char *)LOADER_START_STR); UTL_setDrvTmpBufferAddress(uiTmpBufferAddr); - -#if 0 // for now, reduce code size - if (rtc_chkS3boot()) { - UINT32 resume_addr; - - uart_putSystemUARTStr("main selfing..\r\n"); - resume_addr = bl_resume_cpu1((unsigned char *)_BOARD_IPC_ADDR_); - if (resume_addr == 0) { - // in codition for MODELEXT_BUILT_IN_ON - resume_addr = RESUME_ADDR; - } - return resume_addr; - } else { - - uart_putSystemUARTStr("main not selfing..\r\n"); - } -#endif - #if 0 // Sample to hook spi flash extending function flash_installIdentifyCB(bl_spiIdentify); @@ -3234,38 +3194,11 @@ _THUMB2 UINT32 bl_mainFlow(void) uiLoaderFunc |= FUNC_RUN_CARD; } else if ((int_strg_obj->flash_getBlockSize() == EMMC_BLOCK_SIZE) && gRecoveryTriggerCallBack && gRecoveryTriggerCallBack()) { debug_msg("Recovery triggered not support currently.\r\n"); -#if 0 - // open flash - if (bl_flash_open() != 0) { - bl_displayErrMsg("flash open failed\r\n"); - } else { - flash_mount_fs(0, BaseOfStack + 0x4000, FAT_HEAP_BUFFER_SIZE); - if (flash_mount_partition(g_uiPartitionID) == E_OK) { - if (flash_open_file(RECOVERY_FW_NAME) == TRUE) { - NVTPACK_MEM mem_in ; - flash_read_file((UINT8 *)uiUpdateMainBinBufAddr, SIZE_PRELOAD); - mem_in.p_data = (void *)uiUpdateMainBinBufAddr; - mem_in.len = uiUpdateFileLen; - // all in one bin - if (bl_chk_valid_all_in_one(&mem_in) == 0) { - // Read all - uiUpdateFileLen = flash_read_file((UINT8 *)uiUpdateMainBinBufAddr, FAT_READ_TOTAL_FILE_LENGTH); - uiLoaderFunc |= FUNC_UPDATE_FW; - g_is_recovery_triggered = TRUE; - } else { - debug_msg("Recovery should be all in one bin!\r\n"); - } - } else { - debug_msg("no recovery bin!\r\n"); - } - } else { - debug_msg("Partition error!\r\n"); - } - } -#endif + } #if 1 else if ((gSpecialKeyCallBack(ota_flag)) && (gCardDetectCallBack())) { + if (card_open() == TRUE && fat_initFAT(uiheapBufferAddr, FAT_HEAP_BUFFER_SIZE) == TRUE) { #if UPDATE_SIM_CODE BOOL bWDTInit = UTL_canUpdateSecKey(); @@ -3326,102 +3259,7 @@ _THUMB2 UINT32 bl_mainFlow(void) } // Run FW has lower priority else if (fat_open_rootfile(RUN_FW_NAME) == TRUE) { - NVTPACK_MEM mem_in ; - uiUpdateFileLen = fat_read_rootfile((UINT8 *)uiUpdateMainBinBufAddr, SIZE_PRELOAD); - mem_in.p_data = (void *)uiUpdateMainBinBufAddr; - mem_in.len = uiUpdateFileLen; - if (bl_chk_valid_all_in_one(&mem_in) == 0) { - // Read all - uiUpdateFileLen = fat_read_rootfile((UINT8 *)uiUpdateMainBinBufAddr, FAT_READ_TOTAL_FILE_LENGTH); - } else { - // Read rtos - unsigned int adjusted_addr = 0; - unsigned int adjusted_size = 0; - if (bl_load_rtos_from_non_nvtpack(uiUpdateMainBinBufAddr, uiUpdateFileLen, &adjusted_addr, &adjusted_size) != 0) { - bl_displayErrMsg("invalid firmware"); - } else { - uiFwBaseAddr = adjusted_addr; //fix compressed fit bl_checkDramScanFW() after copy its to temp area, see commit log - uiUpdateFileLen = adjusted_size; - } - uiLoaderFunc |= FUNC_RUN_CARD; - } - fat_close_rootfile(); - debug_msg("\r\n"); // for line end RRRRRRR.... - uiLoaderFunc |= FUNC_RUN_CARD; - } -#if UPDATE_SIM_CODE - } -#endif - debug_msg("card close\r\n"); - card_close(); - } else { - debug_msg("card open fail\r\n"); -// while (1); - } - } -#endif -#if 0 - else if (((gCardDetectCallBack == NULL) || gCardDetectCallBack())) - { - debug_msg("sf gCardDetectCallBack gCardDetectCallBack\r\n"); - if (card_open() == TRUE && fat_initFAT(uiheapBufferAddr, FAT_HEAP_BUFFER_SIZE) == TRUE) { -#if UPDATE_SIM_CODE - BOOL bWDTInit = UTL_canUpdateSecKey(); - if (bWDTInit && fat_open_rootfile(RUN_WRKEY_NAME) == TRUE) { - debug_msg("sim.bin exist\r\n"); // the others A or T are skipped. - // Read byte count specified in file directory entry - uiUpdateFileLen = fat_read_rootfile((UINT8 *)uiUpdateMainBinBufAddr, FAT_READ_TOTAL_FILE_LENGTH); - fat_close_rootfile(); - debug_msg("\r\n"); // for line end RRRRRRR.... - uiLoaderFunc |= FUNC_RUN_WRBIN; - } else { // exclude others update if FUNC_RUN_WRBIN is existing. -#endif - // Update loader or not, loader is fixed to 16 KB - if (fat_open_rootfile(UPDATE_LOADER_NAME) == TRUE) { - // Read byte count specified in file directory entry - fat_read_rootfile((UINT8 *)uiUpdateBootloaderBufAddr, FAT_READ_TOTAL_FILE_LENGTH); - fat_close_rootfile(); - debug_msg("\r\n"); // for line end RRRRRRR.... - debug_msg("sf ld\r\n"); // for line end RRRRRRR.... - uiLoaderFunc |= FUNC_UPDATE_LOADER; - uiLoaderSize = *((UINT32 *)(uiUpdateBootloaderBufAddr + 0x24)); - } - // "Update FW" or "Run FW" function - // Update FW has higher priority - if (fat_open_rootfile(UPDATE_FW_NAME) == TRUE) { - NVTPACK_MEM mem_in ; - fat_read_rootfile((UINT8 *)uiUpdateMainBinBufAddr, SIZE_PRELOAD); - mem_in.p_data = (void *)uiUpdateMainBinBufAddr; - mem_in.len = uiUpdateFileLen; - // all in one bin - debug_msg("sf fw\r\n"); // for line end RRRRRRR.... - if (bl_chk_valid_all_in_one(&mem_in) == 0) { - // Read all - uiUpdateFileLen = fat_read_rootfile((UINT8 *)uiUpdateMainBinBufAddr, FAT_READ_TOTAL_FILE_LENGTH); - uiLoaderFunc |= FUNC_UPDATE_FW; - } else { - // only rtos - debug_msg("not all-in-one, force behavior as T bin.\r\n"); - adjusted_addr = 0; - adjusted_size = 0; - if (bl_load_rtos_from_non_nvtpack(uiUpdateMainBinBufAddr, uiUpdateFileLen, &adjusted_addr, &adjusted_size) == 0) { - uiFwBaseAddr = adjusted_addr; //fix compressed fit bl_checkDramScanFW() after copy its to temp area, see commit log - uiUpdateFileLen = adjusted_size; - } else { - bl_displayErrMsg("invalid firmware"); - } -#if UPDATE_EMU_CODE - uiLoaderFunc |= FUNC_UPDATE_FW; -#else - uiLoaderFunc |= FUNC_RUN_CARD; -#endif - } - fat_close_rootfile(); - debug_msg("\r\n"); // for line end RRRRRRR.... - } - // Run FW has lower priority - else if (fat_open_rootfile(RUN_FW_NAME) == TRUE) { NVTPACK_MEM mem_in ; uiUpdateFileLen = fat_read_rootfile((UINT8 *)uiUpdateMainBinBufAddr, SIZE_PRELOAD); mem_in.p_data = (void *)uiUpdateMainBinBufAddr; @@ -3454,7 +3292,7 @@ _THUMB2 UINT32 bl_mainFlow(void) #if UPDATE_SIM_CODE } #endif - card_close(); + card_close(); } else { debug_msg("card open fail\r\n"); // while (1);