疯雨-版权所有,转载请注明【http://blog.csdn.net/u010346967】
前面忘了修改烧写脚本了,修改下:
root@crazyrain:/home/share/uboot/u-boot-2012.10# vim burnBootloader.sh
修改后的文件内容:
./mkv210 u-boot.bin u-boot_16k.bin
dd if=u-boot_16k.bin of=/dev/sdb seek=1
dd if=u-boot.bin of=/dev/sdb seek=49
然后,还要修改链接地址:
root@crazyrain:/home/share/uboot/u-boot-2012.10# vim board/samsung/x210v3/config.mk
CONFIG_SYS_TEXT_BASE = 0x34800000 修改为 CONFIG_SYS_TEXT_BASE = 0x24800000
修改 内存基地址:
root@crazyrain:/home/share/uboot/u-boot-2012.10# vim include/configs/x210v3.h
修改如下:
/* DRAM Base */
//#define CONFIG_SYS_SDRAM_BASE 0x30000000
#define CONFIG_SYS_SDRAM_BASE 0x20000000
怎么测试拷贝函数有没有调用到呢?呵呵,我里面已经写了个测试函数?去掉注释,编译进去就行。功能是打印出SD通道号信息。
root@crazyrain:/home/share/uboot/u-boot-2012.10# vim board/samsung/x210v3/copy_to_mem.c
修改后如下:
void copy_to_mem(void)
{
//print channel value to ensure which channel used
__asm__(
"ldr r0,=0xD0037488\n"
"bl display_mem\n"
:
:
:"memory");
CopySDMMCtoMem(MMC_CHANNEL, BL2_START_SECTOR, BL2_SECTOR_NUM, (unsigned int *)BL2_MEM_START_ADDR, 0);
}
重新编译并烧写:
root@crazyrain:/home/share/uboot/u-boot-2012.10# make clean
root@crazyrain:/home/share/uboot/u-boot-2012.10# make
root@crazyrain:/home/share/uboot/u-boot-2012.10# ./burnBootloader
发现串口有打印出0xEB200000。说明拷贝函数已经被调用了,但串口无其他任何信息了,按理说串口应该会有启动信息才对。因为串口是国际标准和sd卡一样,所以uboot对串口和sd卡的驱动支持很完美,一般是不用修改的,要改也是改配置。好那就看看配置文件:
root@crazyrain:/home/share/uboot/u-boot-2012.10# vim include/configs/x210v3.h
发现如下内容:果然不对我使用的是串口0,这里是用串口2做控制台。
/*
* select serial console configuration
*/
#define CONFIG_SERIAL2 1 /* use SERIAL2 */
#define CONFIG_SERIAL_MULTI 1
#define CONFIG_BAUDRATE 115200
修改后:
/*
* select serial console configuration
*/
//#define CONFIG_SERIAL2 1 /* use SERIAL2 */
#define CONFIG_SERIAL0 1 /* use SERIAL0 */
#define CONFIG_SERIAL_MULTI 1
#define CONFIG_BAUDRATE 115200
重新编译,烧写后串口输出如下信息:
cpu和board的信息暂时先不管,发现DRAM大小不对,去配置文件修改:
root@crazyrain:/home/share/uboot/u-boot-2012.10# vim include/configs/x210v3.h
找到下列信息:
/* Goni has 3 banks of DRAM, but swap the bank */
#define CONFIG_NR_DRAM_BANKS 3
#define PHYS_SDRAM_1 CONFIG_SYS_SDRAM_BASE /* OneDRAM Bank #0 */
#define PHYS_SDRAM_1_SIZE (80 << 20) /* 80 MB in Bank #0 */
#define PHYS_SDRAM_2 0x40000000 /* mDDR DMC1 Bank #1 */
#define PHYS_SDRAM_2_SIZE (256 << 20) /* 256 MB in Bank #1 */
#define PHYS_SDRAM_3 0x50000000 /* mDDR DMC2 Bank #2 */
#define PHYS_SDRAM_3_SIZE (128 << 20) /* 128 MB in Bank #2 */
goni有3块内存,x210v3只用了一块512M的。修改为:
/* x210v3 has 1 bank of DRAM */
#define CONFIG_NR_DRAM_BANKS 1
#define PHYS_SDRAM_1 CONFIG_SYS_SDRAM_BASE /* OneDRAM Bank #0 */
#define PHYS_SDRAM_1_SIZE (512 << 20) /* 512 MB in Bank #0 */
//#define PHYS_SDRAM_2 0x40000000 /* mDDR DMC1 Bank #1 */
//#define PHYS_SDRAM_2_SIZE (256 << 20) /* 256 MB in Bank #1 */
//#define PHYS_SDRAM_3 0x50000000 /* mDDR DMC2 Bank #2 */
//#define PHYS_SDRAM_3_SIZE (128 << 20) /* 128 MB in Bank #2 */
保存退出vim,再来make一下,出错了:
x210v3.c: In function 'dram_init':
x210v3.c:52: error: 'PHYS_SDRAM_2_SIZE' undeclared (first use in this function)
x210v3.c:52: error: (Each undeclared identifier is reported only once
x210v3.c:52: error: for each function it appears in.)
x210v3.c:53: error: 'PHYS_SDRAM_3_SIZE' undeclared (first use in this function)
x210v3.c: In function 'dram_init_banksize':
x210v3.c:62: error: 'PHYS_SDRAM_2' undeclared (first use in this function)
x210v3.c:63: error: 'PHYS_SDRAM_2_SIZE' undeclared (first use in this function)
x210v3.c:64: error: 'PHYS_SDRAM_3' undeclared (first use in this function)
x210v3.c:65: error: 'PHYS_SDRAM_3_SIZE' undeclared (first use in this function)
make[1]: *** [x210v3.o] 错误 1
make[1]:正在离开目录 `/home/share/uboot/u-boot-2012.10/board/samsung/x210v3'
make: *** [board/samsung/x210v3/libx210v3.o] 错误 2
错在哪里?信息给得很明显出错目录和文件都给出了,x210v3.c文件52行 由于刚刚去掉了的宏定义导致未定义错误,其他几个信息类似,去修改下:
root@crazyrain:/home/share/uboot/u-boot-2012.10# vim board/samsung/x210v3/x210v3.c
修改前:
int dram_init(void)
{
gd->ram_size = PHYS_SDRAM_1_SIZE + PHYS_SDRAM_2_SIZE +
PHYS_SDRAM_3_SIZE;
return 0;
}
修改后:
int dram_init(void)
{
gd->ram_size = PHYS_SDRAM_1_SIZE;
return 0;
}
修改前:
void dram_init_banksize(void)
{
gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
gd->bd->bi_dram[1].start = PHYS_SDRAM_2;
gd->bd->bi_dram[1].size = PHYS_SDRAM_2_SIZE;
gd->bd->bi_dram[2].start = PHYS_SDRAM_3;
gd->bd->bi_dram[2].size = PHYS_SDRAM_3_SIZE;
}
修改后:
void dram_init_banksize(void)
{
gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
}
保存退出vim,重新make,ok没错了。
烧进sd卡看看运行结果:下面的图是我在ubuntu系统的minicom软件运行的,windows再开个虚拟机电脑实在是吃不消,以后就在linux下面开发了。。。
内存没问题了,警告不管他,后面发现有个oneNAND,开发板没用oneNAND继续修改配置文件x210v3.h:
将下面一行注释掉:
88 //#define CONFIG_CMD_ONENAND
修改环境变量为默认配置:
205 /* FLASH and environment organization */
206 #define CONFIG_ENV_IS_IN_ONENAND 1
207 #define CONFIG_ENV_SIZE (256 << 10) /* 256 KiB, 0x40000 */
208 #define CONFIG_ENV_ADDR (1 << 20) /* 1 MB, 0x100000 */
209
210 #define CONFIG_USE_ONENAND_BOARD_INIT
211 #define CONFIG_SAMSUNG_ONENAND 1
212 #define CONFIG_SYS_ONENAND_BASE 0xB0000000
修改为:
205 /* FLASH and environment organization */
206 //#define CONFIG_ENV_IS_IN_ONENAND 1
207 #define CONFIG_ENV_IS_NOWHERE 1
208 #define CONFIG_ENV_SIZE (256 << 10) /* 256 KiB, 0x40000 */
209 #define CONFIG_ENV_ADDR (1 << 20) /* 1 MB, 0x100000 */
210
211 #define CONFIG_USE_ONENAND_BOARD_INIT
212 #define CONFIG_SAMSUNG_ONENAND 1
213 #define CONFIG_SYS_ONENAND_BASE 0xB0000000
214
改完后重新编译烧写,结果如下:
补充:
但是这里有个问题,发现松开电源按键之后,自动关机了,控制台自然就无法输入了。通过阅读九鼎的裸机教程获得如下解决方法:
在start.S中添加如下代码(在lowlevel_init子过程返回后添加即可):
下面解释这段代码的出处,在x210v3开发板裸机教程里有这么一段: