skyeye模拟u-boot在s3c2410上运行

2023-05-10  

前面成功的移植了u-boot(其实只能是说是编译成功,还谈不上是真正的移植,(*^__ ^*) ),下面开始在skyeye中来运行u-boot

在编译u-boot时,所作的修改如下

#ifdef CONFIG_AMD_LV400
#define PHYS_FLASH_SIZE        0x00080000 /* 512KB */
#define CFG_MAX_FLASH_SECT      (11) /* max number of sectors on one chip */
#define CFG_ENV_ADDR           (CFG_FLASH_BASE + 0x070000) /* addr of environment */
#endif
改为:
#ifdef CONFIG_AMD_LV400
#define PHYS_FLASH_SIZE        0x01000000 /* 16MB */
#define CFG_MAX_FLASH_SECT      (128)      /* max number of sectors on one chip */
#define CFG_ENV_ADDR           (CFG_FLASH_BASE + 0x020000) /* addr of environment */
#endif

根据上面的做作的修改,同时在参考http://blog.chinaunix.net/u1/56374/showart_570048.html

http://hi.baidu.com/yyq669669/blog/item/bb667a109dc3facca7ef3f97.html中的skyeye.conf

文件的配置,做法如下:

新建目录smdk2410,将u-boot编译成功的u-boot拷贝到该目录下,然后将下面的skyeye.conf同样拷贝到该文件夹下。

cpu: arm920t

arch: arm

mach: s3c2410x

mem_bank:map=I,type=RW,addr=0x48000000,size=0x20000000

#注意此处的addr一定要与上面smdk2410.h配置的SDRAM和FLASH的大小与基地址一定要相同,否则启动不起来,卡在那里。

#下面这一句和FLASH一样

mem_bank:map=M,type=RW,addr=0x00000000,size=0x04000000,file=u-boot,boot=yes

#下面这一句和SDRAM一样

mem_bank:map=M,type=RW,addr=0x30000000,size=0x04000000

执行skyeye命令,但是出现错误:Bus Read Error错误

偶然在测试skyeye的testsuites时,同样出现错误,于是怀疑是skyeye的版本问题,所以开始安装skyeye的较低版本(1.2.8)

,解压完下载的skyeye-1.2.8_rc1.tar.gz,在解压完的目录中的README中有下面的information

5 Tested Environment

X86-32:

CygWin/MinGW

gcc-3.4, gcc-4.1.2

Linux (Debian)

gcc-3.3 gcc-3.4

gcc-2.95 gcc-4.0 (doesn't support DBCT)

BeOS (R5.0.3, Exp-Dano)

gcc-2.95 + gcc-3.4.3

X86-64:

Linux (Fedra)

gcc-3.4 for X86-64 (doesn't support DBCT)

由于在ubuntu上没有安装gcc版本,所以得开始安装gcc-3.4,比较省事的方法是下载deb的包来安装,在安装的过程中可能存在

相关依赖项的问题,解决的方案就是“缺哪个安哪个”。gcc-3.4安装完毕之后,在继续安装skyeye 1.2.6版本。

sudo mkdir /opt/skyeye-1.2.6

export CC=gcc-3.4

./configure --prefix=/opt/skyeye-1.2.6/

make

第一次出现:makeinfo : command not found

于是sudo apt-get install texinfo

然后执行

make clean

make

现在skyeye编译完成生成skyeye可执行文件

下面继续测试u-boot

返回smdk2410目录下,执行skyeye命令即可进入u-boot。

xuqiang@ubuntu:~/Desktop/smdk2410$ /opt/skyeye-1.2.6/skyeye -e u-boot

Your elf file is little endian.

arch: arm

cpu info: armv4, arm920t, 41009200, ff00fff0, 2 

mach info: name s3c2410x, mach_init addr 0x8069531

arch: arm

uart_mod:0, desc_in:, desc_out:, converter:

SKYEYE: use arm920t mmu ops

Loaded RAM   ./u-boot

start addr is set to 0x33f80000 by exec file.

ERROR: s3c2410x_io_write_word(0x4c000000) = 0x00ffffff

ERROR: s3c2410x_io_write_word(0x4c000008) = 0x00048032

U-Boot 1.1.6 (Feb 23 2010 - 05:30:09)

DRAM:  64 MB

Flash: 16 MB

*** Warning - bad CRC, using default environment

In:    serial

Out:   serial

Err:   serial

ERROR: s3c2410x_io_write_word(0x1900030a) = 0x00000000

SMDK2410 # date

ERROR: s3c2410x_io_write_word(0x57000040) = 0xffffffff

ERROR: s3c2410x_io_write_word(0x57000040) = 0xfffffffe

Date: 2065-25-45 (unknown day)    Time: 45:85:85

SMDK2410 # help

?       - alias for 'help'

autoscr - run script from memory

base    - print or set address offset

bdinfo  - print Board Info structure

boot    - boot default, i.e., run 'bootcmd'

bootd   - boot default, i.e., run 'bootcmd'

bootelf - Boot from an ELF image in memory

bootm   - boot application image from memory

bootp - boot image via network using BootP/TFTP protocol

bootvx  - Boot vxWorks from an ELF image

cmp     - memory compare

coninfo - print console devices and information

cp      - memory copy

crc32   - checksum calculation

date    - get/set/reset date & time

dcache  - enable or disable data cache

echo    - echo args to console

erase   - erase FLASH memory

flinfo  - print FLASH memory information

go      - start application at address 'addr'

help    - print online help

icache  - enable or disable instruction cache

iminfo  - print header information for application image

imls    - list all images found in flash

itest - return true/false on integer compare

loadb   - load binary file over serial line (kermit mode)

loads   - load S-Record file over serial line

loady   - load binary file over serial line (ymodem mode)

loop    - infinite loop on address range

md      - memory display

mm      - memory modify (auto-incrementing)

mtest   - simple RAM test

mw      - memory write (fill)

nfs - boot image via network using NFS protocol

nm      - memory modify (constant address)

printenv- print environment variables

protect - enable or disable FLASH write protection

rarpboot- boot image via network using RARP/TFTP protocol

reset   - Perform RESET of the CPU

run     - run commands in an environment variable

saveenv - save environment variables to persistent storage

setenv  - set environment variables

sleep   - delay execution for some time

tftpboot- boot image via network using TFTP protocol

version - print monitor version

下面将上面的注意整理如下:

1.首先是注意的是版本的问题:skyeye需要使用1.2.6的才能运行

2.注意的是skyeye.conf配置文件,该部分参见

我们来分析"include/configs/smdk2410.h"

/*-----------------------------------------------------------------------
 * Physical Memory Map
 */
#define CONFIG_NR_DRAM_BANKS    1          /* we have 1 bank of DRAM */

#define PHYS_SDRAM_1            0x30000000 /* SDRAM Bank #1 */起始地址

#define PHYS_SDRAM_1_SIZE       0x04000000 /* 64 MB */大小

#define PHYS_FLASH_1            0x00000000 /* Flash Bank #1 */

#define CFG_FLASH_BASE          PHYS_FLASH_1

所以我们的
mem_bank: map=M, type=RW, addr=0x30000000, size=0x01000000
要改为:
mem_bank: map=M, type=RW, addr=0x30000000, size=0x04000000

再看
/*-----------------------------------------------------------------------
 * FLASH and environment organization
 */

#define CONFIG_AMD_LV400        1       /* uncomment this if you have a LV400 flash */
#if 0
#define CONFIG_AMD_LV800        1       /* uncomment this if you have a LV800 flash */
#endif

#define CFG_MAX_FLASH_BANKS     1       /* max number of memory banks */
#ifdef CONFIG_AMD_LV800
#define PHYS_FLASH_SIZE         0x00100000 /* 1MB */
#define CFG_MAX_FLASH_SECT      (19)    /* max number of sectors on one chip */
#define CFG_ENV_ADDR            (CFG_FLASH_BASE + 0x0F0000) /* addr of environment */
#endif
#ifdef CONFIG_AMD_LV400
#define PHYS_FLASH_SIZE         0x00080000 /* 512KB */
#define CFG_MAX_FLASH_SECT      (11)    /* max number of sectors on one chip */
#define CFG_ENV_ADDR            (CFG_FLASH_BASE + 0x070000) /* addr of environment */
#endif


#define PHYS_FLASH_1            0x00000000 /* Flash Bank #1 */起始地址
#define PHYS_FLASH_SIZE         0x00080000 /* 512KB */大小

所以我们的

mem_bank: map=M, type=RW, addr=0x00000000, size=0x01000000, file=./u-boot, boot=yes
要改为:
mem_bank: map=M, type=RW, addr=0x00000000, size=0x00080000, file=./u-boot, boot=yes

这时候你的skyeye-smdk2410主板就配置好了。

最终的skyeye.conf文件如下:

#skyeye config file sample

cpu: arm920t

mach: s3c2410x

arch: arm

#physical memory

mem_bank: map=M, type=RW, addr=0x00000000, size=0x00080000, file=./u-boot, boot=yes

mem_bank: map=M, type=RW, addr=0x30000000, size=0x04000000

#all peripherals I/O mapping area

mem_bank: map=I, type=RW, addr=0x48000000, size=0x20000000

mem_bank: map=I, type=RW, addr=0x19000300, size=0x00000020


文章来源于:电子工程世界    原文链接
本站所有转载文章系出于传递更多信息之目的,且明确注明来源,不希望被转载的媒体或个人可与我们联系,我们将立即进行删除处理。