The AVR simulator target interface provides access to CrossStudio's AVR
simulator. This target interface supports program loading and debugging. The
simulator supports the instruction set as defined in the document ATMEL AVR
Instruction Set - Rex. 0856B-06/99. Addtionally the simulator will also simulate
EEPROM memory access and provides an extension mechanism to enable device simulation
using JavaScript.
Target property group
- Device Type
- The detected type of the currently connected target interface.
Diagnostic property group
- Jump Counting Enabled
- Enables the simulator to count jump instructions.
- Jump Tracing Enabled
- Enables the simulator to trace jump instructions.
Memory property group
- Default Memory Value
- The default byte value that the simulator's data memory
is initialized to.
Simulator property group
- Data Size
- The size (in bytes) of the simulated data memory.
- Data Start
- The start address of the simulated data memory. Addresses below this
are treated as peripheral registers.
- Device Name
- The name of the simulated device. Changing this will set the other
simulator properties on connect.
- EECR IO Address
- The IO address of the simulated EECR register. The simulated EEDR, EEARL and
EEARH registers are located at IO address one, two and three bytes after the
simulated EECR register respectively.
- EEPROM Size
- The size in bytes of the EE memory.
- EIND IO Address
- The IO address of the simulated EIND register.
- Num IV
- The number of interrupt vectors to be simulated.
- Program Size
- The size in bytes of the simulated program memory.
- RAMPD IO Address
- The IO address of the simulated RAMPD register.
- RAMPX IO Address
- The IO address of the simulated RAMPX register.
- RAMPY IO Address
- The IO address of the simulated RAMPY register.
- RAMPZ IO Address
- The IO address of the simulated RAMPZ register.
- SPL IO Address
- The IO address of the simulated SPL register. The simulated SPH register
is located at the IO address one byte after the simulated SPL register.
- SREG IO Address
- The IO address of the simulated SREG register.
Peripherals property group
- Enable Peripheral File
- Enables the Peripheral File property.
- Interrupt poll interval
- The number of cycles that are executed between checks for an interrupt.
- Peripheral File
- The file containing the JavaScript peripheral simulation. This file is executed
when the simulator is connected to. This file must contain JavaScript functions
as specified below.
JavaScript peripheral simulation
The JavaScript file that simulates peripherals must define:
- reset() This is called on reset and should reset all state.
- pollForInterrupts(elapsedCycleCount) This is called to
check for interrupts. It is passed the elapsed number of cycles since the
last time it was called. It should return 0 if no interrupt is outstanding
or the interrupt number between 1 to Num IV if an interrupt
is outstanding.
- loadPeripheral(address) This is called when a memory read is made
to the peripheral memory region (addresses < Data Start) and
should return a value.
- storePeripheral(address,value) This is called when a memory
write is made to the peripheral memory region (addresses < Data Start)
together with the value that has been written.
Please refer to the default peripheral simulation file contained in the targets/avrperipherals.js
for an example that simulates some Timer0 capabilities.