msd6a648 BootLoader调试记录

2019-04-03

回板

mboot编译使用129D版型,ddr4-2400,编译完成烧录后,正常启动


mboot编译配置

其中有一块板子,启动后直接进入PM51

[AT][MBoot][Driver Init][944]

Changelist:  24543697
============= set bootargs ===============
WDT is not Enable !!!setenv WDT_ENABLE 1 to enable it.
Hit any key to stop autoboot:  0 
fore uup u8KeyPad_KeyVal [0xFF]
WDT is not Enable !!!setenv WDT_ENABLE 1 to enable it.
AC on
mmc change mount : tvconfig
Loading file "/config/PM.bin" at offset 0x0 from mmc device 0 partition tvconfig
24575 bytes read
Wait for PM51 standby...........PM51 run ok...........UART_115200

解决方法

<< MStar >># setenv factory_poweron_mode direct
<< MStar >># save
Saving Environment to MMC...
Writing to MMC(0)... 128 blocks written: OK
128 blocks written: OK
done
<< MStar >># reset

原因
uboot启动后,进入u-boot-2011.06\common\main.c -> main_loop

void main_loop (void){
...
        if(FALSE==MstarToKernel())
        {
          printf("Error: MstarToKernel() \n");
        }
...
}

BOOLEAN MstarToKernel(void)
{
#if CONFIG_MINIUBOOT
    run_command("bootcheck", 0);
    #if (CONFIG_PANEL_INIT)
    run_command("panel_pre_init", 0);
    #endif

    #if (ENABLE_HDMI_TX == 1)
    run_command("hdmi init", 0);
    #endif

    #ifdef CONFIG_DISPLAY_LOGO
    run_command("bootlogo", 0);
    #endif
#else
    ST_CMD_RECORED *pCmd=NULL;
    UBOOT_TRACE("IN\n");     
    UBOOT_DEBUG("\n \033[0;35m ===========================================================\033[0m\n");
    UBOOT_DEBUG("\n \033[0;35m ------------------ MstarToKernel---------------------------\033[0m\n");
    UBOOT_DEBUG("\n \033[0;35m ===========================================================\033[0m\n");


    pCmd=getFirstCmd();
    if(pCmd==NULL)
    {
        UBOOT_DEBUG("There are no any cmds in table\n");
        return TRUE;
    }
    
    while(1)
    {
        if(pCmd->stage == STAGE_TOKERNEL)
        {
            UBOOT_BOOTTIME("[AT][MB][%s][%lu]_start\n",pCmd->cmd, MsSystemGetBootTime());
            run_command(pCmd->cmd,  pCmd->flag);
            UBOOT_BOOTTIME("[AT][MB][%s][%lu]_end\n",pCmd->cmd, MsSystemGetBootTime());
        }
        pCmd=getNextCmd(pCmd);
        if(pCmd==NULL)
        {
            UBOOT_DEBUG("It's the last cmd\n");
            break;
        }
    }
    
    UBOOT_TRACE("OK\n");
 #endif
    return TRUE;
}

getFirstCmd和getNextCmd执行的命令是在Customer_Register_ToKernel()添加的命令

void Customer_Register_ToKernel(void)
{
    //Some flow must run after MBoot console entry to avoid MBoot halt.

   /*bootcheck:check boot mode(usb/oad/net upgrade, recovery, normal).
     If it is normal mode, just go through this command.
     you can mark this to implement your customer boot flow. */
    Add_Command_Table ("bootcheck" , 0, STAGE_TOKERNEL);

    Add_Command_Table ("wdt_enable" , 0, STAGE_TOKERNEL);// wdt_enable need to place in bootcheck's next cmd.


    Add_Command_Table ("if_boot_to_pm" , 0, STAGE_TOKERNEL);
...

if_boot_to_pm命令的执行函数中,check_pm_standby()参与了环境变量factory_poweron_mode的处理,以及是否从pm51启动

static int If_Boot_To_PM(void){
...
        if(check_pm_standby())
#endif
        {
            #if (CONFIG_WDT_RESET_BY_ESD)
            if (!bWDTResetToPowerOff)
            {
                set_poweroff_flag(TRUE);
            }
            #endif

            // load mtk bt patch , and send woble cmd
            #if (CONFIG_MTK_BT_USB)
            run_command("setMtkBT", 0);
            #endif

            //PM51_PowerDown();
            run_command("pm51 standby",0);
        }
...
}

你可能感兴趣的:(msd6a648 BootLoader调试记录)