#######################################UBOOT 2009.11版#############################################################
下载地址
http://ftp.denx.de/pub/u-boot/cd /mnt/mydrives/u-boot-1.3/u-boot-2009.11/
所以先修改Makefile
找到
ifeq ($(ARCH),arm)
CROSS_COMPILE = arm-linux-
endif
修改成
#CROSS_COMPILE = arm-linux-
CROSS_COMPILE = /home/zhh/arm-softfloat-linux-gnu/bin/arm-softfloat-linux-gnu-
endif
我的目录是/usr/local/arm/4.4.3/arm-linux- 可以在/etc目录里是之environment 添加arm-linux- 路径
实验了多种ARM-linux 均可以编译成功 所以采用此版本 实现了800x600 UBOOT开机显示LOGO
########################################at91sam9263ek.h 添加代码如下#################################################
Bootstrap-v1.14- /mnt/mydrives/Bootstrap-v1.14-knh/board/at91sam9263ek/nandflash/at91sam9263ek.h 添加代码如下
#define IMG_ADDRESS 0x20000 /* Image Address in NandFlash */
#define IMG_SIZE 0xB0000 /* Image Size in NandFlash */
因为新编译的uboot.bin 太大了有670多K 所以要修改参数IMG_SIZE 否则uboot不能正常启动
##############################at91sam9263ek.h 添加代码如下###########################################################
at91sam9263ek.h 添加代码如下
/* LCD */
#define CONFIG_LCD 1
#define LCD_BPP LCD_COLOR8
#define CONFIG_LCD_LOGO 1
#undef LCD_TEST_PATTERN
#define CONFIG_LCD_INFO 1
#define CONFIG_LCD_INFO_BELOW_LOGO 0
#define CONFIG_SYS_WHITE_ON_BLACK 0
#define CONFIG_ATMEL_LCD 1
#define CONFIG_ATMEL_LCD_BGR555 1 //CONFIG_ATMEL_LCD_RGB565
#define CONFIG_SYS_CONSOLE_IS_IN_ENV 1
#define CONFIG_VIDEO_BMP_GZIP 1 /* gzip compressed bmp images */
#define CONFIG_SYS_VIDEO_LOGO_MAX_SIZE (4 << 20) /* for decompressed img */
#define CONFIG_SYS_DEFAULT_VIDEO_MODE 0x31a /* 1280x1024,16bpp */
#define CONFIG_CMD_BMP 1
#define CONFIG_VIDEO_LOGO 1
#define CONFIG_VGA_AS_SINGLE_DEVICE 1
#define CONFIG_SPLASH_SCREEN 1
#define CONFIG_SPLASH_SCREEN_ALIGN 1
#define CONFIG_SHOW_BOOT_PROGRESS 1
#define CONFIG_SYS_USE_NANDFLASH 1
#ifdef CONFIG_SYS_USE_DATAFLASH
/* bootstrap + u-boot + env + linux in dataflash on CS0 */
#define CONFIG_ENV_IS_IN_DATAFLASH 1
#define CONFIG_SYS_MONITOR_BASE (CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS0 + 0x8400)
#define CONFIG_ENV_OFFSET 0x4200
#define CONFIG_ENV_ADDR (CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS0 + CONFIG_ENV_OFFSET)
#define CONFIG_ENV_SIZE 0x4200
#define CONFIG_BOOTCOMMAND "cp.b 0xC0042000 0x22000000 0x210000; bootm"
#define CONFIG_BOOTARGS "console=ttyS0,115200 " \
"root=/dev/mtdblock0 " \
"mtdparts=atmel_nand:-(root) "\
"rw rootfstype=jffs2"
#elif CONFIG_SYS_USE_NANDFLASH
//#define CONFIG_BOOTDELAY 3
#define CONFIG_BOOTDELAY 1
#define CONFIG_ETHADDR 08:90:90:90:90:91
#define CONFIG_NETMASK 255.255.255.0
#define CONFIG_IPADDR 192.168.2.170
#define CONFIG_SERVERIP 192.168.2.7
#define CONFIG_GATEWAYIP 192.168.2.1
/* bootstrap + u-boot + env + linux in nandflash */
#define CONFIG_ENV_IS_IN_NAND 1
#define CONFIG_ENV_OFFSET 0xC0000 //0x60000 编译uboot比较大 需要重新设定地址
#define CONFIG_ENV_SIZE 0x20000 /* 1 sector = 128 kB */
#define CONFIG_ENV_OFFSET_REDUND (CONFIG_ENV_OFFSET+CONFIG_ENV_SIZE)
#define CONFIG_BOOTCOMMAND "setenv boot bootm 22200000\
;setenv nf_kernel nand read 22200000 200000 200000\
;if itest.b $ftpflag -eq 0; then run ftpdown; fi\
;run nf_kernel;run boot;"
#define CONFIG_BOOTARGS "mem=62M console=ttyS0,115200 ubi.mtd=1 root=ubi0:rootfs rootfstype=ubifs rw"
#define CONFIG_EXTRA_ENV_SETTINGS \
"linuximg=uImage800x600\0" \
"fsimg=ubi_175M.img\0" \
"linstartaddr=0x22200000\0" \
"fsstartaddr=0x21400000\0" \
"linaddr=0x200000\0" \
"fsaddr=0x4000000\0" \
"ftpflag=0\0" \
"ftpdown=tftp $linstartaddr $linuximg; " \
"nand write $linstartaddr $linaddr 0x200000; " \
"tftp $fsstartaddr $fsimg; " \
"nand write.i $fsstartaddr $fsaddr 0x1840000; " \
"setenv ftpflag 1; " \
"saveenv; " \
"boot; " \
#endif
##############################at91sam9263ek.c 添加代码如下###########################################################
#ifdef CONFIG_LCD
/*
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: AT91SAM9263_LCDC_BASE,
};
*/
vidinfo_t panel_info = {
vl_col: 800,
vl_row: 600,
vl_clk: 800*600*40,
vl_sync: ATMEL_LCDC_INVLINE_INVERTED |ATMEL_LCDC_INVFRAME_INVERTED,
vl_bpix: 3,
vl_tft: 1,
vl_hsync_len: 10,
vl_left_margin: 11,
vl_right_margin: 152,
vl_vsync_len: 5,
vl_upper_margin: 23,
vl_lower_margin: 23,
mmio: AT91SAM9263_LCDC_BASE,
};
void lcd_enable(void)
{
at91_set_gpio_value(AT91_PIN_PA30, 1); /* power up */
}
void lcd_disable(void)
{
at91_set_gpio_value(AT91_PIN_PA30, 0); /* power down */
}
//LCD连接方法不同会有不同
static void at91sam9263ek_lcd_hw_init(void)
{
at91_set_A_periph(AT91_PIN_PC0, 0); /* LCDHSYNC */
at91_set_A_periph(AT91_PIN_PC1, 0); /* LCDHSYNC */
at91_set_A_periph(AT91_PIN_PC2, 0); /* LCDDOTCK */
at91_set_A_periph(AT91_PIN_PC3, 0); /* LCDDEN */
at91_set_B_periph(AT91_PIN_PB9, 0); /* LCDCC */
at91_set_B_periph(AT91_PIN_PC4, 0); /* LCDD3 */
at91_set_B_periph(AT91_PIN_PC5, 0); /* LCDD4 */
at91_set_B_periph(AT91_PIN_PC6, 0); /* LCDD5 */
at91_set_B_periph(AT91_PIN_PC7, 0); /* LCDD6 */
at91_set_B_periph(AT91_PIN_PC8, 0); /* LCDD7 */
at91_set_B_periph(AT91_PIN_PC9, 0); /* LCDD10 */
at91_set_B_periph(AT91_PIN_PC10, 0); /* LCDD11 */
at91_set_B_periph(AT91_PIN_PC11, 0); /* LCDD12 */
at91_set_B_periph(AT91_PIN_PC12, 0); /* LCDD13 */
at91_set_B_periph(AT91_PIN_PC13, 0); /* LCDD14 */
at91_set_B_periph(AT91_PIN_PC14, 0); /* LCDD15 */
at91_set_B_periph(AT91_PIN_PC15, 0); /* LCDD19 */
at91_set_B_periph(AT91_PIN_PC16, 0); /* LCDD20 */
at91_set_B_periph(AT91_PIN_PC17, 0); /* LCDD21 */
at91_set_B_periph(AT91_PIN_PC18, 0); /* LCDD22 */
at91_set_B_periph(AT91_PIN_PC19, 0); /* LCDD23 */
at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9263_ID_LCDC);
/* External Memory Map */
#define AT91_CHIPSELECT_0 0x10000000
#define AT91_CHIPSELECT_1 0x20000000
#define AT91_CHIPSELECT_2 0x30000000
#define AT91_CHIPSELECT_3 0x40000000
#define AT91_CHIPSELECT_4 0x50000000
#define AT91_CHIPSELECT_5 0x60000000
#define AT91_CHIPSELECT_6 0x70000000
#define AT91_CHIPSELECT_7 0x80000000
//gd->fb_base = AT91SAM9263_SRAM0_BASE;
gd->fb_base = AT91_CHIPSELECT_1 + 60*1024*1024;
//指向外部内存的高端地址 我的电路版的内存大小是64M 所以指向60M的位置
//原来 setenv bootargs 'mem=64M console=ttyS0,11520 ubi.mtd=1 root=ubi0:rootfs rootfstype=ubifs rw'
//对应修改 setenv bootargs 'mem=60M console=ttyS0,11520 ubi.mtd=1 root=ubi0:rootfs rootfstype=ubifs rw'
}
##############################lcd.c文件的改动 添加代码###########################################################
//增加进度条显示函数
void DispLogoProgress ( int data )
{
/*
unsigned int X1 = 0; //进度条外框
unsigned int Y1 = 0;
unsigned int X2 = 0;
unsigned int Y2 = 0;
unsigned int i =0;
unsigned int j =0;
X1 = (lcd_line_length-BMP_LOGO_WIDTH)/2; //进度条外框
Y1 = BMP_LOGO_HEIGHT + ((panel_info.vl_row-BMP_LOGO_HEIGHT)/2);
X2 = (lcd_line_length-BMP_LOGO_WIDTH)/2 + BMP_LOGO_WIDTH;
Y2 = BMP_LOGO_HEIGHT + ((panel_info.vl_row-BMP_LOGO_HEIGHT)/2); + 30;
lcd_setbgcolor(CONSOLE_COLOR_GREY);
int n = ( X2 - X1 - 6 ) / 100.0 * data + X1;
for ( i = ( Y1 + 3 ) * lcd_line_length ; i < ( Y2 - 3 ) * lcd_line_length; i += lcd_line_length )
{
for ( j = ( X1 + 3 ) ; j < n; j+= 1 )
{
*((volatile unsigned char *)(lcd_base+i+j)) = COLOR_MASK(lcd_getbgcolor());
}
}
lcd_setbgcolor(CONSOLE_COLOR_BLACK);
//显示进度条框
*/
}
void DispLogoProgressInit ( void )
{
/*
//显示进度条框
unsigned int X1 = (lcd_line_length-BMP_LOGO_WIDTH)/2; //进度条外框
unsigned int Y1 = BMP_LOGO_HEIGHT + ((panel_info.vl_row-BMP_LOGO_HEIGHT)/2);
unsigned int X2 = (lcd_line_length-BMP_LOGO_WIDTH)/2 + BMP_LOGO_WIDTH;
unsigned int Y2 = BMP_LOGO_HEIGHT + ((panel_info.vl_row-BMP_LOGO_HEIGHT)/2); + 30;
unsigned int i =0;
lcd_setbgcolor(CONSOLE_COLOR_GREY);
for ( i = Y1*lcd_line_length+X1 ; i < Y1*lcd_line_length+X2; i+= 1 ) //上横线
{
*((volatile unsigned char *)((unsigned long)lcd_base + i)) = COLOR_MASK(lcd_getbgcolor());
}
for ( i = Y2*lcd_line_length+X1 ; i < Y2*lcd_line_length+X2; i+= 1 )//下横线
{
*((volatile unsigned char *)((unsigned long)lcd_base + i)) = COLOR_MASK(lcd_getbgcolor());
}
for ( i = ( Y1 )*lcd_line_length + X1 ; i <= ( Y2 )*lcd_line_length; i += lcd_line_length )
{
*((volatile unsigned char *)( lcd_base + i + 0 )) = COLOR_MASK(lcd_getbgcolor());//左边框
*((volatile unsigned char *)( lcd_base + i +(X2-X1) )) = COLOR_MASK(lcd_getbgcolor());//右边框
}
lcd_setbgcolor(CONSOLE_COLOR_BLACK);
*/
}
##############################bmp_logo.c文件的改动 添加代码###########################################################
int main (int argc, char *argv[])
{
int i, x;
FILE *fp;
bitmap_t bmp;
bitmap_t *b = %26bmp;
uint16_t data_offset;
uint16_t n_colors;
if (argc < 2) {
fprintf (stderr, "Usage: %s file\n", argv[0]);
exit (EXIT_FAILURE);
}
if ((fp = fopen (argv[1], "rb")) == NULL) {
perror (argv[1]);
exit (EXIT_FAILURE);
}
if (fgetc (fp) != 'B' || fgetc (fp) != 'M')
error ("Input file is not a bitmap", fp);
/*
* read width and height of the image, and the number of colors used;
* ignore the rest
*/
skip_bytes (fp, 8);
if (fread (%26data_offset, sizeof (uint16_t), 1, fp) != 1)
error ("Couldn't read bitmap data offset", fp);
skip_bytes (fp, 6);
if (fread (%26b->width, sizeof (uint16_t), 1, fp) != 1)
error ("Couldn't read bitmap width", fp);
skip_bytes (fp, 2);
if (fread (%26b->height, sizeof (uint16_t), 1, fp) != 1)
error ("Couldn't read bitmap height", fp);
skip_bytes (fp, 22);
if (fread (%26n_colors, sizeof (uint16_t), 1, fp) != 1)
error ("Couldn't read bitmap colors", fp);
skip_bytes (fp, 6);
/*
* Repair endianess.
*/
data_offset = le_short(data_offset);
b->width = le_short(b->width);
b->height = le_short(b->height);
n_colors = le_short(n_colors);
/* assume we are working with an 8-bit file */
if ((n_colors == 0) || (n_colors > 256 - DEFAULT_CMAP_SIZE)) {
/* reserve DEFAULT_CMAP_SIZE color map entries for default map */
n_colors = 256 - DEFAULT_CMAP_SIZE;
}
printf ("/*\n"
" * Automatically generated by \"tools/bmp_logo\"\n"
" *\n"
" * DO NOT EDIT\n"
" *\n"
" */\n\n\n"
"#ifndef __BMP_LOGO_H__\n"
"#define __BMP_LOGO_H__\n\n"
"#define BMP_LOGO_WIDTH\t\t%d\n"
"#define BMP_LOGO_HEIGHT\t\t%d\n"
"#define BMP_LOGO_COLORS\t\t%d\n"
"#define BMP_LOGO_OFFSET\t\t%d\n"
"\n",
b->width, b->height, n_colors,
DEFAULT_CMAP_SIZE);
/* allocate memory */
if ((b->data = (uint8_t *)malloc(b->width * b->height)) == NULL)
error ("Error allocating memory for file", fp);
/* read and print the palette information */
printf ("unsigned short bmp_logo_palette[] = {\n");
for (i=0; i<n_colors; ++i) {
b->palette[(int)(i*3+2)] = fgetc(fp);
b->palette[(int)(i*3+1)] = fgetc(fp);
b->palette[(int)(i*3+0)] = fgetc(fp);
x=fgetc(fp);
printf ("%s0x0%X%X%X,%s",
((i%8) == 0) ? "\t" : " ",
(b->palette[(int)(i*3+0)] >> 4) %26 0x0F,
(b->palette[(int)(i*3+1)] >> 4) %26 0x0F,
(b->palette[(int)(i*3+2)] >> 4) %26 0x0F,
((i%8) == 7) ? "\n" : ""
);
}
/* seek to offset indicated by file header */
fseek(fp, (long)data_offset, SEEK_SET);
/* read the bitmap; leave room for default color map */
printf ("\n");
printf ("};\n");
printf ("\n");
printf ("unsigned char bmp_logo_bitmap[] = {\n");
for (i=(b->height-1)*b->width; i>=0; i-=b->width)
{
for (x = 0; x < b->width; x++)
{
b->data[(uint32_t) i + x] = (uint8_t) fgetc (fp) \
+ DEFAULT_CMAP_SIZE;
}
}
fclose (fp);
for (i=0; i<(b->height*b->width); ++i)
{
if ((i%8) == 0)
putchar ('\t');
printf ("0x%02X,%c",
b->data
,
((i%8) == 7) ? '\n' : ' '
);
}
printf ("\n"
"};\n\n"
"#endif /* __BMP_LOGO_H__ */\n"
);
return (0);
}
############################################################################################################################
进入/mnt/mydrives/u-boot-1.3/u-boot-2009.11/tools/logos 目录 替换atmel.bmp 图 换成自己想要的800x600图 256色
############################################################################################################################
[root@localhost u-boot-1.3.4]# make clean
[root@localhost u-boot-1.3.4]# make distclean
[root@localhost u-boot-1.3.4]# make at91sam9263ek_config
或者
[root@localhost u-boot-1.3.4]# make at91sam9263ek_nandflash_config
[root@localhost u-boot-1.3.4]# make
#########################################################################################[ 此帖被dingfuqing在2011-06-07 11:40重新编辑 ]