O_board-1-快速开始

引言
文档的重要性,是不言而喻的。昨天晚上最新版的O_board焊接完回来之后,就需要测试一下。具体如何快速测试板子有没有问题呢?本小节将通过O_board启动linux来解决这个问题。

同时,快速测试不仅可以判断板子有没有问题,还可以建立和板子的最初的感觉。

1,资源准备
1>下载vbox镜像

http://opencores.org/or1k/Ubuntu_VirtualBox-image_updates_and_information

2>下载并安装virtualbox

https://www.virtualbox.org/wiki/Downloads

3>准备svf文件和vmlinux文件

http://download.csdn.net/detail/rill_zhen/6878609

1》cp orpsoc_top.svf ~/fpga_dev_board/ordb2a-ep4ce22/

3》cp vmlinux ~/soc-design/linux/

上述资料除了从官网下载之外,我已经将关于O_board的资料放到了360云盘里,请参考:

http://yunpan.360.cn/

用户名:是“开源cpu爱好群”的群邮箱:277505520@qq.com

密码 :是“开源cpu爱好群”的群号:277505520

2,操作步骤
===============================================================
Program ORSoC’s OpenRISC-FPGA-development-board and run Linux
===============================================================

1. Connect your O_board to your computer using the
USB connector located on the top-left corner on the board.

2. Start a terminal and type:
$ cd ~/fpga_dev_board/ordb2a-ep4ce22
$ jtag ./program_fpga.jtag

The file “program_fpga.jtag” defines what FPGA programming file
that should be used.

3. The FPGA is now programmed with a pre-compiled OpenRISC
processor SOC-design, with the OpenRISC processor, Ethernet,
SDHC, UART and SDRAM support. An small boot-loader is stored
in the SPI-flash and should now be loaded and executed
by the OpenRISC processor.

4. Let’s now try and download Linux to the SDRAM and then boot it
on the OpenRISC SoC design. There are many ways that we can
boot Linux, we can use GDB, we can use orpmon and download it
using TFTP, or we can program the SPI-flash. We will using GDB
in demo. Open up a new terminal tab (shift+ctrl+t) and type:
$ /opt/or_debug_proxy/bin/or_debug_proxy -r 55555

This starts a program (or_debug_proxy) that controls the
USB connection and communication between the GDB debugger and
the OpenRISC processor.

You should see the follwoing print-out:


Connecting to OR1k via USB debug cable
Initialising USB JTAG interface
JTAG ID = a188a928
Stalling OR1K CPU0
Read npc = 0001727c ppc = 00017278 r1 = 00031774
Waiting for gdb connection on localhost:55555
Press CTRL+c to exit.

5. Open up a new terminal tab (shift+ctrl+t) and type:
$ picocom –b 115200 –p n –d 8 –f xon /dev/ttyUSB2

This UART connection will be our Linux-terminal when we boot-up
Linux on the OpenRISC SoC-design.

6. Open up a new terminal tab (shift+ctrl+t) and type:
$ cd ~/soc-design/linux
$ make ARCH=openrisc defconfig
$ make ARCH=openrisc
$ or32-elf-gdb

The GDB-debugger is now started and you need to connect it to
the or_debug_proxy program, by typing:
(gdb) target remote :55555

GDB is now connected to the OpenRISC processor and are now
waiting. Lets now download the Linux-image, by typing:
(gdb) file ./vmlinux
Answer “y” on the questions.

(gdb) load

The actual download of the Linux image is now in progress and
this takes some time, since the JTAG interface is not the
fastest one. The following load information should appear:


Loading section .text, size 0x22bd34 lma 0x0
Loading section .rodata, size 0x49860 lma 0x22c000
Loading section __param, size 0x1c0 lma 0x275860
Loading section .data, size 0x15760 lma 0x276000
Loading section __ex_table, size 0xa50 lma 0x28b760
Loading section .head.text, size 0x4000 lma 0x28e000
Loading section .init.text, size 0x12348 lma 0x292000
Loading section .init.data, size 0x155e54 lma 0x2a4360
Start address 0xc0000000, load size 4160160
Transfer rate: 86 KB/sec, 4015 bytes/write.

Now we want to set the program-counter to start executing
from address 0x100, by typing:
(gdb) spr npc 0x100

Now let’s boot up Linux on the FPGA development board, by typing:
(gdb) c

You should now see Linux booting in the picocom-terminal-window
that was opened earlier. And you should get a prompt where you
can play around with the Linux port that is running on the
OpenRISC processor system.

For example, you can plug in your board into your Ethernet network
and get an IP address by typing:
# ifup eth0

Your network should now provide your board with an IP address (DHCP)
and you can test your connection by pinging a known IP address.

3,小结
所有板子在发货之前,我都会亲自一一进行测试。如果一切顺利,这个测试很快就会完成。测试之后,就可以用O_board来进行实际的开发和学习了,请参考:

http://blog.csdn.net/column/details/openrisc.html

原文链接:https://blog.csdn.net/rill_zhen/article/details/18714643

本文出自:https://blog.csdn.net/rill_zhen/article/details/18714643