Using objdump with Avrora

Avrora currently does not include a disassembler. Therefore it cannot load binary machine code and relies on an external disassembler. If you write your programs using Atmel's AVR assembly syntax, Avrora can load it from the source. However, if you write your programs in any other language and compile them to binary AVR code, you will need to use a disassembler on your binary in order to load it into Avrora. These steps are easy and can easily be integrated into your build process with make.


The GNU utility objdump can disassemble ELF files and other executable formats into source assembly. Avrora can parse the output of this utility to load binary programs.


Step 1 - Compile the Program

Now let's suppose that we have a C program that we would like to compile to a binary and simulate in Avrora. The first step is to compile the program to a binary format such as ELF. This is shown for avr-gcc.

If you are compiling a TinyOS program such as Blink, you can simply use make mica2. Note: the resulting file in build/mica2/main.exe is an ELF file that can be used in the next step.


Step 2 - Disassemble the Program

Now that we have compiled our program to an ELF binary, we can use avr-objdump to create a text file that contains the disassembled code to load into Avrora. The options specify to disassemble zeroes (need to get NOP instructions), print the header sections (relocation information), and disassemble each section.

  1. Note: the .od extension for the filename is important: Avrora assumes that filenames that end in this extension contain objdump output.


Step 3 - Run Avrora

Now that we have a text file that contains the disassembled code of our program, we can load it into Avrora to simulate, analyze, or create a control flow graph. For more information, see the sections on simulating, analyzing, or visualizing your programs.