Beruflich Dokumente
Kultur Dokumente
A guide for using open source tools with the AT91SAM7X-EK development board.
V 1.0
Semester 2, 2009
Stephen Rothery
stevekr@gmail.com
Table of Contents
Introduction ................................................................................................................................................ 1
Hardware Requirements .............................................................................................................................. 1
Software Required ....................................................................................................................................... 1
Base Installation....................................................................................................................................... 1
FreeRTOS Tools ........................................................................................................................................ 2
General Tools........................................................................................................................................... 2
Installation................................................................................................................................................... 2
Compiling and running your first application ................................................................................................ 3
Copying image to device without SAM-ICE (Via USB) ............................................................................ 5
Copying image to device using the SAM-ICE JTAG programmer/debugger ........................................... 7
Using the Debugger ..................................................................................................................................... 9
Configuration ..........................................................................................................................................10
Switching to Debug View ........................................................................................................................11
Flash Based Debugging............................................................................................................................11
Ram Based Debugging.............................................................................................................................12
Basic Debugger Functionality ..................................................................................................................12
Configuring and running the FreeRTOS Demo .............................................................................................13
Configuring the Local Webserver ................................................................................................................14
Running the FreeRTOS demo ......................................................................................................................14
Introduction
The purpose of this guide is to help a user get started with development for AT91Sam7x256, while making
use of freely available open source software. Example applications and comprehensive documentation
have also been included in this package to assist with developing applications for this platform.
The software included in this package has been pre-assembled from various sources; James P. Lynch has
created an excellent (though slightly dated) guide for this which, along with documentation from the
YAGARTO web site forms formed the initial basis for much of this process.
This configuration has been tested to work on both Windows XP and Vista operating systems and should
also function correctly on Windows 2000, though this has not been tested.
Hardware Requirements
This guide was written for the following hardware.
Item
Processor
Development Board
JTAG Interface
Required
Atmel AT91SAM7X256
Atmel AT91SAM7X-EK
Atmel Sam-Ice (Atmel Branded J-Link device)
If you are using anything other than these devices you may be required to change certain elements of this
guide. Changes to the JTAG interface will require adjusting the process for programming and debugging the
board, while changes to the Processor and development board will require changes in the software based
on the different hardware and peripherals present.
Software Required
All of the software mentioned in this guide is included in this package, with several components being preinstalled and preconfigured. This is covered in the Installation guide, but below is a list of the software used,
as well as links to where they can be obtained.
Base Installation
Sun Java 2 Standard Edition 5.0 Update 11 for Microsoft Windows (or above)1
Eclipse IDE for C/C++ with the following Plugins2
o Zylin Embedded Toolkit for Eclipse3
YAGARTO (GNU ARM toolchain)4
YAGARTO Tools5
AT91 In-system Programmer (ISP)6
SEGGER - J-Link ARM7
http://www.java.com/en/download/index.jsp
http://www.eclipse.org/downloads/packages/release/europa/winter
3
http://opensource.zylin.com/embeddedcdt.html
4
http://www.yagarto.de/index.html#download
5
http://www.yagarto.de/index.html#download
6
http://www.atmel.com/dyn/products/tools_card.asp?tool_id=3883
7
http://www.segger.com/cms/jlink-software.html
2
FreeRTOS Tools
ActivePerl8
Abyss Web Server X19
GNU Wget10
General Tools
Wireshark11
Installation
1. Run the file AT91SAM7X-Dev.exe and select where you would like it to be extracted. This will be
the working folder for this development package and will require approximately 800MB of hard
drive space.
2. Once done, a number of tools need to be installed. Open the folder that you extracted everything
into in the previous step and open Software folder within it. The essential software must first be
installed, this is found in the Base subfolder.
These tools can be installed in any order, but are all required.
a. Install Java
Run the Java installer (jre-6u13-windows-i586-p-s.exe), all options can be left as their
default.
b. Install YAGARTO and YAGARTO tools
Run the installers for the Yagarto Tools. (yagarto-bu-2.19.1_gcc-4.3.3-c-c++_nl-1.17.0_gi6.8.50_20090329.exe and yagarto-tools-20070303-setup.exe) The default options are
sufficient but ensure that the option Add YAGARTO to the PATH variable is checked for
the installation of YAGARTO, and that Add the make utils to the path variable is selected
for the installation of YAGARTO tools.
c. Install Atmel AT91 In-system Programmer tools (Install AT91-ISP v1.12.exe) with the default
options. (this requires a reboot to complete)
d. Install J-Link arm Driver (Setup_JLinkARM_V402e.exe) and install with default options.
Once this has been done, you can connect the SAM-ICE USB JTAG device and Windows
should recognise it correctly.
http://www.activestate.com/activeperl/
http://www.aprelium.com/abyssws/download.php
10
http://www.gnu.org/software/wget/
11
http://www.wireshark.org/
9
The following tools are required for working with the FreeRTOS example
e. ActivePerl (ActivePerl-5.10.0.1004-MSWin32-x86-287188.msi) This can be installed with
default options. This tools allows the running of scripts which allow web pages to be
converted into a format usable by the FreeRTOS demo.
The following tools are helpful for additional network debugging and trouble shooting
f. Wireshark (wireshark-setup-1.0.6.exe) can be installed with default options. This installer
will also guide you through installing a tool called WinPcap which is required for
Wireshark to function.
Select the Workspace subfolder which is part of the package and select to use this as the default. Click
Ok and Eclipse will restart.
Once Eclipse has restarted you will be presented with the following screen.
This workspace has been preconfigured to include a simple Getting Started demo as well as a
demonstration program which makes use of the FreeRTOS operating system.
2. Right click on the Getting Started Demo item and select Build Project
Progress will be seen in the console, with any errors being reported there. This application should however
build without errors and once this is completed, several new files will have appeared in the Bin folder of
the Getting Started Demo. These are the compiled applications, ready to be loaded onto the processor.
4
3. The next step differs depending on whether or not you are making use of the SAM-ICE JTAG
programmer/debugger.
Copying image to device without SAM-ICE (Via USB)
Firstly, the existing contents of the flash must be erased, setting the device to its default settings.
The default Atmel boot loader will load as the default program, allowing the device to be used with
the AT91 ISP software package. (Important note: this must be done every time when programming
through the USB interface)
This is done by linking the Erase pins, found on the J15 pin header on the SAM7X256-EK
development board while it is powered. A piece of wire is sufficient for this, as shown below.
Important Note: At this point you should start Sam-Prog either through Eclipse (as shown on the
next page) or from the start menu. Starting Sam-Prog while the board is already connected can
cause Sam-Prog to crash on certain system configurations. To avoid this, simply start Sam-Prog and
then connect the board via USB.
Once this has been done, the board can be connected to the computer. The first time it is
connected, windows should search for and install the appropriate driver to be used in programming
the device via USB.
Disconnect and then reconnect the power for the AT91SAM7X-EK and the application execute.
The LEDs connected to DS1 and DS2 should begin flashing, indicating that the Getting Started
Demo is now running correctly.
Launching the program from within Eclipse will trigger a rebuild of all open projects; this may take a
moment but ensures that the latest revision of your code is available to be uploaded to the
processor.
Once Sam-Prog has started you can connect both the SAM-ICE and the AT91SAM7X-EK via USB,
then connecting the SAM-ICE to the JTAG interface on the development board.
7
Common Fault - Important Note: Certain system configurations may Cause SAM-PROG and SAMBA to crash on launch if the J-Link SAM-ICE device is already connected before the program is
launched.
This behaviour can be avoided by only connecting the SAM-ICE to the computer after Sam-Prog or
Sam-Ba are already running. Once started this way, the programs will function correctly until they
are closed.
Within Sam-Prog, click the browse and navigate to the files earlier. Select getting-started-projectat91sam7x-ek-at91sam7x256-flash.bin (Found within the subfolder Workspace\Getting Started
Demo\bin)
Once you have found the file, click the Target Connected button.
To rectify this, all of the settings must be erased from the processor. The process for this is the
same as outlined in the section Programming without SAM-Ice
Once this has been done, new programs can be loaded onto the board without issue.
Once the transfer has completed, disconnect and then reconnect the power for the AT91SAM7X-EK
and the application execute.
The LEDs connected to DS1 and DS2 should begin flashing, indicating that the Getting Started
Demo is now running correctly.
Configuration
While a profile for both RAM and Flash debugging already exists within the workspace, some slight
configuration needs to be done to account for your installation location.
Debug Dialog
(click the small black arrow,
then click Open Debug Dialog)
Select the Getting Started Demo (flash) item and select the .elf file associated with it. (getting-startedproject-at91sam7x-ek-at91sam7x256-flash.elf, located in the same folder as the .bin file used earlier to
program the board. Click apply once this is done.
10
Select the Getting Started Demo (ram) item and select the .elf file associated with it. (getting-startedproject-at91sam7x-ek-at91sam7x256-sram.elf, located in the same folder as the .bin file used earlier to
program the board. Click apply once this is done.
Once these have both been set, you are ready to debug the Getting Started Demo.
Debug Dialog
(click the small black arrow)
3. The debugger should load and the program will begin executing. Execution will continue until a
breakpoint is reached or it is manually paused.
Debug Dialog
(click the small black arrow)
3. The debugger should load and the program will begin executing. Execution will continue until a
breakpoint is reached or it is manually paused.
Watched Expressions
Execution Controls
Breakpoint Marker
12
Execution Controls allow the user to control the flow of execution through the program, pausing or
stopping it at any point in execution or continuing it after a breakpoint. Functions can also be stepped over
or stepped into, allowing the debugger access to in-depth information about the flow of execution.
Breakpoint markers allow the user to place breakpoints in the code and are indicated by a blue dot. These
can be added at any point, including during run-time and are toggled by double clicking in the place
indicated by the arrow above.
Watched Expressions are useful in that they allow the user to select a number of variables which will be
monitored during execution, with their value being displayed in this area whenever execution is paused. To
add a watched expression, right click on a variable and select Add Watched Expression.
For more information a detailed guide on debugging can be found in the debugging section of the
document Using Open Source Tools for AT91SAM7 Cross. Development, which can be found in the
documentation subfolder of this package.
13
14