AVR Emulator
The AVR Emulator may be used to test code without the QUTy development board. It supports all hardware peripherals used in EGB202 and can be configured with custom emulator events and arguments.
Table of Contents
Project Templates
Use the following ZIP files to test the AVR Emulator with custom events and arguments.
Events
File: events.txt
Events specify the actions that the emulator should take at specific times during the simulation. Each event must be specified on a new line and take the form:
@time component: argument
where:
timeis a count of nanoseconds since the start of the simulation, in hexadecimal (no prefix).componentis the name of the component of interest.argumentis some action or value to be applied to the component.
On the QUTy, the following components and actions are supported:
-
UART Transmit (U5)
@time U5: datawhere
datais the byte to be transmitted, in hexadecimal (no prefix). -
Pushbutton Press (Sn)
@time Sn: PRESSwhere
1 <= n <= 4indicates the button being pressed. -
Pushbutton Release (Sn)
@time Sn: RELEASEwhere
1 <= n <= 4indicates the button being released. -
Potentiometer Position (R1)
@time R1: positionwhere
positionis the position of the potentiometer, as a floating-point number, ranging from 0 to 1.
UART Output
If the user expects UART output from the program, the UART buffer should be flushed before the end of the simulation.
@time U5: flush
Arguments
File: arguments.txt
Emulator arguments are used to specify the behaviour of the AVR Emulator executable at the end of the simulation. All arguments and their values must be supplied on a new line.
The following arguments are supported:
-
Timeout (
-tor--timeout): Specify the emulation runtime limit in nanoseconds, as a decimal value.-t 1000000000 -
Dump Stack (
-sor--dump-stack): Dump the stack to stdout on termination.-s -
Dump Registers (
-ror--dump-regs): Dump working register values to stdout on termination.-r -
Dump stdout (
-oor--dump-stdout): Dump the output of stdout to the filestdout.txton termination.-o -
Debug (
-dor--debug): Enable debug output.-d
Immediate Termination
If the user is unsure of the time at which the program will terminate,
they should specify a large timeout and include the break instruction
in their code. This will cause the emulator to terminate early.
In Assembly:
break
In C:
asm("break");
Note that this may result in the UART buffer not being flushed.