The Simulator

In many ways the centerpiece of Avrora is the simulator core. It provides a cycle-accurate simulation of the AVR microcontroller, allowing real programs to be run with precise timing. It emulates the behavior of the on-chip devices and provides a clean interface for interfacing off-chip devices.

The simulator is accessed through the -action=simulate option to Avrora. It is also the default action, so specifying this option is unnecessary. Let's try simulating a small program:

The simulator executes the program and reports the results at the end of simulation. By default, the simulator produces no output. For information on how to enable different tracing modes, see the page on tracing.


Breakpoints can be used to pause or terminate the simulation when it reaches a particular point in the program. Breakpoints can be inserted from the command line by using the interactive monitor and the -breakpoints option. This option accepts a list of either hexadecimal byte addresses that begin with 0x or labels within the program.

A demonstration of a simple program execution with a single breakpoint is as follows.


Most microcontroller programs do not terminate but continue executing in an infinite loop servicing interrupts. For the purpose of simulating or debugging a program, a timeout can be inserted so that the simulation terminates after certain amount of time or certain number of instructions have been executed. There are three options to do this:
  • -seconds will terminate the simulation after a given number of simulated seconds.
  • executed.

Here is an example of using the -seconds option to specify a timeout.

Profiling and Benchmarking

The simulator has a flexible framework for profiling and instrumenting programs. As you saw in this section, the simulator allows you to specify a -monitors option. That option allows monitors to instrument your program and collect information while it executes. You saw that the trace monitor will print out each instruction as it executes and then generate a report when the program is done, but what you didn't see is that monitors are much more powerful. Some more monitors available to you in the default configuration can be seen in the online help.

There is also more information available on monitoring and profiling.

Options and Help for Simulations

Help for each of the options is available through the command line interface to Avrora. You can also access this help for the simulate action and for the single simulation type and the sensor-network simulation type.