之前我们在ML501上构建了仿真,调试系统,并成功运行了orpmon,但是这些还不够,我们还要运行OS才行。
本小节基于前面的工作,启动linux。
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。
由于UBUNTU镜像中的linux默认是针对ordb2a的,我们现在要在ML501上启动linux,所以需要修改linux的clock-freqency。
修改文件的路径为:soc-design/linux/arch/openrisc/boot/dts/ordb2a.dts。
有两个地方需要修改:将50000000改为66666667(ML501的工作频率)。
首先是CPU的频率:
其次是serial0中的频率:
在修改之后,make生成vmlinux文件。
参考(http://blog.csdn.net/rill_zhen/article/details/17011957)中的操作步骤,用or32-elf-gdb和adv_jtag_bridge将vmlinux文件load到ML501板子上的DDR2 SDRAM(256MB)中。
将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
自此,我们在ML501上完成了ORPSoC的RTL仿真,debug系统的构建,并成功跑起来了linux。剩下的工作就和我们之前在ordb2a上做的差不多了,编写wishbone i/f的IPcore,编写对应的linux驱动和应用程序,这些内容我们已经介绍过了,如有疑问,请参考。
Enjoy!