U-boot-1.1.6-2008R1到vdsp5(bf561)的移植记录(12):第二阶段的程序入口

本文解析了U-Boot启动过程中的关键步骤,包括通过设置中断级别和向量表来控制CPU进入下一阶段运行的方式。此外,还介绍了如何通过修改main函数使U-Boot在下载后自动中断。
 
  
在start.s的最后,CPU初始化已经完成,需要进入第二阶段的执行:
       /* Now lower ourselves from the highest interrupt level to
        * the lowest. We do this by masking all interrupts but 15,
        * setting the 15 handler to "board_init_f", raising the 15
        * interrupt, and then returning from the highest interrupt
        * level to the dummy "jump" until the interrupt controller
        * services the pending 15 interrupt.
        */
       serial_early_puts("Lower to 15")
       r0 = r7;
       r1 = r6;
       p0.l = LO(EVT15);
       p0.h = HI(EVT15);
       //p1.l = _cpu_init_f;
       //p1.h = _cpu_init_f;
       p1.l = _main;
       p1.h = _main;
       [p0] = p1;
       p2.l = LO(IMASK);
       p2.h = HI(IMASK);
       p3.l = LO(EVT_IVG15);
       p3.h = HI(EVT_IVG15);
       [p2] = p3;
       raise 15;
       p4.l = .LWAIT_HERE;
       p4.h = .LWAIT_HERE;
       reti = p4;
       rti;
在这段代码中,将_cpu_init_f写入到INT15的向量表中,然后用raise 15进入下一阶段的运行,这是因为CPU复位之后处于RESET中断的状态,这是优先级很高的一个中断,在这种情况下,虽然可以对CPU进行完全的操作(Supervisor mode),但是却无法响应其它的中断请求。因此上述代码将自身跳到中断15再运行,这样同时可以响应其它的中断,CPU也仍然处在Supervisor mode,可以进行完整的控制。
不过在此处,为了使用main,我将原来跳转的cpu_init_f函数替换为main,这样每次下载u-boot之后,VDSP都会自动在main中中断下来,否则它会犯傻的,呵呵!
经过修改的main变成了:
 
__attribute__ ((__noreturn__))
void main(ulong bootflag, ulong loaded_from_ldr)
{
       /* The default startup code does not include any functionality to allow core
          A to enable core B. A convenient way to enable core B is to use the
          'adi_core_b_enable()' function. */
       //adi_core_b_enable();
      
       cpu_init_f(bootflag, loaded_from_ldr);
 
}
 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

嵌云阁主

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值