Using objdump with AvroraAvrora 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.
Step 1 - Compile the ProgramNow 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 ProgramNow 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.
Step 3 - Run AvroraNow 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. |