Copyright © 2007 Atmel Corporation
The intention of this guide is to help users getting started with AVR32 UC3 embedded development. It is a quick reference on how to create an application for the AVR32 UC3A with the GNU Toolchain and how to run and debug it..
NOTE: Make sure to install all tools before using this guide.
Atmel recommends that you upgrade your software by visiting http://www.atmel.com/avr32 and download the latest versions of the UC3 Software Framework and the GNU Toolchain.Then start Cygwin or a standard Linux terminal, to execute the commands described in each step. Also note that this guide requires a JTAGmkII emulator.
Each driver folder of the UC3 Software Framework (/DRIVERS directory) includes code to handle the peripheral, example code to use the driver, building scripts (Makefile) and documentation (readme.html). This quick step guide will use the ADC example.
Copy the UC3 software framework from your installation CD or from Atmel web site to your own location. You may also want to check the installation page for details regarding the installation of the Software Framework.
GCC, the GNU Compiler Collection is used at the compilation stage. The avr32 version of GCC is used by calling avr32-gcc. The compiler supports c-code compilation, assembly and linking.
Compile the ADC driver application note by calling 'make'
from the copied source
location:
cd /your-local-location/AT32UC3A-x.y.z/DRIVERS/ADC/EXAMPLE/AT32UC3A0512/GCC/ make
This will run the GNU Makefile which calls avr32-gcc and produces the object file
uc3a0512-adc_example.elf
.
The application avr32program
can be used to program the device.
To program-only the device with the ADC example, use the following command line:
avr32program program -finternal@0x80000000,512Kb -e -v uc3a0512-adc_example.elf
'-finternal@0x80000000,512Kb'
tells the programmer that the
internal flash starts at address 0x80000000 and that its size is 512Kb.
'-e'
is used to erase the flash before programming it.
'-v'
is used to verify the flash programming.
For more information about avr32program usage and parameters, use the builtin help command:
avr32program -h
For example, to program, reset and run the target,
avr32program program -finternal@0x80000000,512Kb -e -v -R -r uc3a0512-adc_example.elf
'-R'
is used to reset the MCU,
'-r'
is used to run the program.
The Makefile also comes with pre-built Make targets:
So for example, to program the target, reset the target and then run the program, you could also type:
make program reset run
The application can be debugged on target using the GNU Project Debugger(GDB) and a JTAGICE mkII. This requires that a GDB proxy server is used. The proxy will translate standard GDB requests such as read memory, read registers and set breakpoints into JTAGICE mkII operations.
GDB is an open standard and any debugger supporting GDB may be connected to the GDB proxy server using socket communication.
GBD Proxy Interface
The AVR32 GDB proxy server must be started before using a GDB-client. Use the following command to start avr32gdbproxy and connect it to a host called 'extended-remote' with port number '4242':
avr32gdbproxy -finternal@0x80000000,512Kb -a extended-remote:4242
The -f parameter tells the GDB proxy server where the flash memory is located. For information about additional parameters use:
avr32gdbproxy -h
Once the GDB proxy server is up an running, the user can communicate with it using any debugger with GDB support. This is done by using the same host name and port number as when avr32gdbproxy was invoked. avr32-gdb is a command line based GDB-client, and it can be used to demonstrate how the ADC example can be debugged.
Start a new terminal (Cygwin) and go to your source directory:
cd /your-local-location/AT32UC3A-x.y.z/DRIVERS/ADC/EXAMPLE/AT32UC3A0512/GCC/
Start the GDB-client with the following command:
avr32-gdb
Remember to keep the avr32gdbproxy running during the entire debug session. If a command line based GDB-client like avr32-gdb is used, it must be called from a new terminal. If Cygwin is used, one can easily do this by starting Cygwin one more time, so that there are two Cygwin windows: one with the GDB proxy and one with the GDB-client.
Once the GDB-client is started, use the following GDB commands to initiate a debug session:
(gdb) target extended-remote:4242
This connects the gdb-client to the avr32gdbproxy server (assuming host name 'extended-remote' and port number '4242'). Then load the symbol table from executable file:
(gdb) sym uc3a0512-adc_example.elf
To start executing the test application:
(gdb) cont