微波EDA网,见证研发工程师的成长!
首页 > 硬件设计 > 嵌入式设计 > TE2410移植linux-2.6.14及调试过程总结(2)

TE2410移植linux-2.6.14及调试过程总结(2)

时间:11-10 来源:互联网 点击:
今天写总结再来分析一下s3c2410_nand_calc_rate函数,终于知道问题在哪了,之前的打印内容如下:

plat->tacls:0

plat->twrph0:3

plat->twrph1:0

tacls:1

twrph0:1

twrph1:1

clkrate:100000000/*注意是8个0,实际就是是HCLK=100MHz*/

#define NS_IN_KHZ 10000000/*注意是7个0*/

static int s3c2410_nand_calc_rate(int wanted, unsigned long clk, int max)

{

int result;

result = (wanted * NS_IN_KHZ) / clk;

result++;

pr_debug("result %d from %ld, %d\n", result, clk, wanted);

if (result > max) {

printk("%d ns is too big for current clock rate %ld\n",

wanted, clk);

return -1;

}

if (result < 1)

result = 1;

return result;

}

s3c2410_nand_calc_rate(plat->twrph0, clkrate, 8)

即s3c2410_nand_calc_rate(3, 100000000, 8)

则wanted=3, clk=100000000,max=8

result = (wanted * NS_IN_KHZ) / clk

result =(3 * 10000000)/100000000显然结果为0,result++;后返回值为1

按照这个函数的本意应该是要返回4的,如果要修改的话,将它的值NS_IN_KHZ改为与HCLK相同的值,就可以了,我本来想改为100000000,想想如果uboot的FCLK改成202.8MHz,那么HCLK值为101.4MHz,则clkrate为101400000

result = (wanted * NS_IN_KHZ) / clk=(3 * 100000000)/101400000=0

还是不行啊,真该死,终于找到原因了,原来linux源码是没有问题的,在

linux-2.6.14\linux-2.6.14\arch\arm\mach-s3c2410\devs.c中

struct s3c2410_platform_nandsuperlpplatform={

tacls:0,

twrph0:30,/*原来写的是3*/

twrph1:0,

sets:&nandset,

nr_sets:1,

};

串口打印出来内容如下:

plat->tacls:0

plat->twrph0:30

plat->twrph1:0

tacls:1

twrph0:3

twrph1:1

clkrate:101400000

s3c2410-nand: timing: Tacls 10ns, Twrph0 30ns, Twrph1 10ns

5.Reading data from NAND FLASH without ECC is not recommended

VFS: Mounted root (cramfs filesystem) readonly.

Freeing init memory: 92K

Warning: unable to open an initial console.

Reading data from NAND FLASH without ECC is not recommended

sd_mod: version magic 2.6.8.1-ptx1 ARMv4 gcc-3.3 should be 2.6.14 ARMv4 gcc-3.4

usb_storage: version magic 2.6.8.1-ptx1 ARMv4 gcc-3.3 should be 2.6.14 ARMv4 gcc-3.4

usbvideo: version magic 2.6.8.1-ptx1 ARMv4 gcc-3.3 should be 2.6.14 ARMv4 gcc-3.4

ov511: version magic 2.6.8.1-ptx1 ARMv4 gcc-3.3 should be 2.6.14 ARMv4 gcc-3.4

说明一下:之前并没有碰到这个问题,写总结时故意去掉对devfs的支持,出现这样的错误

Warning: unable to open an initial console.

原因是文件系统的dev目录下没有console节点,解决办法有2个,

(1)制作文件系统时在dev目录下建立console节点

(2)make menuconfig时加上对devfs的支持,就可以正常启动

加上对devfs的支持,系统会根据需要自动创建所需节点

用ramdisk作根文件系统:

(1)make menuconfig时要选择支持ext2文件系统,因为ramdisk大多用ext2;

(2)make menuconfig时要选择RAM disk support

(3)make menuconfig时还要选择初始化ramdisk(initrd)

DeviceDrivers ->

Block Device->

<*>RAM disk support

[*]Initial RAM disk(initrd)support

(4)make menuconfig时还要设置好RAM disk的大小

DeviceDrivers ->

Block Device->

<*>RAM disk support

(16)Default number of RAM disks

(4096)Default RAM disk size(kbytes)

加载ramdisk时出现如下问题:

RAMDISK driver initialized:16RAM disks of4096Ksize 1024 blocksize

RAMDISK: Compressed image found at block 0

RAMDISK: incomplete write (-28 != 32768) 4194304

fs_names=ext2

root_mount_data=

VFS: Mounted root (ext2 filesystem).

Mounted devfs on /dev

Freeing init memory: 92K

attempt to access beyond end of device

ram0: rw=0, want=16518, limit=8192

EXT2-fs error (device ram0): ext2_get_inode: unable to read inode block - inode=1944, block=8258

Failed to execute /linuxrc.Attempting defaults...

attempt to access beyond end of device

ram0: rw=0, want=16514, limit=8192

EXT2-fs error (device ram0): ext2_get_inode: unable to read inode block - inode=1922, block=8256

Kernel panic - not syncing: No init found.Try passing init= option to kernel.

解决办法:修改内核关于Ramdisk的设置

make menuconfig

DeviceDrivers ->

Block Device->

<*>RAM disk support

(16)Default number

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top