Merge branch 'Branch_S550_Fast_Emmc' of 192.168.6.216:linux-em-group/s530-ntk into S550_Base
This commit is contained in:
commit
4bcefcbaad
|
@ -165,6 +165,7 @@ int nvt_process_rootfs_format(void);
|
||||||
int nvt_check_is_fw_update_fw(void);
|
int nvt_check_is_fw_update_fw(void);
|
||||||
int nvt_check_is_fomat_rootfs(void);
|
int nvt_check_is_fomat_rootfs(void);
|
||||||
int nvt_fs_set_blk_dev(void);
|
int nvt_fs_set_blk_dev(void);
|
||||||
|
int nvt_fs_set_blk_dev_emmc(void);
|
||||||
int nvt_process_sys_recovery(void);
|
int nvt_process_sys_recovery(void);
|
||||||
int nvt_flash_mark_bad(void);
|
int nvt_flash_mark_bad(void);
|
||||||
void nvt_shminfo_init(void);
|
void nvt_shminfo_init(void);
|
||||||
|
|
|
@ -47,6 +47,7 @@
|
||||||
((((UINT32)(data)) & 0x00FF0000) >> 8) | \
|
((((UINT32)(data)) & 0x00FF0000) >> 8) | \
|
||||||
((((UINT32)(data)) & 0xFF000000) >> 24)) ///< Swap [31:24] with [7:0] and [23:16] with [15:8].
|
((((UINT32)(data)) & 0xFF000000) >> 24)) ///< Swap [31:24] with [7:0] and [23:16] with [15:8].
|
||||||
static UINT32 g_LcdBl = TRUE;
|
static UINT32 g_LcdBl = TRUE;
|
||||||
|
static int curr_device = 1;
|
||||||
|
|
||||||
static int nvt_update_partitions(unsigned int addr, unsigned int size, u64 part_off, u64 PartitionSize)
|
static int nvt_update_partitions(unsigned int addr, unsigned int size, u64 part_off, u64 PartitionSize)
|
||||||
{
|
{
|
||||||
|
@ -2347,16 +2348,39 @@ int nvt_fw_update(bool firm_upd_firm)
|
||||||
} else if (p_shminfo->boot.LdCtrl2 & LDCF_BOOT_FLASH) {
|
} else if (p_shminfo->boot.LdCtrl2 & LDCF_BOOT_FLASH) {
|
||||||
return ERR_NVT_UPDATE_NO_NEED;
|
return ERR_NVT_UPDATE_NO_NEED;
|
||||||
} else {
|
} else {
|
||||||
if (nvt_fs_set_blk_dev())
|
|
||||||
|
/*added for emmc upgrade by greg*/
|
||||||
|
extern struct mmc *init_mmc_device(int dev, bool force_init);
|
||||||
|
struct mmc *mmc;
|
||||||
|
mmc = init_mmc_device(curr_device, false);
|
||||||
|
if (!mmc) {
|
||||||
|
printf("Get eMMc device failed\n\r");
|
||||||
return ERR_NVT_UPDATE_OPENFAILED;
|
return ERR_NVT_UPDATE_OPENFAILED;
|
||||||
else {
|
|
||||||
if (fs_size(get_nvt_bin_name(NVT_BIN_NAME_TYPE_FW), &size) < 0) {
|
|
||||||
return ERR_NVT_UPDATE_NO_NEED;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
typedef int (*set_blk_dev_cb)(void);
|
||||||
|
set_blk_dev_cb nvt_fs_set_blk_dev_cb = NULL;
|
||||||
|
|
||||||
|
if(nvt_fs_set_blk_dev() == 0 && fs_exists(get_nvt_bin_name(NVT_BIN_NAME_TYPE_FW))){
|
||||||
|
printf("***found fw bin in sd card******\n");
|
||||||
|
nvt_fs_set_blk_dev_cb = nvt_fs_set_blk_dev;
|
||||||
|
}
|
||||||
|
else if(nvt_fs_set_blk_dev_emmc() == 0 && fs_exists(get_nvt_bin_name(NVT_BIN_NAME_TYPE_FW))){
|
||||||
|
|
||||||
|
printf("***found fw bin in emmc*******\n");
|
||||||
|
nvt_fs_set_blk_dev_cb = nvt_fs_set_blk_dev_emmc;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
return ERR_NVT_UPDATE_OPENFAILED;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nvt_fs_set_blk_dev_cb() || fs_size(get_nvt_bin_name(NVT_BIN_NAME_TYPE_FW), &size) < 0) {
|
||||||
|
return ERR_NVT_UPDATE_NO_NEED;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
while (retry < UPDATE_ALL_IN_ONE_RETRY_TIMES) {
|
while (retry < UPDATE_ALL_IN_ONE_RETRY_TIMES) {
|
||||||
if (nvt_fs_set_blk_dev())
|
if (nvt_fs_set_blk_dev_cb())
|
||||||
return ERR_NVT_UPDATE_OPENFAILED;
|
return ERR_NVT_UPDATE_OPENFAILED;
|
||||||
else {
|
else {
|
||||||
#ifdef CONFIG_NVT_DISPLAY_BAR_FWUPDATE //uboot config
|
#ifdef CONFIG_NVT_DISPLAY_BAR_FWUPDATE //uboot config
|
||||||
|
|
|
@ -426,6 +426,17 @@ int nvt_fs_set_blk_dev(void)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*added for emmc upgrade by greg*/
|
||||||
|
int nvt_fs_set_blk_dev_emmc(void)
|
||||||
|
{
|
||||||
|
if (fs_set_blk_dev("mmc", "1:1", FS_TYPE_FAT)){
|
||||||
|
printf("MMC interface configure failed\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
#ifndef CONFIG_NVT_SPI_NONE
|
#ifndef CONFIG_NVT_SPI_NONE
|
||||||
int nvt_flash_mark_bad(void)
|
int nvt_flash_mark_bad(void)
|
||||||
{
|
{
|
||||||
|
|
|
@ -158,6 +158,7 @@ static int nvt_handle_fw_abin(void)
|
||||||
char buf[512] = {0};
|
char buf[512] = {0};
|
||||||
int ota_upgrade_sts = 0;
|
int ota_upgrade_sts = 0;
|
||||||
int is_ota = 0;
|
int is_ota = 0;
|
||||||
|
|
||||||
if(WDT_OTA_GET_STS() == WDT_OTA_MAKEFOURCC(WDT_OTA_STS_LOADER_DETECTING_FW))
|
if(WDT_OTA_GET_STS() == WDT_OTA_MAKEFOURCC(WDT_OTA_STS_LOADER_DETECTING_FW))
|
||||||
{
|
{
|
||||||
is_ota = 1;
|
is_ota = 1;
|
||||||
|
@ -169,7 +170,9 @@ static int nvt_handle_fw_abin(void)
|
||||||
sf_display_lcd_bl(0);
|
sf_display_lcd_bl(0);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("is_ota: %d\r\n", is_ota);
|
printf("is_ota: %d\r\n", is_ota);
|
||||||
|
|
||||||
/* To handle firmware update */
|
/* To handle firmware update */
|
||||||
ret = nvt_fw_update(false);
|
ret = nvt_fw_update(false);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
|
|
|
@ -53,7 +53,7 @@
|
||||||
#define SDIO2_MASK 0x7FF0000
|
#define SDIO2_MASK 0x7FF0000
|
||||||
#else
|
#else
|
||||||
#define SDIO_MASK 0x7FF
|
#define SDIO_MASK 0x7FF
|
||||||
#define SDIO2_MASK 0x7FF000
|
#define SDIO2_MASK 0x7FF0000 //from 0x7FF000 to 0x7FF0000 for emmc speed added by greg
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_NVT_FPGA_EMULATION
|
#ifdef CONFIG_NVT_FPGA_EMULATION
|
||||||
|
@ -383,7 +383,7 @@ void pll_set_sdioclock_rate(int id, u32 value)
|
||||||
regdata |= value;
|
regdata |= value;
|
||||||
} else {
|
} else {
|
||||||
regdata &= ~SDIO2_MASK;
|
regdata &= ~SDIO2_MASK;
|
||||||
regdata |= value << 12;
|
regdata |= value << 16;//Improve the read and write speed of the emmc added by greg
|
||||||
}
|
}
|
||||||
|
|
||||||
if (id != SDIO_HOST_ID_3)
|
if (id != SDIO_HOST_ID_3)
|
||||||
|
|
|
@ -135,10 +135,21 @@ static int is_camera_fw_upgrade(void)
|
||||||
//char font = System_Get_DCF_Disk_Drive(dcf_handle) == 'B' ? 'B' : 'A';
|
//char font = System_Get_DCF_Disk_Drive(dcf_handle) == 'B' ? 'B' : 'A';
|
||||||
//char fw_file[64] = {'\0'};
|
//char fw_file[64] = {'\0'};
|
||||||
//sprintf((char *)fw_file, "%c%s", font, FW_UPDATE_NAME);
|
//sprintf((char *)fw_file, "%c%s", font, FW_UPDATE_NAME);
|
||||||
hFile = FileSys_OpenFile(FW_UPDATE_NAME, FST_OPEN_READ);
|
hFile = FileSys_OpenFile("B:\\FW98565A.bin", FST_OPEN_READ);
|
||||||
//hFile = FileSys_OpenFile(fw_file, FST_OPEN_READ);
|
//hFile = FileSys_OpenFile(fw_file, FST_OPEN_READ);
|
||||||
//if (gBattery < 40 || hFile == NULL)
|
//if (gBattery < 40 || hFile == NULL)
|
||||||
if (hFile == NULL)
|
if (hFile == NULL)
|
||||||
|
{
|
||||||
|
printf("[%s:%d]emmc no update file\n", __FUNCTION__, __LINE__);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FileSys_CloseFile(hFile);
|
||||||
|
return UPGRADABLE;
|
||||||
|
}
|
||||||
|
|
||||||
|
hFile = FileSys_OpenFile(FW_UPDATE_NAME, FST_OPEN_READ);
|
||||||
|
if (hFile == NULL)
|
||||||
{
|
{
|
||||||
printf("[%s:%d]sd card no update file\n", __FUNCTION__, __LINE__);
|
printf("[%s:%d]sd card no update file\n", __FUNCTION__, __LINE__);
|
||||||
return NOT_UPGRADABLE;
|
return NOT_UPGRADABLE;
|
||||||
|
|
|
@ -2244,14 +2244,17 @@ static UINT32 sf_fwupdate(void)
|
||||||
#else
|
#else
|
||||||
BOOL sf_ota_trigger(void)
|
BOOL sf_ota_trigger(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
UINT32 uiUserData = 0;
|
UINT32 uiUserData = 0;
|
||||||
char cmd[128]={0};
|
char cmd[128]={0};
|
||||||
|
|
||||||
if((PWR_ON_SETUP == sf_cardv_convert_power_on_mode()))
|
if((PWR_ON_SETUP == sf_cardv_convert_power_on_mode()))
|
||||||
{
|
{
|
||||||
|
|
||||||
uiUserData = WDT_OTA_MAKEFOURCC(WDT_OTA_STS_LINUX_TRIGGER);
|
uiUserData = WDT_OTA_MAKEFOURCC(WDT_OTA_STS_LINUX_TRIGGER);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
uiUserData = WDT_OTA_MAKEFOURCC(WDT_OTA_STS_LINUX_TRIGGER_AUTO);
|
uiUserData = WDT_OTA_MAKEFOURCC(WDT_OTA_STS_LINUX_TRIGGER_AUTO);
|
||||||
}
|
}
|
||||||
Ux_PostEvent(NVTEVT_ALGMSG_FOCUSEND, 0);
|
Ux_PostEvent(NVTEVT_ALGMSG_FOCUSEND, 0);
|
||||||
|
@ -2330,7 +2333,6 @@ void* sf_sys_do_upgrade(void *arg)
|
||||||
#if !SF_UBOOT_UPDATA_FW
|
#if !SF_UBOOT_UPDATA_FW
|
||||||
UIMenuStoreInfo *puiPara = sf_ui_para_get();
|
UIMenuStoreInfo *puiPara = sf_ui_para_get();
|
||||||
#endif
|
#endif
|
||||||
SLOGW("Begin to do Upgrade!\n");
|
|
||||||
|
|
||||||
//if(sf_is_enough_power_to_update() == FALSE)
|
//if(sf_is_enough_power_to_update() == FALSE)
|
||||||
if(sf_cardv_battery_value_get() < 40){
|
if(sf_cardv_battery_value_get() < 40){
|
||||||
|
@ -2340,6 +2342,7 @@ void* sf_sys_do_upgrade(void *arg)
|
||||||
// sf_set_fw_update(0);
|
// sf_set_fw_update(0);
|
||||||
// }
|
// }
|
||||||
else{
|
else{
|
||||||
|
|
||||||
sf_mcu_reg_set(SF_MCU_SOFT_UPDATE, 1);
|
sf_mcu_reg_set(SF_MCU_SOFT_UPDATE, 1);
|
||||||
//sf_set_fw_update(1);
|
//sf_set_fw_update(1);
|
||||||
sf_set_send_statu(TRUE);
|
sf_set_send_statu(TRUE);
|
||||||
|
@ -2349,6 +2352,7 @@ void* sf_sys_do_upgrade(void *arg)
|
||||||
#if SF_UBOOT_UPDATA_FW
|
#if SF_UBOOT_UPDATA_FW
|
||||||
sf_ota_trigger();
|
sf_ota_trigger();
|
||||||
#else
|
#else
|
||||||
|
|
||||||
//BKG_PostEvent(NVTEVT_BKW_FW_UPDATE);
|
//BKG_PostEvent(NVTEVT_BKW_FW_UPDATE);
|
||||||
if(0 != sf_fwupdate()){
|
if(0 != sf_fwupdate()){
|
||||||
sf_sys_status_led_set(SF_LED_SYS_STATE_ERROR);
|
sf_sys_status_led_set(SF_LED_SYS_STATE_ERROR);
|
||||||
|
|
|
@ -115,12 +115,16 @@ static LDR_RECOVERY_TRIGGER_CB gRecoveryTriggerCallBack = NULL;
|
||||||
//#if (STORAGE_EXT_TYPE != STORAGE_EXT_USB)
|
//#if (STORAGE_EXT_TYPE != STORAGE_EXT_USB)
|
||||||
//static BOOL g_is_recovery_triggered = FALSE; // indicate recovery flow is triggered.
|
//static BOOL g_is_recovery_triggered = FALSE; // indicate recovery flow is triggered.
|
||||||
//#endif
|
//#endif
|
||||||
|
|
||||||
|
|
||||||
_THUMB2 static int bl_is_smp(unsigned char *p_fdt);
|
_THUMB2 static int bl_is_smp(unsigned char *p_fdt);
|
||||||
static UINT32 g_uiStartBlkUpdateFW = StartNandBlkUpdateFW;
|
static UINT32 g_uiStartBlkUpdateFW = StartNandBlkUpdateFW;
|
||||||
static UINT32 g_uiNandBlkSize = 0;
|
static UINT32 g_uiNandBlkSize = 0;
|
||||||
static UINT32 g_rtos_load_addr = 0;
|
static UINT32 g_rtos_load_addr = 0;
|
||||||
static UINT32 g_rtos_target_addr = 0;
|
static UINT32 g_rtos_target_addr = 0;
|
||||||
static UINT32 g_rtos_size = 0;
|
static UINT32 g_rtos_size = 0;
|
||||||
|
static UINT32 g_update_from_emmc = 0;
|
||||||
|
|
||||||
|
|
||||||
#if (FDT_SUPPORT)
|
#if (FDT_SUPPORT)
|
||||||
#define PATH_MEM_DRAM "/nvt_memory_cfg/dram"
|
#define PATH_MEM_DRAM "/nvt_memory_cfg/dram"
|
||||||
|
@ -2948,7 +2952,8 @@ _THUMB2 static unsigned int bl_process_flash_boot(unsigned char *p_tmp, DRAM_PAR
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if 1
|
#if 1
|
||||||
else if (p_dram_partition->rtos_addr == 0 || DUAL_RTOS_SUPPORT || (gFastbootKeyCallBack == NULL) || (!gFastbootKeyCallBack())) {
|
//added by greg
|
||||||
|
else if (p_dram_partition->rtos_addr == 0 || DUAL_RTOS_SUPPORT || (gFastbootKeyCallBack == NULL) || (!gFastbootKeyCallBack()|| g_update_from_emmc)) {
|
||||||
// load uboot
|
// load uboot
|
||||||
er = bl_load_uboot_from_flash((unsigned char *)p_dram_partition->fdt_addr, p_tmp);
|
er = bl_load_uboot_from_flash((unsigned char *)p_dram_partition->fdt_addr, p_tmp);
|
||||||
if (er != 0) {
|
if (er != 0) {
|
||||||
|
@ -2960,6 +2965,7 @@ _THUMB2 static unsigned int bl_process_flash_boot(unsigned char *p_tmp, DRAM_PAR
|
||||||
if (er != 0) {
|
if (er != 0) {
|
||||||
bl_displayErrMsg("boot uboot failed\r\n");
|
bl_displayErrMsg("boot uboot failed\r\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
else {
|
else {
|
||||||
|
@ -3140,53 +3146,10 @@ _THUMB2 UINT32 bl_mainFlow(void)
|
||||||
// rtc reset shutdown timer
|
// rtc reset shutdown timer
|
||||||
// rtc_resetShutDownTimer();
|
// 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);
|
debug_msg((char *)LOADER_START_STR);
|
||||||
UTL_setDrvTmpBufferAddress(uiTmpBufferAddr);
|
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
|
#if 0
|
||||||
// Sample to hook spi flash extending function
|
// Sample to hook spi flash extending function
|
||||||
flash_installIdentifyCB(bl_spiIdentify);
|
flash_installIdentifyCB(bl_spiIdentify);
|
||||||
|
@ -3231,38 +3194,11 @@ _THUMB2 UINT32 bl_mainFlow(void)
|
||||||
uiLoaderFunc |= FUNC_RUN_CARD;
|
uiLoaderFunc |= FUNC_RUN_CARD;
|
||||||
} else if ((int_strg_obj->flash_getBlockSize() == EMMC_BLOCK_SIZE) && gRecoveryTriggerCallBack && gRecoveryTriggerCallBack()) {
|
} else if ((int_strg_obj->flash_getBlockSize() == EMMC_BLOCK_SIZE) && gRecoveryTriggerCallBack && gRecoveryTriggerCallBack()) {
|
||||||
debug_msg("Recovery triggered not support currently.\r\n");
|
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
|
#if 1
|
||||||
else if ((gSpecialKeyCallBack(ota_flag)) && (gCardDetectCallBack())) {
|
else if ((gSpecialKeyCallBack(ota_flag)) && (gCardDetectCallBack())) {
|
||||||
|
|
||||||
if (card_open() == TRUE && fat_initFAT(uiheapBufferAddr, FAT_HEAP_BUFFER_SIZE) == TRUE) {
|
if (card_open() == TRUE && fat_initFAT(uiheapBufferAddr, FAT_HEAP_BUFFER_SIZE) == TRUE) {
|
||||||
#if UPDATE_SIM_CODE
|
#if UPDATE_SIM_CODE
|
||||||
BOOL bWDTInit = UTL_canUpdateSecKey();
|
BOOL bWDTInit = UTL_canUpdateSecKey();
|
||||||
|
@ -3323,102 +3259,7 @@ _THUMB2 UINT32 bl_mainFlow(void)
|
||||||
}
|
}
|
||||||
// Run FW has lower priority
|
// Run FW has lower priority
|
||||||
else if (fat_open_rootfile(RUN_FW_NAME) == TRUE) {
|
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 ;
|
NVTPACK_MEM mem_in ;
|
||||||
uiUpdateFileLen = fat_read_rootfile((UINT8 *)uiUpdateMainBinBufAddr, SIZE_PRELOAD);
|
uiUpdateFileLen = fat_read_rootfile((UINT8 *)uiUpdateMainBinBufAddr, SIZE_PRELOAD);
|
||||||
mem_in.p_data = (void *)uiUpdateMainBinBufAddr;
|
mem_in.p_data = (void *)uiUpdateMainBinBufAddr;
|
||||||
|
@ -3442,6 +3283,12 @@ _THUMB2 UINT32 bl_mainFlow(void)
|
||||||
debug_msg("\r\n"); // for line end RRRRRRR....
|
debug_msg("\r\n"); // for line end RRRRRRR....
|
||||||
uiLoaderFunc |= FUNC_RUN_CARD;
|
uiLoaderFunc |= FUNC_RUN_CARD;
|
||||||
}
|
}
|
||||||
|
/* no fw found in sd card , start emmc check flow */
|
||||||
|
else{
|
||||||
|
|
||||||
|
g_update_from_emmc = 1;
|
||||||
|
uiLoaderFunc &= ~(FUNC_UPDATE_LOADER); /* loader won't be updated by emmc */
|
||||||
|
}
|
||||||
#if UPDATE_SIM_CODE
|
#if UPDATE_SIM_CODE
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -3455,6 +3302,8 @@ _THUMB2 UINT32 bl_mainFlow(void)
|
||||||
else if (((gSpecialKeyCallBack == NULL) || gSpecialKeyCallBack(ota_flag)) &&
|
else if (((gSpecialKeyCallBack == NULL) || gSpecialKeyCallBack(ota_flag)) &&
|
||||||
((gCardDetectCallBack != NULL) || (gCardDetectCallBack() == FALSE))) {
|
((gCardDetectCallBack != NULL) || (gCardDetectCallBack() == FALSE))) {
|
||||||
debug_msg("No card inserted\r\n");
|
debug_msg("No card inserted\r\n");
|
||||||
|
g_update_from_emmc = 1;
|
||||||
|
uiLoaderFunc &= ~(FUNC_UPDATE_LOADER); /* loader won't be updated by emmc */
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user