-
Notifications
You must be signed in to change notification settings - Fork 1
/
part-05.html
158 lines (96 loc) · 8.86 KB
/
part-05.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
<meta http-equiv="X-UA-Compatible" content="chrome=1" />
<meta name="description" content="ZYBO Quick-Start Tutorial : Quick-start tutorial for the Digilent ZYBO Zynq-7010 FPGA board using ISE 14/PlanAhead" />
<link rel="stylesheet" type="text/css" media="screen" href="stylesheets/stylesheet.css">
<link rel="shortcut icon" href="favicon.ico" />
<title>ZYBO Quick-Start Tutorial</title>
</head>
<body>
<!-- HEADER -->
<div id="header_wrap" class="outer">
<header class="inner" itemscope itemtype="http://schema.org/Thing">
<!--
<a id="forkme_banner" href="https://github.com/sunsided/zybo-tutorial">View on GitHub</a>
-->
<a href="index.html"><h1 id="project_title" itemprop="name">ZYBO Quick-Start Tutorial</h1></a>
<h2 id="project_tagline" itemprop="additionalName">Quick-start tutorial for the Digilent ZYBO Zynq-7010 FPGA board using ISE 14/PlanAhead</h2>
<!--
<section id="downloads">
<a class="zip_download_link" href="https://github.com/sunsided/zybo-tutorial/zipball/master">Download this project as a .zip file</a>
<a class="tar_download_link" href="https://github.com/sunsided/zybo-tutorial/tarball/master">Download this project as a tar.gz file</a>
</section>
-->
</header>
</div>
<!-- MAIN CONTENT -->
<div id="main_content_wrap" class="outer">
<section id="main_content" class="inner">
<h2>Part 5: Programming the Processing System</h2>
<h3><a name="application-and-bsp" class="anchor" href="#application-and-bsp"><span class="octicon octicon-link"></span></a>Create an Application Project and a Board Support Package</h3>
<p>When selecting <code>Launch SDK</code> from the Export Hardware for SDK dialog for the first time, Xilinx SDK will open up and present us a project consisting of nothing but the hardware platform specification.</p>
<p>You will find any useful information about memory addresses and components here. Note also the existence of the bitstream file, <code>system.bit</code>. If it does not appear here, go back to PlanAhead an step redo the export step. (You might have to open the implementation result manually in PlanAhead before being able to doing so.)</p>
<img src="images/tutorial-1/tutorial-121.png" title="Xilinx SDK" />
<p>Select <code>File, New, Application Project</code> to create a new project. When asked for a template, select <code>Hello World</code>. This option does not always seem to appear, though.</code></p>
<img src="images/tutorial-1/tutorial-122.png" title="Xilinx SDK: New Application Project" />
<p>Give the project a name, select the just exported hardware platform and chose to <code>Create a new Board Support Package</code>, then click <code>Finish</code>.</p>
<img src="images/tutorial-1/tutorial-123.png" title="Xilinx SDK: New Project, new BSP" />
<p>After that, wait for the build of the BSP to finish.</p>
<img src="images/tutorial-1/tutorial-124.png" title="Xilinx SDK: Project" />
<p>Switch over to <code>helloworld.c</code> and enter <code>while(1) {}</code> just before the <code>return</code> statement to prevent the processor from halting.</p>
<img src="images/tutorial-1/tutorial-125.png" title="Xilinx SDK: Hello World" />
<h3><a name="program-fpga" class="anchor" href="#program-fpga"><span class="octicon octicon-link"></span></a>Program FPGA</h3>
<p>Before running the program, we need to program the FPGA with the bitfile. In the toolbar, click <code>Program FPGA</code>.</code></p>
<img src="images/tutorial-1/tutorial-126.png" title="Xilinx SDK: Programming the FPGA" />
<p>Make sure the exported Bitstream is selected. If the field is empty and the <code>Search...</code> box lists no bitstream file, you probably missed exporting it to the SDK. You may either repeat that step or use <code>Browse...</code> here to navigate to the bitstream file up the directory hierarchy.</p>
<p>With a bitstream file selected, click <code>Program</code>.</p>
<img src="images/tutorial-1/tutorial-127.png" title="Program FPGA" />
<p>When doing this for the first time you will probably run into the error message <code>Program FPGA failed</code> due to the missing Xilinx Hardware Server.</p>
<img src="images/tutorial-1/tutorial-128.png" title="Program FPGA Failed" />
<p>Since we do not use that — we have the Digilent plugins instead — we need to change the programmer cable settings using the <code>Xilinx Tools, Configure JTAG Settings</code> menu.</p>
<img src="images/tutorial-1/tutorial-129.png" title="Xilinx SDK: Configure JTAG Settings" />
<p>In the dialog, select the <code>Digilent USB Cable</code> and confirm the change, closing the dialog.</p>
<p>If that option does not appear, make sure you have the recent (double-check that!) <code>Digilent Adept</code> software and the <code>Digilent Plugins for Xilinx Tools</code> installed; You'll find them on the Digilent website. You may also need to restart Xilinx SDK after installing them — remember that you can always open it from the Export Hardware for SDK dialog in PlanAhead again.</p>
<img src="images/tutorial-1/tutorial-130.png" title="Configure JTAG Settings" />
<p>After that, flash again and wait for the message <code>FPGA configured successfully with bitstream</code> to appear in the console.</p>
<img src="images/tutorial-1/tutorial-131.png" title="FPGA successfully configured" />
<h3><a name="run-and-debug-program" class="anchor" href="#run-and-debug-program"><span class="octicon octicon-link"></span></a>Run and debug the program</h3>
<p>Next we will create a run configuration. Click the Debug icon's down arrow in the toolbar and select <code>Debug As, Launch on Hardware (GDB)</code>. We cannot chose System Debugger instead, since we do not use the Xilinx tools.</p>
<img src="images/tutorial-1/tutorial-132.png" title="Xilinx SDK: Launch on Hardware (GDB)" />
<p>Confirm to switch the perspective, which is common Eclipse behavior.</p>
<img src="images/tutorial-1/tutorial-133.png" title="Xilinx SDK: Perspective Switch" />
<p>The program should launch and the execution will halt on the first line of <code>main()</code>.</p>
<img src="images/tutorial-1/tutorial-134.png" title="Xilinx SDK: Debug Perspective, First Breakpoint" />
<p>Switch to the <code>Terminal 1</code> tab at the bottom and click the <code>Connect</code> icon to open the terminal settings dialog.</p>
<img src="images/tutorial-1/tutorial-135.png" title="Xilinx SDK: Connecting the Terminal" />
<p>Select the board's connected COM port (check Windows' Device Manager to find it), set the Baud Rate to <code>115200</code> and click <code>OK</code>.</p>
<img src="images/tutorial-1/tutorial-136.png" title="Xilinx SDK: Terminal Settings" />
<p>After doing so, step over the next lines using the <code>Step Over</code> command of the debugger. You should eventually see the serial output in the terminal window.</p>
<img src="images/tutorial-1/tutorial-137.png" title="Xilinx SDK: Step Over + Success" />
<p>And there you are. Play around with the switches and buttons on the board to see if it works.</p>
<img src="images/tutorial-1/tutorial-118.jpg" title="The final result." />
<p>Having the switches and buttons <code>xor</code>'d, note how the leftmost LED is down, while the rightmost LED is high. Have fun!</p>
<h3><a name="notes-about-reset" class="anchor" href="#notes-about-reset"><span class="octicon octicon-link"></span></a>Notes about resetting the system</h3>
<p>At the moment all configuration is stored in a volatile manner. Resetting either the Processing System using the <code>PS-SRST</code> or the Programmable Logic using the <code>PROGB</code> button will revert any changes. If you have a vanilla ZYBO with the Terminal still attached, an output like the following may occur.</p>
<img src="images/tutorial-1/tutorial-138-after-ps-srst.png" title="Xilinx SDK: After Resetting the PS" />
<p>That's a different story though.</p>
<p><strong>Have fun!</strong></p>
<h3>
<a name="pats" class="anchor" href="#pats"><span class="octicon octicon-link"></span></a>Parts of the tutorial</h3>
<ul>
<li>Previous: <a href="part-04.html" title="Creating the Bitstream" rel="follow,prev">Creating the Bitstream.</a></li>
<li>Back to the start: <a href="index.html" title="Table of contents" rel="follow,index">Table of contents.</a></li>
</ul>
</section>
</div>
<!-- FOOTER -->
<div id="footer_wrap" class="outer">
<footer class="inner" itemscope itemtype="http://schema.org/Person">
<p class="copyright">ZYBO Quick-Start Tutorial maintained by <a itemprop="url" href="https://github.com/sunsided"><span itemprop="additionalName">sunsided</span></a> (<a itemprop="url" title="2x1=10" href="http://dev.widemeadows.de" rel="me, follow">dev.widemeadows.de</a>)</p>
<p>Published with <a href="http://pages.github.com">GitHub Pages</a></p>
</footer>
</div>
</body>
</html>