OpenRisc-60-在ML501上运行ORPSoC并启动linux

引言

之前我们在ML501上构建了仿真,调试系统,并成功运行了orpmon,但是这些还不够,我们还要运行OS才行。

本小节基于前面的工作,启动linux。


1,资源准备

1>ORPSoC

针对ML501的ORPSoC的RTL工程采用(http://blog.csdn.net/rill_zhen/article/details/17011957)构建的ise工程。

2>linux

采用(http://opencores.org/or1k/Ubuntu_VirtualBox-image_updates_and_information)镜像中的soc-design/linux。

3>串口终端采用putty,版本为0.63。


2,linux的修改

由于UBUNTU镜像中的linux默认是针对ordb2a的,我们现在要在ML501上启动linux,所以需要修改linux的clock-freqency。

修改文件的路径为:soc-design/linux/arch/openrisc/boot/dts/ordb2a.dts。

有两个地方需要修改:将50000000改为66666667(ML501的工作频率)。

首先是CPU的频率:



其次是serial0中的频率:



在修改之后,make生成vmlinux文件。


3,linux的下载

linux的下载方式有很多,大体可分成两类:使用bootloader和使用jtag。
使用bootloader的方式,一般是先将o-boot或者orpmon通过jtag下到RAM或者flash里面,启动u-boot或者orpmon,然后再通过网口将vmlinux下载到RAM里面。
采用这种方式的话,对于u-boot,一般采用nfs或者tftp,这方面的资料很多,这里不再赘述。
需要说明的是如果采用orpmon,首先用“tftp_conf filename server_ip”来配置tftp的PC端的ip地址和待下载的文件名称,然后通过“tboot”即可自动下载并启动。当然在执行tboot之前还打开PC端的tftp server软件并将vmlinux复制到tftp server软件所在的目录下,并修改PC的IP地址,使之和板子的ip在同一网段。
另外一种方式就是直接用jtag将vmlinux下载到RAM。

参考(http://blog.csdn.net/rill_zhen/article/details/17011957)中的操作步骤,用or32-elf-gdb和adv_jtag_bridge将vmlinux文件load到ML501板子上的DDR2 SDRAM(256MB)中。


4,linux的启动

将vmlinux下载到RAM之后,在开始启动linux之前(在or32-elf-gdb中设置好启动地址(0x100)后,输入‘c’即可运行linux),用USB转UART线连接ML501的串口连到PC机,打开putty(115200,8,n,1,n),运行linux,即可看到linux的启动效果。

如下图所示:




从上图中我们看到板子的网络参数,下面是在ML501板子上运行ORPSoCv2并启动linux的全部信息:


Compiled-in FDT at 0xc0265640
Linux version 3.1.0-rc6-00002-g0da8eb1-dirty (openrisc@openrisc-V version 4.5.1-or32-1.0rc4 (OpenRISC 32-bit toolchain for or32-li1017)) ) #37 Thu Dec 5 06:58:36 CET 2013
CPU: OpenRISC-12 (revision 8) @66 MHz
-- dcache: 32768 bytes total, 32 bytes/line, 1 way(s)
-- icache: 32768 bytes total, 32 bytes/line, 1 way(s)
-- dmmu:   64 entries, 1 way(s)
-- immu:   64 entries, 1 way(s)
-- additional features:
-- debug unit
-- PIC
-- timer
setup_memory: Memory: 0x0-0x2000000
Reserved - 0x01ffda90-0x00002570
Setting up paging and PTEs.
map_ram: Memory: 0x0-0x2000000
On node 0 totalpages: 4096
free_area_init_node: node 0, pgdat c024c28c, node_mem_map c03c600
  Normal zone: 16 pages used for memmap
  Normal zone: 0 pages reserved
  Normal zone: 4080 pages, LIFO batch:0
dtlb_miss_handler c0002000
itlb_miss_handler c0002108
OpenRISC Linux -- http://openrisc.net
pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
pcpu-alloc: [0] 0
Built 1 zonelists in Zone order, mobility grouping off.  Total pa
Kernel command line: console=uart,mmio,0x90000000,115200
===============================================
Early serial console at MMIO 0x90000000 (options '115200')
bootconsole [uart0] enabled
PID hash table entries: 128 (order: -4, 512 bytes)
Dentry cache hash table entries: 4096 (order: 1, 16384 bytes)
Inode-cache hash table entries: 2048 (order: 0, 8192 bytes)
Memory: 28672k/32768k available (2036k kernel code, 4096k reserve416k init, 0k highmem)
mem_init_done ...........................................
NR_IRQS:32
133.33 BogoMIPS (lpj=666666)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 1024
devtmpfs: initialized
NET: Registered protocol family 16
Switching to clocksource openrisc_timer
Switched to NOHz mode on CPU #0
NET: Registered protocol family 2
IP route cache hash table entries: 2048 (order: 0, 8192 bytes)
TCP established hash table entries: 1024 (order: 0, 8192 bytes)
TCP bind hash table entries: 1024 (order: -1, 4096 bytes)
TCP: Hash tables configured (established 1024 bind 1024)
TCP reno registered
UDP hash table entries: 512 (order: 0, 8192 bytes)
UDP-Lite hash table entries: 512 (order: 0, 8192 bytes)
NET: Registered protocol family 1
RPC: Registered named UNIX socket transport module.
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
Unpacking initramfs
Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
===============================================
90000000.serial: ttyS0 at MMIO 0x90000000 (irq = 2) is a 16550A
console [ttyS0] enabled, bootconsole disabled
console [ttyS0] enabled, bootconsole disabled
===============================================
ethoc-mdio: probed
NET: Registered protocol family 17
Freeing unused kernel memory: 1416k freed
init started: BusyBox v1.19.0.git (2011-02-16 08:10:12 CET)
Configuring loopback device

Please press Enter to activate this console.
# ls
bin   dev   etc   init  mnt   proc  root  sbin  sys   usr   var


5,小结

自此,我们在ML501上完成了ORPSoC的RTL仿真,debug系统的构建,并成功跑起来了linux。剩下的工作就和我们之前在ordb2a上做的差不多了,编写wishbone i/f的IPcore,编写对应的linux驱动和应用程序,这些内容我们已经介绍过了,如有疑问,请参考。

Enjoy!




  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值