Using Open Source Tools for AT91SAM7S Cross Development
Revision 2
Author:
James P. Lynch Grand Island, New York, USA October 8, 2006
1 TABLE OF CONTENTS
Introduction ...................................................................................................................................................4 Hardware Setup.............4 Open Source Tools Required........................................................................................................................5 YAGARTO..............5 SDK4ARM...............6 ARM GCC for Windows Dummies.........................................................................................................6 WinARM..................6 Check for JAVA Support7 Downloading the YAGARTO Tool Chain ....................................................................................................11 Install OpenOCD......15 Install YAGARTO Tool Chain ..................................................................................................................17 Install Eclipse IDE.....19 Install the Wiggler Drivers........................................................................................................................22 Install the Amontec JTAGKey USB Drivers.............................................................................................25 Install the Olimex ARM-USB-OCD USB Drivers ........... ...
Using Open Source Tools for AT91SAM7S Cross Development
Revision 2
Author:
James P. Lynch
Grand Island, New York, USA
October 8, 2006
1
TABLE OF CONTENTS
Introduction ...................................................................................................................................................4
Hardware Setup.............4
Open Source Tools Required........................................................................................................................5
YAGARTO..............5
SDK4ARM...............6
ARM GCC for Windows Dummies.........................................................................................................6
WinARM..................6
Check for JAVA Support7
Downloading the YAGARTO Tool Chain ....................................................................................................11
Install OpenOCD......15
Install YAGARTO Tool Chain ..................................................................................................................17
Install Eclipse IDE.....19
Install the Wiggler Drivers........................................................................................................................22
Install the Amontec JTAGKey USB Drivers.............................................................................................25
Install the Olimex ARM-USB-OCD USB Drivers .....................................................................................30
Download the Sample Programs.............................................................................................................34
Move the OpenOCD Configuration Files.................................................................................................36
Running Eclipse for the First Time..............................................................................................................37
Install OpenOCD as an Eclipse External Tool (wiggler)..........................................................................40 nOCD asal Tool (ARM-USB-OCD) ...........................................................42 nOCD as an Eclial Tool (JTAGKey)......................................................................44
Create an Eclipse Project............................................................................................................................46
Discussion of the Source Files – FLASH Version.......................................................................................52
AT91SAM7S256.H ..................................................................................................................................52
BOARD.H.................53
BLINKER.C...............54
CRT.S.......................55
ISRSUPPORT.C.......60
LOWLEVELINIT.S....62
MAIN.C.....................63
TIMERISR.C.............66
TIMERSETUP.C.......67
DEMO_AT91SAM7_BLINK_FLASH.CMD..............................................................................................71
MAKEFILE...............................................................................................................................................74
Adjusting the Optimization Level.................................................................................................................76
Building the FLASH Application ..................................................................................................................77
Using OpenOCD to Program the FLASH memory .....................................................................................78
OpenOCD Configuration File for Wiggler (FLASH programming version)..............................................78 ile for JTAGKey (FLASH programming version)...........................................79
Openile for ARMUSBOCD (FLASH programming version)...................................79
Debugging the FLASH Application .............................................................................................................86
Create a Debug Launch Configuration....................................................................................................86
Open the Eclipse Debug Prespective......................................................................................................91
Starting OpenOCD...93
Start the Eclipse Debugger......................................................................................................................94
Components of the DEBUG Perspective ................................................................................................96
Debug Control..........97
Run and Stop with the Right-Click Menu.................................................................................................98
Setting a Breakpoint ................................................................................................................................99
Single Stepping......103
Inspecting and Modifying Variables.......................................................................................................106
Watch Expressions.109
Assembly Language Debugging ...........................................................................................................110
Inspecting Registers..............................................................................................................................111
Inspecting Memory.114
Create an Eclipse Project to Run in RAM118
2 DEMO_AT91SAM7_BLINK_RAM.CMD................................................................................................120
MAKEFILE.MAK ....................................................................................................................................123
Build the RAM Project125
Create an Embedded Debug Launch Configuration.................................................................................125
Set up the hardware...129
Open the Eclipse “Debug” Perspective.....................................................................................................130
Start OpenOCD..........130
Start the Eclipse Debugger .......................................................................................................................132
Setting Software Breakpoints....................................................................................................................133
Compiling from the Debug Perspective ....................................................................................................135
Conclusions...............................................................................................................................................139
About the Author........139
Appendix 1. Olimex AT91SAM7- P64 Board ...........................................................................................140
Appendix 2. SOFTWARE COMPONENTS............................................................................................145
3
Introduction
For those on a limited budget, use of open source tools to develop embedded software for the
Atmel AT91SAM7S family of microcontrollers may be a very attractive approach. Professional
software development packages from Keil, IAR, Rowley Associates, etc are convenient, easy to
install, well-supported and fairly efficient. The problem is their price ($900 US and up) which is a
roadblock for the student, hobbyist, or engineer with limited funding.
Using free open source tools currently available on the web, a very acceptable cross
development package can be assembled in an hour’s work. It does require a high-speed internet
connection and a bit of patience.
Three major open source software tools make up the ARM cross development system. Eclipse
provides the Integrated Development Environment (IDE) which includes a superior source code
editor and symbolic debugger. YAGARTO provides a recent version of the GNU C/C++ compiler
suite natively compiled for Windows. OpenOCD interfaces the Eclipse symbolic debugger with
the JTAG port available on the Atmel ARM7 microcontrollers. The only hardware required is a
$12.00 ARM-JTAG interface (wiggler) or a USB-based JTAG interface ($37.00 JTAGKey-Tiny or
$69.95 ARM-USB-OCD) and an AT91SAM7S-EK evaluation board to serve as the hardware
platform.
Hardware Setup
As a hardware platform to exercise our ARM cross development tool chain, we will be using the
Atmel AT91SAM7S-EK evaluation board, shown directly below.
This board includes two serial ports, a USB
port, an Atmel Crypto memory, JTAG
connector, four buffered analog inputs, four
pushbuttons, four LEDs and a prototyping
area.
The Atmel AT91SAM7S256 ARM
microcontroller includes 256 Kbytes of on
chip FLASH memory and 64 Kbytes of on
chip RAM.
The board may be powered from either the
USB channel or an external DC power
supply (7v to 12v).
This board is available from Digikey and
retails for $149.00 www.digikey.com
There are numerous third party AT91SAM7 boards available. Notable is the Olimex SAM7-P256
shown directly below (Olimex SAM7-P64 board shown, SAM7-P256 board is very similar).
4
This board includes two serial ports, a USB port,
expansion memory port, two pushbuttons, two LEDs,
one analog input with potentiometer and a
prototyping area.
The Atmel AT91SAM7S256 ARM microcontroller
includes 256 Kbytes of on chip FLASH memory and
64 Kbytes of on chip RAM.
The board may be powered from either the USB
channel or an external DC power supply (7v to 12v).
This board is available from Olimex, Spark Fun
Electronics and Microcontrollershop; it retails for
$69.95
www.olimex.com
www.s