U-Boot 移植:启动时点灯动作

原创
2015/05/03 17:24
阅读数 121

代码

公共部份代码:arch/arm/lib/crt0.S

/* Set up final (full) environment */

        bl      c_runtime_cpu_setup     /* we still call old routine here */

        ldr     r0, =__bss_start        /* this is auto-relocated! */
        ldr     r1, =__bss_end          /* this is auto-relocated! */

        mov     r2, #0x00000000         /* prepare zero to clear BSS */

clbss_l:cmp     r0, r1                  /* while not at end of BSS */
        strlo   r2, [r0]                /* clear 32-bit BSS word */
        addlo   r0, r0, #4              /* move to next */
        blo     clbss_l

        bl coloured_LED_init
        bl red_led_on

        /* call board_init_r(gd_t *id, ulong dest_addr) */
        mov     r0, r9                  /* gd_t */
        ldr     r1, [r9, #GD_RELOCADDR] /* dest_addr */
        /* call board_init_r */
        ldr     pc, =board_init_r       /* this is auto-relocated! */

        /* we should not return here. */

#endif

ENDPROC(_main)

Makefile 相关的变量CONFIG_ASM9260_GPIO

obj-$(CONFIG_ASM9260_GPIO)      += asm9260_gpio.o
obj-$(CONFIG_AT91_GPIO) += at91_gpio.o
obj-$(CONFIG_INTEL_ICH6_GPIO)   += intel_ich6_gpio.o
obj-$(CONFIG_KIRKWOOD_GPIO)     += kw_gpio.o
obj-$(CONFIG_KONA_GPIO) += kona_gpio.o

GPIO 驱动相关的宏定义,环境变量:CONFIG_ASM9260_GPIO,定义于include/configs/xxboardxx.h

/* general purpose I/O */
#define CONFIG_ALPHASCALE_LEGACY                /* required until (g)pio is fixed */
#define CONFIG_ASM9260_GPIO
#define CONFIG_ASM9260_GPIO_PULLUP      1       /* keep pullups on peripheral pins */

小评

显然 U-Boot 在目前的版本 2015.4 这些非公用的环境变量的控制还存在于头文件中,这个跟内核或 barebox 还是有点差别。

Copyright

Copyright (C) 2015 Du Huanpeng <u74147@gmail.com>

展开阅读全文
打赏
0
0 收藏
分享
加载中
更多评论
打赏
0 评论
0 收藏
0
分享
在线直播报名
返回顶部
顶部