This tutorial expects that you have setup your project in eclipse and that it compiles using the GCC cross compiler.
Prerequisites
The 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
- Eclipse
- GNU MCU Eclipse : Plugin for Eclipse to use OpenOCD as debug server
gdb Standalone
You can try to debug the program on the command line first to check if everything is woking fine.Find Program Entry Point
The 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:
"<Path to netx Studio GCC-installation>\arm-none-eabi-readelf.exe" -l "<ELF-file>"
Example for ELF entry point |
Starting OpenOCD
The debug server can be started with the following command:
"<path to openocd>\bin\openocd.exe" -c "gdb_port 3333" -c "adapter_khz 1000" -s "<path to netx openocd scripts>" -f interface\hilscher_nxhx_onboard.cfg -f board\hilscher_nxhx51.cfg -c "load_image <ELF-file> 0x0 elf" -c "puts gdb-server-ready"
The path to the script OpenOCD script files would be:
%ProgramData%\Hilscher GmbH\netX Studio CDT\BuildTools\openocd
Starting gdb
The debugger can then be started with the following command:"<path to netx Studio GCC-installation>\arm-none-eabi-gdb.exe" --eval-command="target remote localhost:3333" "<ELF-file>"
If you use the Hilscher compiler the GCC installation is in the following directory:
%ProgramData%\Hilscher GmbH\netX Studio CDT\BuildTools\arm-none-eabi-gcc\4.5.2\bin
Debugging Using Eclipse
Before setting up Eclipse make sure you have installed the GNU MCU Eclipse plugin.Setup Eclipse
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:
"<path to openocd>\bin\openocd.exe" -c "gdb_port 3333" -c "adapter_khz 1000" -s "<path to netx openocd scripts>" -f interface\hilscher_nxhx_onboard.cfg -f board\hilscher_nxhx51.cfg -c "load_image <ELF-file> 0x0 elf"
Then start the previously configured debug session.
run_openocd.cmd
Example Scripts to Run Program Directly on Target
environment.cmdrun_openocd.cmd
Der Kommentar wurde von einem Blog-Administrator entfernt.
AntwortenLöschen