|
||||||||||||||||||||||||||||||||||||||||
|
This is a small tutorial which shows you how to debug your application with Eclipse using SAM-ICE, J-Link or a J-LInk EDU for the JTAG interface. It is highly recommended that you installed the YAGARTO Tools and read
For a complete C/C++ development system we need the following components:
1. J-Link "Software and documention pack": The SAM-ICE / J-Link is developed by SEGGER, therefore you can download the latest software from the SEGGER J-Link ARM software page. Download the "Software and documentation pack", expand the zip file, and start the setup program. For more information about how to install and setup the SAM-ICE itself, take a look in the SAM-ICE User Guide (pdf, 440 KB), which can be found at the Atmel Site or at the following SEGGER page. If you already installed the YAGARTO Tools, YAGARTO and IDE from the front page, you can go to the next section.
If you do not have the utilities like make, sh, rm, cp and mkdir, I recomended to use these tools from the latest YAGARTO Tools installer, which can be found at the front page. Start the installer, at the "Choose Components" page you can accept the defaults:
Press the "Next >" button and follow the instruction of the installer.
If you did not already install the YAGARTO toolchain, you can download the installer from the front page. Start the installer, at the "Choose Components" page you can accept the defaults:
Press the "Next >" button and follow the instruction of the installer.
More information about the Integrated Development Enviroment and how to install can be found in this desction here. For the SAM7X256 project the following hardware was used:
For the STM3210E project the following hardware was used:
This is a STM3210E-EVAL development board from STMicroelectronics, which is equipped with a STM32F103ZE cpu. Here I will show you, how to compile your first program. These examples was tested with JLinkARM v4.10i and can be used to debug in RAM and ROM. The SAM-ICE can only be used for an Atmel device. For the other one an Download the example you need and expand the zip file to your working directory. I will show you the next steps with the SAM7X256Test example, and expanded it in the following directory: D:\projekte\ARM\SAM7X256Test This directory is only an example, choose what is the best for you. For the next steps I will use this directory. Open a command prompt and change in the D:\projekte\ARM\SAM7X256Test directory. First you must clean the project, therefore type: D:\Projekte\ARM\SAM7X256Test>make clean The result should look like: rm -f ./src/crt.o ./src/main.o All list and object files are deleted, now we want to compile the program, type: D:\Projekte\ARM\SAM7X256Test>make all The output should look like: arm-none-eabi-gcc -x assembler-with-cpp -c -mcpu=arm7tdmi -g -gdwarf-2 -Wa,-amhl A file test.elf should now be created in your build directory. If you could find it, congratulations! You have compiled your first ARM program with the new toolchain. Now we want to start the J-Link GDB Server. The GNU Project Debugger (GDB) is a freely available debugger, distributed under the terms of the GPL. It connects to an emulator via a TCP/IP connection. It can connect to every emulator for which a GDB Server software is available. For debuging with Eclipse we will use the GDB, therefore we need a GDB Server too. At this point you must install the J-Link "Software and documention pack". Connect the SAM-ICE / J-Link to the PC and to the target (do not forget to power the target) and start the JLinkGDBServer. You will find the JLinkGDBServer in the "SEGGER \ J-Link ARM" program goup.
Remove the checkmark of the "Stay on top" option. Then set the checkmark at "Show log window", "Cache reads" and "Init regs on start". The DGB Server window will now look like:
The "Show log window" options can help us if we will get in trouble with Eclipse. Lets try to debug with Eclipse. The J-Link GDB Server must be running and be connected to the J-LIink and the target, before you start the debug sesion. It is best to start the GDB Server before you start Eclipse. Here I use the fast way, and do not demonstrate step by step. The detailed tutorial how to use Eclipse and how to setup a project can be found in part3. If you are not very familiar with Eclipse, take a look at part3 too. Download the SAM7X256Test project and expand the zip file to your temp directory. C:\temp\sam7x256 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 "sam7x256". 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\sam7x256 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 part3. 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 "test.elf" should be created. Change to the "Debug Perspective" and configure the debugger. Select the "Debugger" tab and use arm-none-eabi-gdb for the "GDB debugger". For the debugger "Commands" copy and paste the content of the eclipse_ram_jlink.gdb text file into the window. The eclipse_jlink_ram.gdb file is part of the example (.\prj\eclispe_ram_jlink.gdb). For more information on how to configure the debugger, take a look at part3. The debugger is configured, and the GDB Server is hopefully running. You may start your debug session now, which could look like: An other very detailed tutorial by Jim Lynch "Using Open Source Tools for AT91SAM7S Cross Development, Revision 2" which based on YAGARTO can be found at the Atmel web site (tutorial + sample projects, 6MB). SEGGER supports students too, a student discount of 50% is available (Proof of Inscription required). 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. If you need support, take a look here:
|
|||||||||||||||||||||||||||||||||||||||