1 |
12 |
alfik |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
2 |
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
3 |
|
|
<head>
|
4 |
|
|
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
5 |
|
|
<title>ao68000: System-on-Chip example with ao68000 running Linux</title>
|
6 |
|
|
<link href="tabs.css" rel="stylesheet" type="text/css"/>
|
7 |
|
|
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
|
8 |
|
|
</head>
|
9 |
|
|
<body>
|
10 |
|
|
<!-- Generated by Doxygen 1.7.2 -->
|
11 |
|
|
<div class="navigation" id="top">
|
12 |
|
|
<div class="tabs">
|
13 |
|
|
<ul class="tablist">
|
14 |
|
|
<li><a href="index.html"><span>Main Page</span></a></li>
|
15 |
|
|
<li><a href="modules.html"><span>Modules</span></a></li>
|
16 |
|
|
<li><a href="annotated.html"><span>Design Unit List</span></a></li>
|
17 |
|
|
<li><a href="files.html"><span>Files</span></a></li>
|
18 |
|
|
</ul>
|
19 |
|
|
</div>
|
20 |
|
|
<div class="navpath">
|
21 |
|
|
<ul>
|
22 |
|
|
<li><a class="el" href="index.html">index</a> </li>
|
23 |
|
|
</ul>
|
24 |
|
|
</div>
|
25 |
|
|
</div>
|
26 |
|
|
<div class="header">
|
27 |
|
|
<div class="headertitle">
|
28 |
|
|
<h1>System-on-Chip example with <a class="el" href="classao68000.html" title="ao68000 top level module.">ao68000</a> running Linux </h1> </div>
|
29 |
|
|
</div>
|
30 |
|
|
<div class="contents">
|
31 |
|
|
<p>The <a class="el" href="classao68000.html" title="ao68000 top level module.">ao68000</a> IP Core is capable of booting the Linux kernel (<a href="http://www.kernel.org">http://www.kernel.org</a>) up to the <code>init</code> program search.</p>
|
32 |
|
|
<h3>Requirements</h3>
|
33 |
|
|
<ul>
|
34 |
|
|
<li>Linux kernel sources (<a href="http://www.kernel.org">http://www.kernel.org</a>), tested with version 2.6.33.1,</li>
|
35 |
|
|
<li>a MC68000 toolchain (<a href="http://www.gnu.org">http://www.gnu.org</a>), tested with binutils-2.20 and gcc-core-4.4.3,</li>
|
36 |
|
|
<li>a development board to run the system, tested with Terasic DE2-70 board (<a href="http://www.terasic.com.tw">http://www.terasic.com.tw</a>),</li>
|
37 |
|
|
<li>a SDHC card,</li>
|
38 |
|
|
<li>a serial cable to view the output of kernel execution on a serial terminal program.</li>
|
39 |
|
|
</ul>
|
40 |
|
|
<h3>System-on-Chip</h3>
|
41 |
|
|
<p>In order to test the <a class="el" href="classao68000.html" title="ao68000 top level module.">ao68000</a> processor by booting the Linux kernel, a System-on-Chip is prepared and located at: <code>./tests/soc_for_linux_on_terasic_de2_70/verilog/</code>. The system consists of:</p>
|
42 |
|
|
<ul>
|
43 |
|
|
<li>an early boot state machine: early_boot.v,</li>
|
44 |
|
|
<li>a SDHC card controller: sd.v,</li>
|
45 |
|
|
<li>a serial line transmitter: serial_txd.v,</li>
|
46 |
|
|
<li>a SSRAM controller: ssram.v,</li>
|
47 |
|
|
<li>a simple timer: timer.v,</li>
|
48 |
|
|
<li>a top level module, that instantiates the above modules and the <a class="el" href="classao68000.html" title="ao68000 top level module.">ao68000</a> processor: soc_for_linux.v.</li>
|
49 |
|
|
</ul>
|
50 |
|
|
<h3>Step-by-step instruction to prepare the system</h3>
|
51 |
|
|
<ul>
|
52 |
|
|
<li>download the Linux kernel (linux-2.6.33.1.tar.bz2),</li>
|
53 |
|
|
<li>download the toolchain (binutils-2.20.tar.bz2, gcc-core-4.4.3.tar.bz2),</li>
|
54 |
|
|
<li>configure and make Binutils: <br/>
|
55 |
|
|
<code>./configure --prefix=(build prefix) --target=m68knommu-none-linux</code> <br/>
|
56 |
|
|
<code>make</code> <br/>
|
57 |
|
|
<code>make install</code> <br/>
|
58 |
|
|
</li>
|
59 |
|
|
<li>configure and make GCC: <code>./../gcc-4.4.3/configure --prefix=(build prefix) --target=m68knommu-none-linux --disable-threads --disable-shared --disable-libmudflap --disable-libssp --disable-libiberty --disable-zlib --disable-libgomp</code> <br/>
|
60 |
|
|
<code>make</code> <br/>
|
61 |
|
|
<code>make install</code> <br/>
|
62 |
|
|
</li>
|
63 |
|
|
<li>patch the Linux kernel sources by copying the contents of the directory <code>./tests/soc_for_linux_on_terasic_de2_70/software/linux-2.6.33.1-ao68000/</code> into the Linux kernel sources directory,</li>
|
64 |
|
|
<li>configure and make the Linux kernel: <br/>
|
65 |
|
|
<code>make menuconfig ARCH=m68knommu CROSS_COMPILE=(build prefix)/bin/m68knommu-none-linux-</code> <br/>
|
66 |
|
|
<code>make ARCH=m68knommu CROSS_COMPILE=(build prefix)/bin/m68knommu-none-linux-</code> <br/>
|
67 |
|
|
</li>
|
68 |
|
|
<li>convert the Linux kernel binary in ELF format into a flat binary format: <code>(build prefix)//bin/m68knommu-none-linux-objcopy -O binary vmlinux vmlinux.bin</code> <br/>
|
69 |
|
|
</li>
|
70 |
|
|
<li>synthesise the <code>soc_for_linux</code> with the Altera Quartus II tool. The instructions to perform the synthesis are located in the makefile located at: <code>./Makefile</code>,</li>
|
71 |
|
|
<li>prepare a SDHC card with the software:<ul>
|
72 |
|
|
<li>copy the first 8 bytes of memory form the file <code>./tests/soc_for_linux_on_terasic_de2_70/sd_card/sector0.dat</code>: <br/>
|
73 |
|
|
<code>dd if=sector0.dat of=/dev/(SD card device)</code> This file contains the SSP and PC values read by the <a class="el" href="classao68000.html" title="ao68000 top level module.">ao68000</a> processor after booting.</li>
|
74 |
|
|
<li>copy the Linux kernel flat binary, at offset 1024: <br/>
|
75 |
|
|
<code>dd if=vmlinux.bin of=/dev/(SD card device) bs=1024 seek=1</code> <br/>
|
76 |
|
|
</li>
|
77 |
|
|
</ul>
|
78 |
|
|
</li>
|
79 |
|
|
<li>insert the SDHC card into the reader in the Terasic DE2-70 board,</li>
|
80 |
|
|
<li>load the synthesised SOF file into the FPGA</li>
|
81 |
|
|
<li>look at the output of the kernel console by opening a serial terminal application and reading the output of the board.</li>
|
82 |
|
|
</ul>
|
83 |
|
|
<h3>Notes</h3>
|
84 |
|
|
<ul>
|
85 |
|
|
<li>the SLOB allocator and not the default SLAB allocator had to be selected because of a problem in the kernel sources (in_interrupt() check before enabling the interrupts (at in ./kernel/slab.c:2109)),</li>
|
86 |
|
|
<li>the source file in the Linux kernel: <code>./init/initramfs.c</code> compiled with the GCC option <code>-m68000</code> contains illegal code to execute on a MC68000 (copy a long word from an unaligned address). Even after correcting this problem, the kernel did not want to boot reliably (sometimes it booted and found the init program, sometimes not).</li>
|
87 |
|
|
</ul>
|
88 |
|
|
<h3>Linux console output</h3>
|
89 |
|
|
<p>The output of the running kernel is presented below: </p>
|
90 |
|
|
<div class="fragment"><pre class="fragment">Linux version 2.6.33.1 (alek@gesserit) (gcc version 4.4.3 (GCC) ) #11 Sun Mar 21
|
91 |
|
|
13:47:14 CET 2010
|
92 |
|
|
|
93 |
|
|
AO68000 support Aleksander Osman <alfik@poczta.fm>
|
94 |
|
|
|
95 |
|
|
uClinux/AO68000
|
96 |
|
|
|
97 |
|
|
Flat model support (C) 1998,1999 Kenneth Albanowski, D. Jeff Dionne
|
98 |
|
|
Built 1 zonelists in Zone order, mobility grouping off. Total pages: 254
|
99 |
|
|
Kernel command line:
|
100 |
|
|
PID hash table entries: 16 (order: -6, 64 bytes)
|
101 |
|
|
Dentry cache hash table entries: 1024 (order: 0, 4096 bytes)
|
102 |
|
|
Inode-cache hash table entries: 1024 (order: 0, 4096 bytes)
|
103 |
|
|
Memory available: 400k/1024k RAM, (492k kernel code, 74k data)
|
104 |
|
|
Hierarchical RCU implementation.
|
105 |
|
|
RCU-based detection of stalled CPUs is enabled.
|
106 |
|
|
NR_IRQS:32
|
107 |
|
|
console [ttyDE20] enabled
|
108 |
|
|
Calibrating delay loop... 6.55 BogoMIPS (lpj=32768)
|
109 |
|
|
Mount-cache hash table entries: 512
|
110 |
|
|
Switching to clocksource jiffies
|
111 |
|
|
Freeing unused kernel memory: 20k freed (0x81000 - 0x85000)
|
112 |
|
|
Warning: unable to open an initial console.
|
113 |
|
|
Kernel panic - not syncing: No init found. Try passing init= option to kernel.
|
114 |
|
|
Stack from 000c6f9a:
|
115 |
|
|
000c6fca 0007272a 00077560 00087332 00087332 00000400 000765f6 000c6fd6
|
116 |
|
|
00000001 00080fb8 00000698 000765ee 00080ff8 00000752 000765f6 000765ee
|
117 |
|
|
000765e4 000765da 000765cf 0008691c 000811f8 00000b00 000862d4 00000dc2
|
118 |
|
|
00000000
|
119 |
|
|
|
120 |
|
|
Call Trace with CONFIG_FRAME_POINTER disabled:
|
121 |
|
|
[0007272a] [00077560] [00000400] [000765f6] [00000698]
|
122 |
|
|
[000765ee] [00000752] [000765f6] [000765ee] [000765e4]
|
123 |
|
|
[000765da] [000765cf] [000811f8] [00000b00] [00000dc2]
|
124 |
|
|
</pre></div> </div>
|
125 |
17 |
alfik |
<hr class="footer"/><address class="footer"><small>Generated on Sun Jan 16 2011 11:00:03 for ao68000 by 
|
126 |
12 |
alfik |
<a href="http://www.doxygen.org/index.html">
|
127 |
|
|
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.2 </small></address>
|
128 |
|
|
</body>
|
129 |
|
|
</html>
|