主题 : u-boot启动时LCD显示图像--愚蠢一法 复制链接 | 浏览器收藏 | 打印
级别: 新手上路
UID: 454
精华: 0
发帖: 14
金钱: 115 两
威望: 95 点
综合积分: 28 分
注册时间: 2008-04-05
最后登录: 2012-06-13
楼主  发表于: 2009-05-08 05:34

 u-boot启动时LCD显示图像--愚蠢一法

管理提醒: 本帖被 qq2440 从 micro2440技术交流专区 移动到本区(2013-11-18)
1.直接把2440test/src/目录下的lcd.c和sunflower_240x320.c拷贝到u-boot/drivers/目录。
2. 修改 lcd.c文件:
1) 添加所需的宏定义:
#define LCD_TYPE_N35            1
#define LCD_TYPE_A70            2
#define LCD_TYPE_VGA1024x768        3
#define LCD_TYPE                LCD_TYPE_A70
#define U32                     unsigned int
2)从lcd.h拷贝过来以下行:
#define rGPCCON    (*(volatile unsigned *)0x56000020)    //Port C control
#define rGPCUP     (*(volatile unsigned *)0x56000028)    //Pull-up control C
#define rGPDCON    (*(volatile unsigned *)0x56000030)    //Port D control
#define rGPDUP     (*(volatile unsigned *)0x56000038)    //Pull-up control D
#define rLCDCON1    (*(volatile unsigned *)0x4d000000)    //LCD control 1
#define rLCDCON2    (*(volatile unsigned *)0x4d000004)    //LCD control 2
#define rLCDCON3    (*(volatile unsigned *)0x4d000008)    //LCD control 3
#define rLCDCON4    (*(volatile unsigned *)0x4d00000c)    //LCD control 4
#define rLCDCON5    (*(volatile unsigned *)0x4d000010)    //LCD control 5
#define rLCDSADDR1  (*(volatile unsigned *)0x4d000014)    //STN/TFT Frame buffer start address 1
#define rLCDSADDR2  (*(volatile unsigned *)0x4d000018)    //STN/TFT Frame buffer start address 2
#define rLCDSADDR3  (*(volatile unsigned *)0x4d00001c)    //STN/TFT Virtual screen address set
#define rTPAL       (*(volatile unsigned *)0x4d000050)    //TFT Temporary palette
#define rLCDINTMSK  (*(volatile unsigned *)0x4d00005c)    //LCD Interrupt mask
#define rTCONSEL     (*(volatile unsigned *)0x4d000060)    //LPC3600 Control --- edited by junon
#define rGPGCON    (*(volatile unsigned *)0x56000060)    //Port G control
#define rGPGUP     (*(volatile unsigned *)0x56000068)    //Pull-up control G
2)去掉其他的#include项,添加:
#include <common.h>
#include “sunflower_240x320.c”  
不要使用sunflower_800x480.c,它太大了,下载时会出错。
3)删除以下行:
extern unsigned char sunflower_240x320[];    
extern unsigned char sunflower_800x480[];
extern unsigned char sunflower_1024x768[];
4)从2440lib.c把LcdBkLtSet(U32 HiRatio)函数定义拷贝过来。
5)  屏蔽掉不用的函数,只保留几个函数足矣:TFT_LCD_Init(),LCD_Init(),LcdBkLtSet() ,Lcd_PowerEnable(),Lcd_EnvidOnOff(),Paint_Bmp()
3. 修改u-boot/drivers/Makefile,添加lcd.o
4.修改u-boot/include/common.h,添加一行:void TFT_LCD_Init(void);
5.修改u-boot/lib_arm/board.c,在for(;;){ main_loop ();}前添加:TFT_LCD_Init();
5.    编译,下载u-boot.bin到板子运行:
Supervivi> load ram 0x33000000 0x20000 x
Ready for downloading using xmodem...
Waiting...
                                            Downl
oaded file at 0x33000000, size = 249984 bytes
Supervivi> go 0x33000000
  go to 0x33000000
  argument 0 = 0x00000000
  argument 1 = 0x00000000
  argument 2 = 0x00000000
  argument 3 = 0x00000000

U-Boot 1.1.6 (May  6 2009 - 16:42:15)

DRAM:  64 MB
Flash: 512 kB
Nand initialized...
*** Warning - bad CRC, using default environment

In:    serial
Out:   serial
Err:   serial
zma2440 #
***************************BRAVO**********************************
不过这种办法不值得提倡,因为光是sunflower的图像数据就占掉u-boot.bin尺寸一半以上。