原创 续:深入剖析barebox(U-BOOT-II)在i.MX27上的移植

2011-10-31 11:29 1556 19 19 分类: 消费电子

深入剖析barebox(U-BOOT-II)在i.MX27上的移植

. = .;

__barebox_cmd_start = .;

.barebox_cmd : { BAREBOX_CMDS }

__barebox_cmd_end = .;

 

__barebox_initcalls_start = .;

.barebox_initcalls : { INITCALLS }

__barebox_initcalls_end = .;

 

__usymtab_start = .;

__usymtab : { BAREBOX_SYMS }

__usymtab_end = .;

 

. = ALIGN(4);

__bss_start = .;

.bss : { *(.bss*) }

__bss_stop = .;

_end = .;

_barebox_image_size = __bss_start - _text;

}

 从上面的链接脚本可以看出barebox首先被执行的是 exception_vectors

该函数在 arch/arm/cpu/start.c

void __naked __section(.text_entry) exception_vectors(void)

{

       __asm__ __volatile__ (

              "b reset\n"                          /* reset */

#ifdef CONFIG_ARM_EXCEPTIONS

              "ldr pc, =undefined_instruction\n"    /* undefined instruction */

              "ldr pc, =software_interrupt\n"         /* software interrupt (SWI) */

              "ldr pc, =prefetch_abort\n"        /* prefetch abort */

              "ldr pc, =data_abort\n"                     /* data abort */

              "1: bne 1b\n"                      /* (reserved) */

              "ldr pc, =irq\n"                    /* irq (interrupt) */

              "ldr pc, =fiq\n"                    /* fiq (fast interrupt) */

#else

              "1: bne 1b\n"                      /* undefined instruction */

              "1: bne 1b\n"                      /* software interrupt (SWI) */

              "1: bne 1b\n"                      /* prefetch abort */

              "1: bne 1b\n"                      /* data abort */

              "1: bne 1b\n"                      /* (reserved) */

              "1: bne 1b\n"                      /* irq (interrupt) */

              "1: bne 1b\n"                      /* fiq (fast interrupt) */

#endif

              ".word 0x65726162\n"                     /* 'bare' */

              ".word 0x00786f62\n"               /* 'box' */

              ".word _text\n"                          /* text base. If copied there,

                                                  * barebox can skip relocation

                                                  */

              ".word _barebox_image_size\n"              /* image size to copy */

       );

}

由此可见第一条指令就是b reset, barebox然后跳转到了reset函数

该函数在 arch/arm/cpu/start.c

      

       board_init_lowlevel:

 

       mov r10, lr

       /* ahb lite ip interface */

       writel(0x20040304, AIPI1_PSR0)

       writel(0xDFFBFCFB, AIPI1_PSR1)

       writel(0x00000000, AIPI2_PSR0)

       writel(0xFFFFFFFF, AIPI2_PSR1)

 

       /* skip sdram initialization if we run from ram [0xa0000000--0xc0000000 is ram space]*/

       cmp pc, #0xa0000000

       bls   1f

       cmp pc, #0xc0000000

       bhi  1f

 

       mov pc,r10

 

1:

       writel(IMX_PLL_PD(0) |

               IMX_PLL_MFD(51) |

               IMX_PLL_MFI(7) |

               IMX_PLL_MFN(35), MPCTL0) /* 399 MHz */

               

文章评论0条评论)

登录后参与讨论
我要评论
0
19
关闭 站长推荐上一条 /2 下一条