⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 debuggers.html

📁 ADI 公司blackfin系列的用户使用文挡。
💻 HTML
📖 第 1 页 / 共 3 页
字号:
<li class="level1"><div class="li"> Don&rsquo;t forget to set GDB environment variable solib-search-path to the library folders, where libdl.so and libusertest.so can be found. <pre class="code">(gdb) set solib-search-path /library-directory/</pre></div></li><li class="level1"><div class="li"> Run application on target board and connect gdb to it.</div></li></ol></div><!-- SECTION [6352-7230] --><h2><a name="debugging_kernel" id="debugging_kernel">Debugging Kernel</a></h2><div class="level2"><p>Kernel debugging can be done similar to application debugging. The host based tools are exactly the same, and are installed in the same manner. However, the choice is to do kernel level debugging over ethernet or JTAG.</p></div><!-- SECTION [7231-7477] --><h3><a name="debugging_via_ethernet1" id="debugging_via_ethernet1">Debugging Via Ethernet</a></h3><div class="level3"><p>Rather than compiling and installing <code>gdbserver</code> as a user application are done previously, kgdb can be added to the kernel. Bellow steps shows how to do source code debugging of Linux kernel:</p><ul><li class="level1"><div class="li"> To add kgdb to the kernel, the kgdb patch must be applied to the uClinux kernel. <pre class="code">patch &lt; kgdb_bfin_linux-2.6.x.patch</pre></div></li><li class="level1"><div class="li"> Select menuconfig option under <code>kernel hacking</code> &rarr; <code>kernel debugging</code> &rarr; <code>KGDB: kernel debug with remote gdb</code>. </div></li><li class="level1"><div class="li"> Ensure the following options are enabled (normally when you select KGDB, these options will be select by default):</div><ul><li class="level2"><div class="li"> <code>Full Symbolic/Source Debugging support</code> </div></li><li class="level2"><div class="li"> <code>Compile the kernel with frame pointers</code></div></li></ul></li><li class="level1"><div class="li"> Select option <code>KGDB: on Ethernet</code>.</div></li><li class="level1"><div class="li"> Select option <code>Compiled-in Kernel Boot Parameter</code> option.</div></li><li class="level1"><div class="li"> Add <code>kgdboe=@target-IP/,@host-IP/</code> to the <code>Kernel Boot Parameter</code> option and make the kernel.  </div></li></ul><p><code>Compiled-in Kernel Boot Parameter</code><code>bootargs</code></p><ul><li class="level1"><div class="li"> Connect minicom to the serial port and boot the kernel image.</div></li><li class="level1"><div class="li"> Configure the IP number on the target. This must be the same IP number as the <code>kgdboe</code> setting<pre class="code">/&gt; ifconfig eth0 target-IP </pre></div></li><li class="level1"><div class="li"> On the host, start GDB client <pre class="code">bfin-uclinux-gdb vmlinux</pre></div></li></ul><p>&lsquo;&rsquo;  </p><ul><li class="level1"><div class="li"> On the host, connect to the target <pre class="code">(gdb) target remote udp:target-IP:6443</pre></div></li><li class="level1"><div class="li"> On the host, set software breakpoint, and continue <pre class="code">(gdb) break sys_open(gdb) c</pre></div></li><li class="level1"><div class="li"> run <code>ls</code> in the target console <pre class="code">/&gt; ls</pre></div></li><li class="level1"><div class="li"> The Breakpoint should be hit <pre class="code">Breakpoint 1: sys_open(...&quot;</pre></div></li></ul><p> You can continue and set breakpoints anywhere in the kernel, including driver code.</p></div><!-- SECTION [7478-9400] --><h3><a name="debugging_via_the_second_uart" id="debugging_via_the_second_uart">Debugging Via the second UART</a></h3><div class="level3"><p>Only bf537 has a second UART. So you can only debug over the second UART on bf537 stamp board. </p><ol><li class="level1"><div class="li"> Compile and install the cross platform version of gdb for Blackfin, which can be found as $(BINROOT)/bfin-elf-gdb.</div></li><li class="level1"><div class="li"> Apply this patch to 2.6.x kernel. Select menuconfig option under &ldquo;kernel hacking&rdquo; &rarr; &ldquo;kernel debugging&rdquo; &rarr; &ldquo;KGDB: kernel debug with remote gdb&rdquo;. With this seledted, option &ldquo;Full Symbolic/Source Debugging support&rdquo; and &ldquo;Compile the kernel with frame pointers&rdquo; are also selected.</div></li><li class="level1"><div class="li"> Select option &ldquo;KGDB: on Blackfin UART&rdquo;. Set &ldquo;KGDB: UART port number&rdquo; to be a different one from the console. Don&rsquo;t forget to change the mode of Blackfin serial driver to PIO. Or else, kgdb works incorrectly on UART.</div></li><li class="level1"><div class="li"> If you want connect to kgdb when kernel booting, enable &ldquo;KGDB: Wait for gdb connection early&rdquo; </div></li><li class="level1"><div class="li"> Compile kernel.</div></li><li class="level1"><div class="li"> Connect minicom to the serial port of the console and boot the kernel image.</div></li><li class="level1"><div class="li"> Start GDB client &ldquo;bfin-elf-gdb vmlinux&rdquo;.</div></li><li class="level1"><div class="li"> Set the baud rate in GDB. <pre class="code">(gdb) set remotebaud 57600</pre></div></li><li class="level1"><div class="li"> Connect to the target on the second serial port. <pre class="code">(gdb) target remote /dev/ttyS1</pre></div></li><li class="level1"><div class="li"> Set software breakpoint. <pre class="code">(gdb) break sys_open</pre></div></li><li class="level1"><div class="li"> Continue. <pre class="code">(gdb) c</pre></div></li><li class="level1"><div class="li"> Run ls in the target console. <pre class="code">/&gt; ls</pre></div></li><li class="level1"><div class="li"> A breakpoint is hit. <pre class="code">Breakpoint 1: sys_open(...</pre></div></li><li class="level1"><div class="li"> All other operations are the same as that in KGDB over Ethernet. </div></li></ol><p>  </p></div><!-- SECTION [9401-10974] --><h3><a name="debugging_via_jtag_gdbproxy" id="debugging_via_jtag_gdbproxy">Debugging via Jtag (gdbproxy)</a></h3><div class="level3"><p> Normally, most people are satisfied with debugging with gdb via Ethernet or serial as described above, but in some circumstances (debugging some kernel drivers, or debugging boot loaders), lower level debugging is required. JTAG debugging supports this need. The JTAG debuggers interface with the processor using a 14-pin JTAG header. The header provides a connection interface for the JTAG emulator pods. The header can also be used to route an optional local boundary scan controller to the DSP when the JTAG pod is not attached.</p><p> &rsquo;<a href="http://www.analog.com/ee-notes/" class="urlextern" title="http://www.analog.com/ee-notes/"  rel="nofollow">ADI鈥檚 web site</a> </p><p>JTAG pods use a super set of the <a href="http://webstore.ansi.org/ansidocstore/product.asp?sku=IEEE+Std+1149%2E1%2D2001" class="urlextern" title="http://webstore.ansi.org/ansidocstore/product.asp?sku=IEEE+Std+1149%2E1%2D2001"  rel="nofollow">IEEE 1149.1</a> standard to send and receive data from the processor JTAG emulation port. The JTAG pod sometimes use an additional signal called EMU~ as a emulation status flag from the processor. This signal is a vendor specific signal, which is not part of the IEEE 1149.1 specification.</p><p>JTAG pods which are supported by gdb include:</p><ul><li class="level1"><div class="li"> <a href="http://www.section5.ch/icebear" class="urlextern" title="http://www.section5.ch/icebear"  rel="nofollow">Section 5's ICEBEAR</a></div></li><li class="level1"><div class="li"> <a href="http://www.excelpoint.com/news03.html" class="urlextern" title="http://www.excelpoint.com/news03.html"  rel="nofollow">ExcelPoint's IGLOO</a></div></li></ul><p> These use the same gdb that is used to debug via Ethernet or serial. So the instructions below only describe how to get and install gdbproxy.</p><p>Currently you can get source code of gdbproxy only from <acronym title="Concurrent Versions System">CVS</acronym>. Please follow the below instructions on your host</p><pre class="code">host$&gt; mkdir jtag-sourcehost$&gt; cd jtag-sourcehost$&gt; cvs -d :pserver:anonymous@cvs.blackfin.uclinux.org:/cvsroot/jtag login</pre><p>When prompted for a password for <em>anonymous</em>, simply press the Enter key.</p><pre class="code">host$&gt; cvs -z3 -d :pserver:anonymous@cvs.blackfin.uclinux.org:/cvsroot/jtag co -P jtag gdbproxyhost$&gt; cd jtaghost$&gt; vi bfemu/jtag.c</pre><p>You may need to modify the <code>char * const cable_params[]</code> in this file to match the cable you have. The default is WIGGLER, which is compatible with IGLOO.</p><pre class="code">host$&gt; ./configure --prefix=/path/to/the/install/directoryhost$&gt; makehost$&gt; cd ../gdbproxyhost$&gt; chmod a+x configurehost$&gt; bfemu_path=/path/to/the/jtag-source/jtag/bfemu ./configure --prefix=/path/to/the/install/directoryhost$&gt; makehost$&gt; make install</pre><p>You can add <code>/path/to/the/install/directory</code> to the <code>PATH</code> environment variable.</p><p>When debugging under the <code>gdb</code> environment, the debugger needs to know what target to connect to. This target is a tiny server daemon, typically running on the host computer. It is equivalent to a gdbserver, although it does not run on the target hardware. This server is called gdbproxy and is derived from rproxy-0.7. This is the procedure you normally start with:</p><ol><li class="level1"><div class="li"> Start up gdbproxy:<pre class="code">sudo gdbproxy bfin [special options]</pre></div></li><li class="level1"><div class="li"> Start bfin-uclinux-gdb or bfin-elf-gdb</div></li><li class="level1"><div class="li"> Connect to the gdbproxy via:<pre class="code"> (gdb) target remote :2000 </pre></div></li></ol><p> The Blackfin will now halt and you can:</p><ol><li class="level1"><div class="li"> Set software breakpoints with &lsquo;b&rsquo;</div></li><li class="level1"><div class="li"> Set hardware breakpoints with &lsquo;hb&rsquo;</div></li><li class="level1"><div class="li"> Source line single step with &lsquo;s&rsquo; or &lsquo;n&rsquo;</div></li><li class="level1"><div class="li"> Instruction single step with &lsquo;ni&rsquo; or &lsquo;si&rsquo;</div></li><li class="level1"><div class="li"> Disassemble using &lsquo;disassemble $pc $pc+20&rsquo; or &lsquo;x/10i $pc&rsquo; </div></li><li class="level1"><div class="li"> Print core register values &lsquo;print $r0&rsquo; or &lsquo;info registers&rsquo; etc. </div></li><li class="level1"><div class="li"> Continue program operation with &lsquo;c&rsquo; </div></li><li class="level1"><div class="li"> Stop program with Ctrl-C </div></li></ol><p> <strong>Example 1.</strong> Debugging kernel routine </p><ol><li class="level1"><div class="li"> Compile kernel with debug info and frame pointer</div>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -