|
||||||||||||||||||||||||||||||||||||
|
This is a small example which shows how to debug the Nut/OS application It is highly recommended that you completed part 1, part 2 and part 3 of the YAGARTO tutorial, and has installed OpenOCD, YAGARTO and Eclipse. I will not describe in detail here, how to create an Eclipse project or how to configure the debugger. That was already shown in part 2 and part 3. For this example I used the following components:
We want to debug the application in RAM. Therefore you must set the "Platform" to
And make sure that the linker script is set to at91_ram: Then rebuild the build tree and your application, in this order. Your application will no longer run in FLASH. For debugging on the target, you need a JTAG Debugger Hardware like described here. Any JTAG adapter for the ARM7TDMI may be used, but the connector layout of the Ethernut 3 is different. You need a selfmade cable adapter like this:
And of course an Ethernut 3 or Elektor Internet Radio (EIR):
I made only 3 changes in the source of httpserv.c. First I changed MYIP from 192.168.192.35 to an address in my network, and comment out USE_DHCP and USE_DISCOVERY. (I don't have DHCP, and I don't want to wait) A new makefile was created, too. Here you must adapt only NUTINCDIR, NUTLIBDIR and LDSCRIPT to your requirements.
After you have download the example, take a look in the makefile. I hope you completed part 3 successfully. The following will demonstrate a fast way. Download the httpd example and expand the zip file to your temp directory. C:\temp\httpd For the next steps I will refer to it. Now you can start Eclipse. To create an Eclipse project use "File / New / Standard Make C Project". For the project name use "httpd". Now use "Project / Properties" select "C/C++ Make Project" and change the "Compiler invocation command", on the "Discovery Options" tab, to your compiler executable arm-none-eabi-gcc.exe. Press "OK" to finish this dialog. Your project is empty, and you must import the project files to Eclipse. Browse to your temp directory C:\temp\httpd and select all files with the checkmark, press "Finish" to close the dialog. For more information on how to create a project, take a look at part 3. You can build your project with "Project / Build Project" now, the result of the build process will be displayed in the "Console" window. A file httpserv.elf should be created. Change to the "Debug Perspective" and configure the debugger. For the debugger "Commands" copy and paste the contents of the eclipse_ram.gdb text file into the window. The eclipse_ram.gdb file is part of the example (.\prj\eclispe_ram.gdb). For more information on how to configure the debugger, take a look at part 3. We may start OpenOCD now. For this purpose open a command prompt and change in your project directory: <eclipse workspace>\httpd If you are using the Turtelizer 2.0 type: openocd-ftd2xx -f .\prj\at91r40008_turtle.cfg This command prompt is now blocked with the OpenOCD debugger, and we may go back to Eclipse. The debugger is configured, and OpenOCD is running. You may start your debug session now, which could look like: Hint: You can set the PC back to 0 by the "monitor soft_reset_halt" command in the "Console" window. Now the program can be started with "continue" without to loading again. In case Eclipse refuse to download the code to the target (seems like something is blocked), take the following steps:
Now debugging should be possible.
|
|||||||||||||||||||||||||||||||||||