This tutorial expects that you have setup your project in eclipse and that it compiles using the GCC cross compiler.
PrerequisitesThe following software is needed to be able to debug:
- netX Studio: Files for needed by OpenOCD and USB driver for NXHX51-ETM board
- OpenOCD:Debug server
- GNU MCU Eclipse : Plugin for Eclipse to use OpenOCD as debug server
gdb StandaloneYou can try to debug the program on the command line first to check if everything is woking fine.
Find Program Entry PointThe program entry point has to be determined so that the program counter can be set to the correct position before running the program.
The entry point can be determined with the readelf tool:
|Example for ELF entry point|
The debug server can be started with the following command:
The path to the script OpenOCD script files would be:
Starting gdbThe debugger can then be started with the following command:
If you use the Hilscher compiler the GCC installation is in the following directory:
Debugging Using EclipseBefore setting up Eclipse make sure you have installed the GNU MCU Eclipse plugin.
Create a new debug configuration in Eclipse. Go to Run -> Debug Configurations... and create a new GDB Hardware Debugging configuration.
Select the ELF-file which should be debugged and select Disable auto build if needed.
In the Debugger dialog select the path to the GCC installation. Select Use remote target and select GNU ARM OpenOCD as JTAG Device. Select the Port number which was given as command line argument to OpenOCD.
Set the program counter to the entry point which was determined previously in the Startup dialog and store the settings with Apply.
Start Debug Session
First start OpenOCD:
Then start the previously configured debug session.
Example Scripts to Run Program Directly on Targetenvironment.cmd