您的位置:首页 > 其它

AT91SAM9260下的U-Boot移植和添加LCD驱动支持

2015-06-06 11:44 465 查看
第一步:从http://www.denx.de/wiki/U-Boot/SourceCode网站下载u-boot-2008.10.tar.bz2这个文件。

第二步:建立自己的交叉编译环境,我用的是arm-none-linux-gnueabi-,可以从这里下载最新的交叉编译器。建立的系统为fedora
16。设置好交叉编译环境变量。一般觉得export命令来设置会比较好用,有的会提供修改profile的方式和bash的方式。本人认为还是动态设置比较好。

第三步:首先用make disclean命令清除以前编译的u-boot.bin文件。接着用make at91sam9261ek_config命令来配置好编译的目标。

第四步:用vim Makefile命令,修改

[cpp] view
plaincopyprint?

ifeq ($(ARCH),arm)  

CROSS_COMPILE = arm-linux- 改为 arm-none-linux-guneabi-  

endif  

第五步:编译,make

如果编译通过会生成 u-boot.bin文件

第六步:移植LCD 显示驱动:

需要修改LCD时序参数,以适合本站的竖屏。
u-boot-2008.10\board\atmel\at91sam9261ek\at91sam9261ek.c: 修改结构体:

[cpp] view
plaincopyprint?

vidinfo_t panel_info = {  

    vl_col:     240,  

    vl_row:     320,  

    vl_clk:     4965000,  

    vl_sync:    ATMEL_LCDC_INVLINE_INVERTED |  

            ATMEL_LCDC_INVFRAME_INVERTED,  

    vl_bpix:    3,  

    vl_tft:     1,  

    vl_hsync_len:   5,  

    vl_left_margin: 1,  

    vl_right_margin:33,  

    vl_vsync_len:   1,  

    vl_upper_margin:1,  

    vl_lower_margin:0,  

    mmio:       AT91SAM9261_LCDC_BASE,  

};  

然后修改为:

[cpp] view
plaincopyprint?

vidinfo_t panel_info = {  

    vl_col:     480,  

    vl_row:     272,  

    vl_clk:     9000000,  

    vl_sync:    ATMEL_LCDC_INVLINE_INVERTED |  

            ATMEL_LCDC_INVFRAME_INVERTED,  

    vl_bpix:    3,  

    vl_tft:     1,  

    vl_hsync_len:   41,  

    vl_left_margin: 2,  

    vl_right_margin:2,  

    vl_vsync_len:   10,  

    vl_upper_margin:2,  

    vl_lower_margin:2,  

    mmio:       AT91SAM9261_LCDC_BASE,  

};  

修改完后,下面还需要修改:

[cpp] view
plaincopyprint?

at91_set_A_periph(AT91_PIN_PB1, 0);     /* LCDHSYNC */  

at91_set_A_periph(AT91_PIN_PB2, 0);     /* LCDDOTCK */  

at91_set_A_periph(AT91_PIN_PB3, 0);     /* LCDDEN */  

at91_set_A_periph(AT91_PIN_PB4, 0);     /* LCDCC */  

at91_set_A_periph(AT91_PIN_PB7, 0);     /* LCDD2 */  

at91_set_A_periph(AT91_PIN_PB8, 0);     /* LCDD3 */  

at91_set_A_periph(AT91_PIN_PB9, 0);     /* LCDD4 */  

at91_set_A_periph(AT91_PIN_PB10, 0);    /* LCDD5 */  

at91_set_A_periph(AT91_PIN_PB11, 0);    /* LCDD6 */  

at91_set_A_periph(AT91_PIN_PB12, 0);    /* LCDD7 */  

at91_set_A_periph(AT91_PIN_PB15, 0);    /* LCDD10 */  

at91_set_A_periph(AT91_PIN_PB16, 0);    /* LCDD11 */  

at91_set_A_periph(AT91_PIN_PB17, 0);    /* LCDD12 */  

at91_set_A_periph(AT91_PIN_PB18, 0);    /* LCDD13 */  

at91_set_A_periph(AT91_PIN_PB19, 0);    /* LCDD14 */  

at91_set_A_periph(AT91_PIN_PB20, 0);    /* LCDD15 */  

at91_set_B_periph(AT91_PIN_PB23, 0);    /* LCDD18 */  

at91_set_B_periph(AT91_PIN_PB24, 0);    /* LCDD19 */  

at91_set_B_periph(AT91_PIN_PB25, 0);    /* LCDD20 */  

at91_set_B_periph(AT91_PIN_PB26, 0);    /* LCDD21 */  

at91_set_B_periph(AT91_PIN_PB27, 0);    /* LCDD22 */  

at91_set_B_periph(AT91_PIN_PB28, 0);    /* LCDD23 */  

 

为:

[cpp] view
plaincopyprint?

01.static void at91sam9261ek_lcd_hw_init(void)    

02.{    

03.        at91_set_A_periph(AT91_PIN_PB1, 0);     /* LCDHSYNC */    

04.        at91_set_A_periph(AT91_PIN_PB2, 0);     /* LCDDOTCK */    

05.        at91_set_A_periph(AT91_PIN_PB3, 0);     /* LCDDEN */    

06.        at91_set_gpio_value(AT91_PIN_PB4, 1);   /* LCDCC */    

07.        at91_set_A_periph(AT91_PIN_PB7, 0);     /* LCDD2 */    

08.        at91_set_A_periph(AT91_PIN_PB8, 0);     /* LCDD3 */    

09.        at91_set_A_periph(AT91_PIN_PB9, 0);     /* LCDD4 */    

10.        at91_set_A_periph(AT91_PIN_PB10, 0);    /* LCDD5 */    

11.        at91_set_A_periph(AT91_PIN_PB11, 0);    /* LCDD6 */    

12.        at91_set_A_periph(AT91_PIN_PB12, 0);    /* LCDD7 */    

13.        at91_set_A_periph(AT91_PIN_PB15, 0);    /* LCDD10 */    

14.        at91_set_A_periph(AT91_PIN_PB16, 0);    /* LCDD11 */    

15.        at91_set_A_periph(AT91_PIN_PB17, 0);    /* LCDD12 */    

16.        at91_set_A_periph(AT91_PIN_PB18, 0);    /* LCDD13 */    

17.        at91_set_A_periph(AT91_PIN_PB19, 0);    /* LCDD14 */    

18.        at91_set_A_periph(AT91_PIN_PB20, 0);    /* LCDD15 */    

19.        at91_set_B_periph(AT91_PIN_PB23, 0);    /* LCDD18 */    

20.        at91_set_B_periph(AT91_PIN_PB24, 0);    /* LCDD19 */    

21.        at91_set_B_periph(AT91_PIN_PB25, 0);    /* LCDD20 */    

22.        at91_set_B_periph(AT91_PIN_PB26, 0);    /* LCDD21 */    

23.        at91_set_B_periph(AT91_PIN_PB27, 0);    /* LCDD22 */    

24.        at91_set_B_periph(AT91_PIN_PB28, 0);    /* LCDD23 */  

 


下面为验证的结果:

 经过我和我的搭档两天的合作,终于把这个问题解决了!接下来把linux-2.6.30移植到这款板子上来!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  at91sam9260ek