/ATtiny13A-3

Microcontroller emulator

Primary LanguageC++

Поляков Павел Александрович, 146

ATtiny13A microcontroller emulator

This repository contains ATtiny13A microcontroller emulator source code. It is capable of executing programs prepared by avra and avr-gcc compilers. For detailed info on emulator installation and usage see the end of this page

Supported instructions

ADD, ADC, ADW, SUB, SUBI, SBC, SBCI, SBIW, AND, ANDI, OR, ORI, EOR, COM, NEG, SBR, CBR, INC, DEC, TST, CLR, SER, MUL, MULS, MULSU, RJMP, IJMP, JMP, RCALL, ICALL, CALL, RET, RETI, CPSE, CP, CPC, CPI, SBRC, SBRS, SBIC, SBIS, BRBS, BRBC, BREQ, BRNE, BRCS, BRCC, BRSH, BRLO, BRMI, BRPL, BRGE, BRLT, BRHS, BRHC, BRTS, BRTC, BRVS, BRVC, BRIE, BRID, MOV, MOVW, LDI, LDS, LD (all variants), LDD, STS, ST (all variants), STD, LPM, IN, OUT, PUSH, POP, XCH, LAS, LAC, LAT, LSL, LSR, ROL, ROR, ASR, SWAP, BSET, BCLR, SBI, CBI, BST, BLD, SEC, CLC, SEN, CLN, SEZ, CLZ, SEI, CLI, SES, CLS, SEV, CLV, SET, CLT, SEH, CLH, NOP, SLEEP

Note that several instructions may appear by a different name in log due to the same opcode of some instructions

Realized criteria

  1. Emulator is able to execute arithmetic and control instructions
  2. avra compliled programs are supported
  3. Contents of EEPROM can be read
  4. Contents of EEPROM can be modified

Installation

  1. Make sure cmake 3.0 or higher is installed on your computer
  2. Download the source code and open the bin folder in terminal
  3. cmake ../
  4. make
  5. Copy emulator to prefered location

Usage

To get futher instructions you can use ./bin/emulator --help
Usage: emulator [options] flash_file...
Options:
--help                     Display this information
-lifetime N              Stop emulator after N ms. Default is 10
-eeprom_in            Initialize EEPROM with content of
-eeprom_out          Specify as file to save EEPROM in
-in                          Specify in CSV format as input
-out                        Specify in CSV format as output
-logfile                   Print log to , not to stdout
-logio                     Enable i/o log
-logint                    Enable interrupt log
-logall                    Enable log of every instruction

Please note that i/o and any logs are disabled by default

Example

./bin/emulator ./test/1.hex -lifetime 1 -logall -logfile log.txt