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

来源:互联网 发布:淘宝特产店名大全 编辑:程序博客网 时间:2024/06/05 15:40
 
  
在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);
 
}
 
原创粉丝点击