STMP3770启动流程

我们知道,STMP3770里面有个On-Chip Rom,里面预存有启动代码,即系统刚开机就马上跳转到此处,完成相关的硬件初始化的动作,同时也提供裸机烧录功能(主要是方便工厂第一次预载image方便)。

下面,我们谈谈系统是如何加载其他image的(其他image存放在Nand flash中,接口为SDIO)。

我们打开项目文件code\xxx_build\xxx_updater_top.gpj, 首先会调用命令脚本sdk_os_media_updater.tbd, 之后调用elftosb命令生成sb二进制文档;这里调用的脚本sdk_os_media_updater.tbd就会指定image的link地址和启动顺序。

{rebuild}application\framework\sdk_os_media_player\sdk_os_media_updater.tbd
	-object_dir=$OUTDIR
	:postexecShell="$ROOT\\bin\\elftosb -V -z -z -c $OUTDIR\\sdk_os_media_updater.bd -o $OUTDIR\\updater.sb -p $OUTDIR updater_usb\\updater_usb"


我们接着一起研究sdk_os_media_updater.tbd,

首先,看看整个image里面包含哪些内容,内容如下表:

sources {
// List of elftosb source files relative to $OUTDIR
#ifdef INTERNAL_MEDIA_SDMMC
    rom_sd_patch = "rom_sd_patch\rom_sd_patch";
#endif
    boot_prep    = "boot_prep\boot_prep";
    boot_manager = "boot_manager\boot_manager";
    updater_live = "updater_live\updater_live";
    hostlink_elf = "hostlink\hostlink";
    player_elf   = "player\player";
    splash_elf   = "splash\splash"(secinfoClear="rom");
    firmware_rsc = "resources\firmware.rsc";
}
接着,我们再看看他们之间的呼叫顺序,

如果有sd patch则先呼叫此处,然后呼叫boot_prep,

    // load sd patch to patch sd_Next function
#ifdef INTERNAL_MEDIA_SDMMC
#if !defined(STMP378x)
    load rom_sd_patch;
    call rom_sd_patch:_start(0);
#endif
#endif

    // Call boot_prep to setup the hardware platform for booting.

    load boot_prep;
    call boot_prep;
接着呼叫boot_manager, 如果需要进行updater_live,则进行通过USB的image更新;否则,跳过这一步。

    // Next call boot_manager, which will instruct the ROM on what to boot
    // next. Let boot_manager know we are including the live updater by
    // passing it a non-zero argument.
    if exists(updater_live)
    {
        load boot_manager;
        call boot_manager(1);   // Test if live update should be started
        load updater_live;
        jump updater_live;
    }
    else
    {
        load boot_manager;
        call boot_manager(0);   // Skip the test for live update
    }
然后,查看是否有5V USB与电脑相连,如果是则进入HostLink mode(也就是优盘模式)。

//------------------------------------------------------------------------------
// HOSTLINK BOOT SECTION
//
// The hostlink section is booted if 5V and USB are connected while booting.
//------------------------------------------------------------------------------
section(hostlink_tag)
{
    // Load the non-paged portion of hostlink, then exit the ROM by jumping to it.
    load ~$.pageable* from hostlink_elf;
    jump hostlink_elf;
}
如果,启动过程中没有与USB相连,则进入Player模式(即正常的操作模式,因为STMP3770是针对MP3/4市场设计的SoC芯片,所以正常的模式也被定义为Player模式)。

//------------------------------------------------------------------------------
// PLAYER BOOT SECTION
//
// The player section is booted if USB is not connected while booting. It first
// displays a splash screen, then starts player.
//------------------------------------------------------------------------------
section(player_tag)
{
    // If there is a splash screen, display it before starting player.
    if exists(splash_elf) {
        load splash_elf;
        call splash_elf:SplashMain;
    }

    // Load the non-paged portion of player, then exit the ROM by jumping to it.
    load ~$.pageable*, ~$.ocram.pageable.test* from player_elf;
    jump player_elf;
}

至此,系统已经启动成功。





  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值