Using Eclipse/4
From Manuals
(→Debugging the Eagle 50s Blinky example application) |
(→Debugging the Lincoln 60s Blinky example application) |
||
| (7 intermediate revisions not shown) | |||
| Line 5: | Line 5: | ||
[[Image:Configuring_OpenOCD.png|center|frame|alt=Configuring OpenOCD|Figure 7 – Configuring OpenOCD as an external tool]] | [[Image:Configuring_OpenOCD.png|center|frame|alt=Configuring OpenOCD|Figure 7 – Configuring OpenOCD as an external tool]] | ||
| - | To run OpenOCD, click the ‘Run Last Tool’ icon and select OpenOCD. This only needs to be done once you begin a new Eclipse session as OpenOCD will remain running until Eclipse exits. Any output printed by OpenOCD can be viewed in the console tab. | + | To run OpenOCD, click the ‘Run Last Tool’ icon and select OpenOCD. This only needs to be done once you begin a new Eclipse session as OpenOCD will remain running until Eclipse exits. Any output printed by OpenOCD can be viewed in the console tab. WARNING: Eclipse sometimes does not close OpenOCD when debugging is finished. In order to open a new debugging session OpenOCD's process needs to be shutdown using Windows Task Manger. |
[[Image:Running_OpenOCD.png|center|frame|alt=Running OpenOCD| Figure 8 - Starting OpenOCD]] | [[Image:Running_OpenOCD.png|center|frame|alt=Running OpenOCD| Figure 8 - Starting OpenOCD]] | ||
| Line 14: | Line 14: | ||
[[Image:Debug_Configuration.png|center|frame|alt=New Debug Configuration|Figure 9 – Creating a new debug configuration]] | [[Image:Debug_Configuration.png|center|frame|alt=New Debug Configuration|Figure 9 – Creating a new debug configuration]] | ||
| - | Advance to the ‘Debugger’ tab and if necessary, change the GDB debugger to match your toolchain. Advance to the ‘Commands’ tab and enter the following for the initialization commands: | + | Advance to the ‘Debugger’ tab and if necessary, change the GDB debugger to match your toolchain. Advance to the ‘Commands’ tab and enter the following for the initialization commands for the Eagle 50: |
target remote localhost:3333 | target remote localhost:3333 | ||
| Line 22: | Line 22: | ||
load | load | ||
| - | Enter the following for the run commands: | + | Enter the following for the initialization commands for the Lincoln 60: |
| + | |||
| + | target remote localhost:3333 | ||
| + | monitor jtag arp_init | ||
| + | monitor reset init | ||
| + | b main | ||
| + | load | ||
| + | monitor reg pc 0x00000000 | ||
| + | |||
| + | Enter the following for the run commands for the Eagle 50: | ||
j ResetISR | j ResetISR | ||
| Line 49: | Line 58: | ||
* 4. Press the 'F5' key on the keyboard to refresh the files. | * 4. Press the 'F5' key on the keyboard to refresh the files. | ||
* 5. Close all of the open projects by right clicking on the project and selecting "Close Project". | * 5. Close all of the open projects by right clicking on the project and selecting "Close Project". | ||
| - | * 6. Open the blinky project by right clicking on the project and selecting "Open Project". If the Sourcery G++ Lite compiler is not installed and devkitARM is installed then click on "Window>Preferences>C/C++>Build> | + | * 6. Open the blinky project by right clicking on the project and selecting "Open Project". If the Sourcery G++ Lite compiler is not installed and devkitARM is installed then click on "Window>Preferences>C/C++>Build>Environment" and add a variable called "COMPILER" with the value set to "devkitARM". |
* 7. Right click on the blinky project and select build. If the project builds correctly then continue. | * 7. Right click on the blinky project and select build. If the project builds correctly then continue. | ||
* 8. Right click on the blinky project and select "Debug As>Debug Configurations". | * 8. Right click on the blinky project and select "Debug As>Debug Configurations". | ||
| Line 65: | Line 74: | ||
* 15. Click "Apply". | * 15. Click "Apply". | ||
* 16. Close the debug configuration. | * 16. Close the debug configuration. | ||
| - | * 17. Open Windows Explorer and browse to "C:\Program Files\Micromint\Tools\openocd" and click on "openocd-eagle" btch file to start open OCD and a screen similar to Figure 13 should open and stay open. If the window does not stay open then the computer could not find the | + | * 17. Open Windows Explorer and browse to "C:\Program Files\Micromint\Tools\openocd" and click on "openocd-eagle" btch file to start open OCD and a screen similar to Figure 13 should open and stay open. If the window does not stay open then the computer could not find the Eagle 50. If Windows Firewall asks if you wish to keep blocking this program click on "Unblock". |
[[Image:eagleoocd_usingeclipse.png|center|frame|alt=Open OCD for Eagle 50|Figure 13 – Eagle 50 Open OCD screen]] | [[Image:eagleoocd_usingeclipse.png|center|frame|alt=Open OCD for Eagle 50|Figure 13 – Eagle 50 Open OCD screen]] | ||
| Line 85: | Line 94: | ||
* 4. Press the 'F5' key on the keyboard to refresh the files. | * 4. Press the 'F5' key on the keyboard to refresh the files. | ||
* 5. Close all of the open projects by right clicking on the project and selecting "Close Project". | * 5. Close all of the open projects by right clicking on the project and selecting "Close Project". | ||
| - | * 6. Open the blinky project by right clicking on the project and selecting "Open Project". If the Sourcery G++ Lite compiler is not installed and devkitARM is installed then click on "Window>Preferences>C/C++>Build> | + | * 6. Open the blinky project by right clicking on the project and selecting "Open Project". If the Sourcery G++ Lite compiler is not installed and devkitARM is installed then click on "Window>Preferences>C/C++>Build>Environment" and add a variable called "COMPILER" with the value set to "devkitARM". |
* 7. Right click on the blinky project and select build. If the project build correctly then continue. | * 7. Right click on the blinky project and select build. If the project build correctly then continue. | ||
* 8. Right click on the blinky project and select "Debug As>Debug Configurations". | * 8. Right click on the blinky project and select "Debug As>Debug Configurations". | ||
| Line 99: | Line 108: | ||
load | load | ||
monitor reg pc 0x00000000 | monitor reg pc 0x00000000 | ||
| + | c | ||
* 14. Click "Apply". | * 14. Click "Apply". | ||
* 15. Close the debug configuration. | * 15. Close the debug configuration. | ||
| Line 106: | Line 116: | ||
* 17. In the Eclipse IDE click on the arrow next to the bug icon and select "1 Blinky Default" to start debugging . | * 17. In the Eclipse IDE click on the arrow next to the bug icon and select "1 Blinky Default" to start debugging . | ||
| - | * 18. Click on the green arrow to start the program. | + | * 18. Click on the green arrow to start the program. |
| - | * 19 | + | * 19. Scroll down to line 71 (the first for loop) and click next to it to insert a break point. The program should stop running. |
| - | + | * 20. If you click the green arrow again the program will start running and will stop at line 71 again. | |
| - | * | + | * 21. Press the red square to halt the debugging session. |
| - | * | + | |
If at any time power is lost or the reset button is pushed on the Lincoln 60 board the OpenOCD-Lincoln window needs to be closed and the steps starting at number 16 have to be repeated. | If at any time power is lost or the reset button is pushed on the Lincoln 60 board the OpenOCD-Lincoln window needs to be closed and the steps starting at number 16 have to be repeated. | ||
Current revision as of 19:39, 6 April 2012
Contents |
Debugging using Eclipse
OpenOCD
OpenOCD is open source application designed to assist in the debugging of embedded target devices and will provide a debugging interface to our device by acting as a GDB Server. It is necessary to have OpenOCD running before beginning a debug session. Eclipse can make this easier by configuring it as an external tool. To do this, select ‘Run,’ ‘External Tools,’ ‘External Tools Configurations…’ and double-click on ‘Program’ to create a new program configuration. Specify the name, location, and working directory of your OpenOCD configuration. Advance to the ‘Build’ tab, unselect ‘Build before launch,’ click ‘Apply’ and then ‘Close.’
To run OpenOCD, click the ‘Run Last Tool’ icon and select OpenOCD. This only needs to be done once you begin a new Eclipse session as OpenOCD will remain running until Eclipse exits. Any output printed by OpenOCD can be viewed in the console tab. WARNING: Eclipse sometimes does not close OpenOCD when debugging is finished. In order to open a new debugging session OpenOCD's process needs to be shutdown using Windows Task Manger.
Debug Configuration
Before beginning a debug session, a debug configuration must be made describing how Eclipse will handle debugging the application. To do this, right click on the project you wish to debug, select ‘Debug As,’ ‘Debug Configurations,’ and double-click ‘Zylin Embedded debug (Native)’ to create a new configuration. Specify the name for this configuration and browse to the application binary for this project.
Advance to the ‘Debugger’ tab and if necessary, change the GDB debugger to match your toolchain. Advance to the ‘Commands’ tab and enter the following for the initialization commands for the Eagle 50:
target remote localhost:3333 monitor jtag arp_init monitor reset init b main load
Enter the following for the initialization commands for the Lincoln 60:
target remote localhost:3333 monitor jtag arp_init monitor reset init b main load monitor reg pc 0x00000000
Enter the following for the run commands for the Eagle 50:
j ResetISR
Click ‘Apply’ and ‘Close’ to complete the debug configuration. Debugging To begin a new debug session, click the arrow next to the Debug icon and select ‘Debug Configurations…’
Click ‘Debug’ and click ‘Yes’ when Eclipse prompts you to move to the debug configuration. Your perspective should look similar to the figure below. The Resume, Suspend, Terminate, Step Into, and Step Over buttons are highlighted in red.
The program should be stopped at the first instruction in main. This is due to specifying the breakpoint main as one of the debug initialization commands. You can view your source code in the center of the screen and navigate through the project in the Outline tab on the right. Details about your current debug configuration can be seen in the Debug tab in the upper left hand corner. Current variables, breakpoints, and register values can be seen in their corresponding tabs in the upper right hand corner. Console output can be viewed in the Console tab at the bottom. To step to the next instruction, click the ‘Step Over’ icon. To step to the next assembly instruction, click the ‘Instruction Stepping Mode’ icon and click the ‘Step Over’ icon. Assembly code can then be viewed on the right next to the Outline tab. To insert a breakpoint, double-click on the bar to the left of the instruction that you wish to break at. To add a breakpoint condition, right click on the breakpoint and select ‘Breakpoint Properties,’ ‘Common,’ and enter the breakpoint condition. To watch an expression, select the variable, right click, and select ‘Add watch expression…’ The expression can then be viewed in the Expressions tab in the upper right hand corner of the screen. The Resume, Suspend, and Terminate buttons can simply be used to continue, break, or end the debugging session.
Debugging the Eagle 50s Blinky example application
Please follow these steps to debug the Eagle 50s blinky example application using open OCD for the first time:
- 1. Open the Eclipse IDE.
- 2. When prompted browse to.
- 3. Click 'OK'.
- 4. Press the 'F5' key on the keyboard to refresh the files.
- 5. Close all of the open projects by right clicking on the project and selecting "Close Project".
- 6. Open the blinky project by right clicking on the project and selecting "Open Project". If the Sourcery G++ Lite compiler is not installed and devkitARM is installed then click on "Window>Preferences>C/C++>Build>Environment" and add a variable called "COMPILER" with the value set to "devkitARM".
- 7. Right click on the blinky project and select build. If the project builds correctly then continue.
- 8. Right click on the blinky project and select "Debug As>Debug Configurations".
- 9. Double-click "Zylin Embedded debug (Native)" to create a new configuration.
- 10. Browse for the blinky out file by clicking on the "Browse" button next to the "Search Project" button. The directory should be "blinky.out".
- 11. Click on the "Debugger" tab. If necessary change the GDB debugger to match your tool chain For Sourcery G++ Lite browse to "%INSTALLDRECTORY%\CodeSourcery\Sourcery G++ Lite\bin\arm-none-eabi-gdb.exe".
- 12. Click on the "Commands" tab.
- 13. Type the following in the "Initialze" commands window:
target remote localhost:3333
monitor jtag arp_init
monitor reset init
b main
load
- 14. Type "j ResetISR" in the "'Run' commands" tab.
- 15. Click "Apply".
- 16. Close the debug configuration.
- 17. Open Windows Explorer and browse to "C:\Program Files\Micromint\Tools\openocd" and click on "openocd-eagle" btch file to start open OCD and a screen similar to Figure 13 should open and stay open. If the window does not stay open then the computer could not find the Eagle 50. If Windows Firewall asks if you wish to keep blocking this program click on "Unblock".
- 18. In the Eclipse IDE click on the arrow next to the bug icon and select "1 Blinky Default" to start debugging .
- 19. Click the green arrow again and the program will start running.
- 20. Scroll down to "LED_PORT_DATA_R |= LED_PIN;" instruction and click next to it to insert a break point. The program should stop running.
- 21. If you click the green arrow again the program will start running and will stop at the "LED_PORT_DATA_R |= LED_PIN;" instruction.
- 22. Press the red square to halt the debugging session.
If at any time power is lost or the reset button is pushed on the Eagle 50 board the OpenOCD-Eagle window needs to be closed and the steps starting at number 17 have to be repeated.
Debugging the Lincoln 60s Blinky example application
Please follow these steps to debug the Lincolns blinky example application using open OCD for the first time:
- 1. Open the Eclipse IDE.
- 2. When prompted browse to "%USERPROFILE%\Projects\Micromint\Lincoln" .
- 3. Click 'OK'.
- 4. Press the 'F5' key on the keyboard to refresh the files.
- 5. Close all of the open projects by right clicking on the project and selecting "Close Project".
- 6. Open the blinky project by right clicking on the project and selecting "Open Project". If the Sourcery G++ Lite compiler is not installed and devkitARM is installed then click on "Window>Preferences>C/C++>Build>Environment" and add a variable called "COMPILER" with the value set to "devkitARM".
- 7. Right click on the blinky project and select build. If the project build correctly then continue.
- 8. Right click on the blinky project and select "Debug As>Debug Configurations".
- 9. Double-click "Zylin Embedded debug (Native)" to create a new configuration.
- 10. Browse for the blinky elf file by clicking on the "Browse" button next to the "Search Project" button. The directory should be "%USERPROFILE%\Projects\Micromint\Lincoln\CMSIS\projects\blinky\lincoln-all\gcc\blinky.elf".
- 11. Click on the "Debugger" tab. If necessary change the GDB debugger to match your tool chain For Sourcery G++ Lite browse to "%INSTALLDRECTORY%\CodeSourcery\Sourcery G++ Lite\bin\arm-none-eabi-gdb.exe".
- 12. Click on the "Commands" tab.
- 13. Type the following in the "Initialze" commands window:
target remote localhost:3333
monitor jtag arp_init
monitor reset init
b main
load
monitor reg pc 0x00000000
c
- 14. Click "Apply".
- 15. Close the debug configuration.
- 16. Open Windows Explorer and browse to "C:\Program Files\Micromint\Tools\openocd" and click on "openocd-lincoln" btch file to start open OCD and a screen similar to Figure 13 should open and stay open. If the window does not stay open then the computer could not find the Lincoln 60. If Windows Firewall asks if you wish to keep blocking this program click on "Unblock".
- 17. In the Eclipse IDE click on the arrow next to the bug icon and select "1 Blinky Default" to start debugging .
- 18. Click on the green arrow to start the program.
- 19. Scroll down to line 71 (the first for loop) and click next to it to insert a break point. The program should stop running.
- 20. If you click the green arrow again the program will start running and will stop at line 71 again.
- 21. Press the red square to halt the debugging session.
If at any time power is lost or the reset button is pushed on the Lincoln 60 board the OpenOCD-Lincoln window needs to be closed and the steps starting at number 16 have to be repeated.








