1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>6.2.�Debug Sprite Example</title><link rel="stylesheet" href="cs.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.74.0"><link rel="home" href="index.html" title="Sourcery CodeBench Lite"><link rel="up" href="sprite.html" title="Chapter�6.�Sourcery CodeBench Debug Sprite"><link rel="prev" href="sprite.html" title="Chapter�6.�Sourcery CodeBench Debug Sprite"><link rel="next" href="sec-sprite-invocation.html" title="6.3.�Invoking Sourcery CodeBench Debug Sprite"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">6.2.�Debug Sprite Example</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="sprite.html">Prev</a>�</td><th width="60%" align="center">Chapter�6.�Sourcery CodeBench Debug Sprite</th><td width="20%" align="right">�<a accesskey="n" href="sec-sprite-invocation.html">Next</a></td></tr></table><hr></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id529011"></a>6.2.�Debug Sprite Example</h2></div></div></div><p> 2 Start by compiling and linking a simple test program for your target 3 board, following the instructions in <a class="xref" href="chap-building.html" title="Chapter�4.�Using Sourcery CodeBench from the Command Line">Chapter�4, “Using Sourcery CodeBench from the Command Line”</a>. 4 Use the <code class="option">-g</code> option to tell the compiler to generate 5 debugging information. 6 </p><p> 7 To build the <code class="filename">factorial</code> program to 8 run on the ARMulator simulator, which can communicate with the Sprite 9 via the RDI protocol, use: 10 11 </p><pre class="screen">> arm-none-eabi-gcc -g -Tarmulator-ram-hosted.ld main.c \ 12 -o factorial</pre><p> 13 </p><p> 14 Next start the debugger on your host system: 15 </p><pre class="screen">> arm-none-eabi-gdb factorial</pre><p> 16 </p><p> 17 The command for connecting GDB to the board depends on the 18 debug device you are using; this is described in more detail in 19 <a class="xref" href="sec-sprite-invocation.html" title="6.3.�Invoking Sourcery CodeBench Debug Sprite">Section�6.3, “Invoking Sourcery CodeBench Debug Sprite”</a>. 20 21 22 23 24 <span> 25 If you are connecting via RDI, you must specify the full path to 26 the RDI library file and configuration file for that library. Use 27 quotes to escape the Sprite argument syntax from the shell. For 28 example, use a command like this to connect to the ARMulator: 29 </span> 30 </p><pre class="screen">(gdb) target remote | arm-none-eabi-sprite \ 31 "rdi:///?rdi-library=<em class="replaceable"><code>library</code></em>&rdi-config=<em class="replaceable"><code>config</code></em>" armulator</pre><p> 32 </p><p> 33 The Sprite prints some status messages as it connects to your 34 debug device and target board. 35 If the connection is successful, you should see output similar to: 36 37 </p><pre class="screen">arm-none-eabi-sprite:Target reset 380x00008936 in ?? () 39(gdb)</pre><p> 40 </p><p> 41 Next, use GDB to load your program onto the target board. 42 43 44 </p><pre class="screen">(gdb) load</pre><p> 45 46 </p><p> 47 At this point you can use GDB to control the execution of your 48 program as required. For example: 49 50 </p><pre class="screen">(gdb) break main 51(gdb) continue</pre><p> 52 </p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="sprite.html">Prev</a>�</td><td width="20%" align="center"><a accesskey="u" href="sprite.html">Up</a></td><td width="40%" align="right">�<a accesskey="n" href="sec-sprite-invocation.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter�6.�Sourcery CodeBench Debug Sprite�</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">�6.3.�Invoking Sourcery CodeBench Debug Sprite</td></tr></table></div></body></html> 53