-Debugging a project.
Objective
-To gives an introduction to how to debug a project. The guidelines assume that you have already created and built a project as described in Getting started: New project.
Content/Procedure
-Prior to starting debugging, a proper debugger must have been selected. As mentioned the AVR Simulator will be used for this example.
-The currently selected device and debugger is displayed in the Device and Debugger tool bar. If no debugger is selected, the Current Tool button will say No Tool as shown here.
-To select a debugger, simply click on the Current Tool button. This opens the debugger selection and configuration in the project properties. The debugger selection and configuration can also be opened via the project Properties menu item found at the bottom of the Project menu. You can also open the project properties by right-clicking on the project node in the Solution Explorer window. -Select a debugger.
- Open the project propeties dialog from the menu.
- In the Tool section of the propeties, select the .
- Click OK
-The Alt+F5 key combination or the menu item builds the project and launches the debugging session. On encountering the main() function the execution is suspended . The same is achieved using the F10 key or the menu item. The project is not built if it is up to date.
-The F5 key or menu entry builds the project and upon a succesful build launches the debugging session using the selected debugger. This shortcut does not suspend execution until a user breakpoint is hit.
-The menu item loads the application into the target device but does not start a debugging session. This command is used as an alternative to the stand-alone Programming Dialog described in later sections. Note that uses the projects debug configuration and not the settings specified in the stand-alone Programming Dialog.
-Start debugging.
- In the Debug menu, select .
- AVR Studio will compile the project, upload the application to the program memory of the AVR Simulator and run to the start of the main() function. AVR Studio displays the text "Debugging" in the title line, indicating that a debugging session is active.
-Resume and suspend execution.
- In the Debug menu, select . The AVR Simulator will resume execution, indicated by the text "Running" in the title line of AVR Studio.
- In the Debug menu, select . AVR Studio suspends execution. The yellow arrow marks the code line that will be executed when execution is resumed the next time.
-A breakpoint can be placed in the source code by clicking in the gutter area next to the source line where you want program execution to be suspended. Alternatively by selecting Toggle Breakpoint in the Debug menu, or simply by pressing F9.
-A red circle will appear in the gutter area.
-Place a breakpoint and run.
- Position the text marker on a line in the application and press F9.
- Press F5 to resume execution. AVR Studio will execute code until the breakpoint is hit and then suspend execution.
-The debugger windows can be accessed on the Debug -> Windows menu or by using specific keyboard shortcuts. Most of the windows will only contain useful information when execution is stopped.
-Open the memory view
- Make sure execution is halted (the title bar of AVR Studio should say "Debugging")
- Navigate to Debug -> Windows -> Memory and select Memory 1. AVR Studio will open the memory window.
- Select "data INTERNAL_SRAM" in the pull-down menu labeled "Memory" over the memory content. This displays the internal SRAM of the selected device.
Result/Analysis
-This is the step how to debug the program in Atmel Atmega644.
-Also it more friendly user and easy to understand.
Conclusions
As a conclusions, the introduction to debugging code projects in AVR Studio. All aspects of debugging are described more in detail in the Debugging section in the AVR Studio






No comments:
Post a Comment