QQ登录

只需一步,快速开始

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 2891|回复: 3

求助:skyeye 的nandflash模拟是否只支持s3c2410

[复制链接]
发表于 2009-2-22 22:57:10 | 显示全部楼层 |阅读模式
我用skyeye调试vivi,模拟s3c2440的nandflash方式启动,结果发现在nandflash的读函数中执行一定步数后,程序就跑乱掉了,下面是nandflash的读函数。

#include <config.h>

#define __REGb(x)        (*(volatile unsigned char *)(x))
#define __REGi(x)        (*(volatile unsigned int *)(x))
#define NF_BASE                0x4e000000

#define NFCONF                __REGi(NF_BASE + 0x0)
#define NFCONT                __REGi(NF_BASE + 0x4)
#define NFCMD                __REGb(NF_BASE + 0x
#define NFADDR                __REGb(NF_BASE + 0xC)
#define NFDATA                __REGb(NF_BASE + 0x10)
#define NFSTAT                __REGb(NF_BASE + 0x20)

//#define GPDAT                __REGi(GPIO_CTL_BASE+oGPIO_F+oGPIO_DAT)

#define NAND_CHIP_ENABLE  (NFCONT &= ~(1<<1))
#define NAND_CHIP_DISABLE (NFCONT |=  (1<<1))
#define NAND_CLEAR_RB          (NFSTAT |=  (1<<2))
#define NAND_DETECT_RB          { while(! (NFSTAT&(1<<2)) );}

#define BUSY 4
inline void wait_idle(void) {
        while(!(NFSTAT & BUSY));
        NFSTAT |= BUSY;
}

#define NAND_SECTOR_SIZE        512
#define NAND_BLOCK_MASK                (NAND_SECTOR_SIZE - 1)

/* low level nand read function */
int
nand_read_ll(unsigned char *buf, unsigned long start_addr, int size)
{
        int i, j;

        if ((start_addr & NAND_BLOCK_MASK) || (size & NAND_BLOCK_MASK)) {
                return -1;        /* invalid alignment */
        }

        NAND_CHIP_ENABLE;

        for(i=start_addr; i < (start_addr + size);) {
                /* READ0 */
                NAND_CLEAR_RB;            
                NFCMD = 0;

                /* Write Address */
                NFADDR = i & 0xff;
                NFADDR = (i >> 9) & 0xff;
                NFADDR = (i >> 17) & 0xff;
                NFADDR = (i >> 25) & 0xff;

                NAND_DETECT_RB;

                for(j=0; j < NAND_SECTOR_SIZE; j++, i++) {
                        *buf = (NFDATA & 0xff);
                        buf++;
                }
        }
        NAND_CHIP_DISABLE;
        return 0;
}
该函数应该没有问题,因为我调试的vivi是实验板自带的,是不是在skyeyek中仿真nandflash时对nandflash的读写函数有什么特殊要求?

[ 本帖最后由 huangzhendi 于 2009-2-23 01:36 编辑 ]
发表于 2009-2-23 08:54:39 | 显示全部楼层
回复

使用道具 举报

 楼主| 发表于 2009-2-23 13:30:16 | 显示全部楼层
**************************** WARNING **********************************
If you want to run ELF image, you should use -e option to indicate
your elf-format image filename. Or you only want to run binary image,
you need to set the filename of the image and its entry in skyeye.conf.
***********************************************************************

Your elf file is little endian.
arch: arm
cpu info: armv4, arm920t, 41009200, ff00fff0, 2
mach info: name s3c2410x, mach_init addr 0x806e790
ethmod num=1, mac addr=8:0:3e:26:a:5b, hostip=10.0.0.1
nandflash: dump ./nand.dump
file size:69206016
dbct info: turn on dbct!
uart_mod:0, desc_in:, desc_out:, converter:
SKYEYE: use arm920t mmu ops
Loaded RAM   ./vivi
ERROR: s3c2410x_io_write_word(0x4c000000) = 0x00ffffff

VIVI version 0.1.4 ([email protected]) (gcc version 4.2.2) #0.1.4 2009年 02月 23日 星期一 00:24:24 CST
MMU table base address = 0x33DFC000
NAND device: Manufacture ID: 0xec, Chip ID: 0x76 (Samsung K9D1208V0M)
Found default vivi parameters
Press Return to start the LINUX now, any other key for vivi
Copy linux kernel from 0x00030000 to 0x30008000, size = 0x00100000 ... done
Warning: this binary is not compressed linux kernel image
zImage magic = 0xffffffff
Setup linux parameters at 0x30000100
linux command line is: "noinitrd root=/dev/mtdblock/2 init=/linuxrc console=ttyS0"
MACH_TYPE = 193
NOW, Booting Linux......
启动成功了,原因是我使用skyeye命令默认生成的nand.dump,改用http://www.linuxfans.org/bbs/thread-184643-1-5.html的方法生成nand.dump后就正常了 。但由于采用了nandflash,没有办法用仿真跟踪代码,感觉是因为开始部分代码的运行地址是0x00000000开始的,与elf文件中的装载地址不一致所。
回复

使用道具 举报

发表于 2010-6-29 20:48:55 | 显示全部楼层
楼主 ~~~楼主

求教啊

我正在尝试skyeye 用vivi 引导。。

但是skyeye.conf就不知道怎么写。。。

就用过skyeye用u-boot引导。老师留的思考题
帮帮忙好么 谢谢了啊
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

GMT+8, 2024-4-19 06:00 , Processed in 0.069146 second(s), 15 queries .

© 2021 Powered by Discuz! X3.5.

快速回复 返回顶部 返回列表