?? debugging.html
字號:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 FINAL//EN"><html><head> <title>Debugging TinyOS 1.x code with AVR JTAG ICE</title></head><body><h1>Debugging nesC code with the AVR JTAG ICE</h1>The Atmel ATMEGA 128 processor offers in-circuit debugging through itsJTAG interface. This document explains how to setup your environment toallow gdb to be used with mica motes. A separate document, <a href="nesc-debugging.html">here</a>, describes how to debug nesCprograms with gdb (this applies to both JTAG debugging on motes andtossim-based debugging on PCs). This document also gives an example of adebugging session using the JTAG ICE.<br><br>A number of separate elements are needed for JTAG debugging on motes:<ul> <li> <b>Tools</b>: The following tools are needed, they are allincluded in the 1.1 distribution of TinyOS: <ul> <li> C compiler for the AVR: avr-binutils version 2.13.2.1 orlater, avr-gcc version 3.3 or later, avr-libc.<br> </li> <li> nesc version 1.1 or later.</li> <li>avr-gdb or avr-insight, preferably the version distributedwith TinyOS 1.1 (this version has a number of bug fixes).<br> </li> <li>avarice version 2.0.20030805cvs or later.<br> </li> </ul> </li> <li> JTAG ICE pod. This beast can be purchased from Atmel, and looksas follows:<br> <img src="debugging_files/jtagpod.jpg"> </li> <li>A programming board with a JTAG connector. This is included onrecent (mica2, mib510) programming boards. You will have to add ityourself to the older mica programming boards. The finished picture willlook like this:<br> <img src="debugging_files/progboard.jpg"> </li> <li>A mica mote equipped with the Atmega 128 processor, a mica2dot ora mica2. On the Mica boards you may have to remove a resistor r33, asshown in the picture:<br> <img src="debugging_files/micamod.jpg"> <br>Note that on the newer generations of Micas removal of that resistormay not be necessary. With a ohmmeter check the resistance between the positive terminal of the battery and the pin on the Atmel Atmega 128 corresponding to port A pin 7; if the resistance is large (10kohms) then you may not need to remove the resistor.</li> <li>You cannot be using a sensorboard that uses the ADC4-ADC7 (akaPF4-PF7) pins as these are the pins used for JTAG, and you must ensurethat the JTAG enable fuse bit (bit 6 of the high fuse byte) is clear.You can clear this bit by passing the <span style="font-family: monospace;">--wr_fuse_h=19</span> option to uisp,e.g., if using parallel port programming:<br> <span style="font-family: monospace;">uisp-dprog=dapa --wr_fuse_h=19<br> </span>Note that you may have to disable JTAG when usingsensorboards that use ADC4-ADC7, by passing the <span style="font-family: monospace;">--wr_fuse_h=59</span> option to uisp.<br> </li> <li>A free serial port to connect the JTAG ICE pod. You must set theAVARICE_ARGS environment variable to contain the string "<span style="font-family: monospace;">-j <serial port device name></span>"(e.g., <span style="font-family: monospace;">-j /dev/ttyS0</span>).<br> </li></ul>Once you have built up this bit of infrastructure, your setup mightlook something like this:<br><img src="debugging_files/complete-setup.jpg"> At that point you shouldbe able to simply compile your nesC application (make sure you'recompiling with debugging support (-g flag), the easiest is to includethe word <span style="font-family: monospace;">debug</span> in your makecommand line). Connect the pod to your serial port, turn the podon, turn the mote on, and from a shell window you should be able to dosomething like the following:<pre> <br>cd ~/trunk/tinyos-1.x/apps/CntToLeds<br>make clean; make mica debug<br>export AVARICE_ARGS='-j COM1' # a cygwin example, /dev/ttyS0 on Linux (and should work on cygwin too)<br>ice-gdb build/mica/main.exe<br></pre>This should start the avarice (the PC-side of the JTAG setup), whichunderstands the GDB remote debugging protocol, and gdb itself. It willload the program onto the mote, and stop the execution in theinitialization. At that point you should have all the familiar GDB hooksat your disposal: breakpoints, displaying memory, registers, etc. Youcould also use the ice-insight command if you prefer a more graphicaldebugging environment. Please refer to the man pages for ice-gdb andice-insight for more options.<hr><address> <a href="mailto:szewczyk@cs.berkeley.edu">Robert Szewczyk</a>,13 Mar 2003, <a href="mailto:dgay@intle-research.net">David Gay</a>,21 August 2003 </address></body></html>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -