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. The memory system simulated (Flash, RAM, EEPROM) is defined by the Target processor property of the currently selected project in the current build configuration.
Target property group
- Device Type
- The detected type of the currently connected target interface - this is the same as the Target property of the currently selected project in the current build configuration.
Diagnostic property group
- Jump Counting Enabled
- Enables the simulator to count jump instructions.
- Jump Tracing Enabled
- Enables the simulator to trace jump instructions.
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.