Here is an example of how to use AVR Studio for tracing the execution of an Ada program.
Create 3 Ada source files:
-- main.adb with TestProj; procedure Main is begin TestProj.RunTest; end Main; -- TestProj.ads package TestProj is procedure RunTest; end TestProj; -- TestProj.adb with Interfaces; use Interfaces; with AVR; with AVR.MCU; package body TestProj is procedure RunTest is Temp : Unsigned_8 := 16#FF#; begin AVR.MCU.DDRC := 16#FF#; -- Set data direction for port C to output loop AVR.MCU.PORTC := Temp; Temp := Temp - 1; end loop; end RunTest; end TestProj;
Copy the demo.gpr and Makefile files from one of the examples to the working directory.
Change the name of demo.gpr to main.gpr, edit the file replacing "Demo" with "Main".
Edit the makefile changing just the MCU line to read:
MCU := atmega128
Run make which creates (among others) a file named main.elf.
Run AVR Studio 4 and select "Open" from the welcome dialog.
Select main.elf
The system prompts with "Save AVR Studio Project File main_elf.aps", select save.
Select AVR Simulator and atmega128
Select finish.
The source for system.ads is opened with a debug cursor at the start of the file.
At this point you can step the debugger to run the simulator.
With the simple example program if you look at PORTC in the I/O view the value on the port will count as you step when you get to the loop in RunTest.
Tool for uploading the program to the target board. It can also read and write the eeprom and can control the fuses.
Jack Tidwell's nice utility for getting the Baud divider and and timer constants
[img src=AvrCalc.jpg]
WormFood's AVR Baud Rate Calculator
GNU binutils
avr-objdump
avr-nm