Nugroho's blog.: Disassembler

Pages

Wednesday, May 13, 2015

Disassembler



 vAVRdisasm is an 8-bit Atmel AVR firmware disassembler. 

According to its site, this single-pass disassembler can read Atmel Generic, Intel HEX8, and Motorola S-Record formatted files containing valid AVR program binaries.

I compile it without problem on my Macbook Air running OS X Yosemite. Simply by typing 

make

and there it is, the binary is created. Copied it to my /usr/local/bin (or whatever you want, copy it to Desktop, or even use it as is in the download folder, in its source directory )



Last login: Mon May 11 11:12:14 on ttys000

Nugrohos-MacBook-Air:~ nugroho$ cd Downloads/

Nugrohos-MacBook-Air:Downloads nugroho$ cd vavrdisasm-master/

Nugrohos-MacBook-Air:vavrdisasm-master nugroho$ ls

COPYING crazy_test.py print_stream.c

ChangeLog.md disasm_stream.h print_stream.h

Makefile file stream_error.h

README.md instruction.h vavrdisasm.sln

avr lsupp vavrdisasm.vcproj

byte_stream.h main.c

Nugrohos-MacBook-Air:vavrdisasm-master nugroho$ less README.md

Nugrohos-MacBook-Air:vavrdisasm-master nugroho$ make

gcc -Wall -O3 -D_GNU_SOURCE -I. -c file/libGIS-1.0.5/atmel_generic.c -o build/file/libGIS-1.0.5/atmel_generic.o

gcc -Wall -O3 -D_GNU_SOURCE -I. -c file/libGIS-1.0.5/ihex.c -o build/file/libGIS-1.0.5/ihex.o

gcc -Wall -O3 -D_GNU_SOURCE -I. -c file/libGIS-1.0.5/srecord.c -o build/file/libGIS-1.0.5/srecord.o

gcc -Wall -O3 -D_GNU_SOURCE -I. -c file/atmel_generic.c -o build/file/atmel_generic.o

gcc -Wall -O3 -D_GNU_SOURCE -I. -c file/ihex.c -o build/file/ihex.o

gcc -Wall -O3 -D_GNU_SOURCE -I. -c file/srecord.c -o build/file/srecord.o

gcc -Wall -O3 -D_GNU_SOURCE -I. -c file/binary.c -o build/file/binary.o

gcc -Wall -O3 -D_GNU_SOURCE -I. -c file/debug.c -o build/file/debug.o

gcc -Wall -O3 -D_GNU_SOURCE -I. -c file/test.c -o build/file/test.o

gcc -Wall -O3 -D_GNU_SOURCE -I. -c file/asciihex.c -o build/file/asciihex.o

gcc -Wall -O3 -D_GNU_SOURCE -I. -c avr/avr_instruction_set.c -o build/avr/avr_instruction_set.o

gcc -Wall -O3 -D_GNU_SOURCE -I. -c avr/avr_disasm.c -o build/avr/avr_disasm.o

gcc -Wall -O3 -D_GNU_SOURCE -I. -c avr/avr_print.c -o build/avr/avr_print.o

gcc -Wall -O3 -D_GNU_SOURCE -I. -c print_stream.c -o build/print_stream.o

gcc -Wall -O3 -D_GNU_SOURCE -I. -c main.c -o build/main.o

gcc build/file/libGIS-1.0.5/atmel_generic.o build/file/libGIS-1.0.5/ihex.o build/file/libGIS-1.0.5/srecord.o build/file/atmel_generic.o build/file/ihex.o build/file/srecord.o build/file/binary.o build/file/debug.o build/file/test.o build/file/asciihex.o build/avr/avr_instruction_set.o build/avr/avr_disasm.o build/avr/avr_print.o build/print_stream.o build/main.o -o vavrdisasm

Nugrohos-MacBook-Air:vavrdisasm-master nugroho$ ls

COPYING crazy_test.py print_stream.h

ChangeLog.md disasm_stream.h stream_error.h

Makefile file vavrdisasm

README.md instruction.h vavrdisasm.sln

avr lsupp vavrdisasm.vcproj

build main.c

byte_stream.h print_stream.c

Nugrohos-MacBook-Air:vavrdisasm-master nugroho$ ./vavrdisasm

Usage: ./vavrdisasm [options]

Disassembles program file . Use - for standard input.



vAVRdisasm version 3.1 - 09/18/2014.

Vanya A. Sergeev -

https://github.com/vsergeev/vavrdisasm



Options:

-o, --out-file Write to file instead of standard output.



-t, --file-type Specify file type of the program file.



--assembly Produce assemble-able code with address labels.



--data-base-hex Represent data constants in hexadecimal

(default).

--data-base-bin Represent data constants in binary.

--data-base-dec Represent data constants in decimal.



--no-addresses Do not display address alongside disassembly.

--no-opcodes Do not display original opcode alongside

disassembly.

--no-destination-comments Do not display destination address comments

of relative branch/jump/call instructions.

--objdump Create avr-objdump compatible output.

Affects address display.



-h, --help Display this usage/help.

-v, --version Display the program's version.



Supported file types:

Atmel Generic generic

Intel HEX8 ihex

Motorola S-Record srec

Raw Binary binary

ASCII Hex ascii



Nugrohos-MacBook-Air:vavrdisasm-master nugroho$ cp vavrdisasm /usr/local/bin/

cp: /usr/local/bin/vavrdisasm: Permission denied

Nugrohos-MacBook-Air:vavrdisasm-master nugroho$ sudo cp vavrdisasm /usr/local/bin/

Password:

Nugrohos-MacBook-Air:vavrdisasm-master nugroho$ vavrdisasm



Here vAvrDisasm in action

Nugrohos-MacBook-Air:ATTiny13A nugroho$ cd 
Nugrohos-MacBook-Air:~ nugroho$ cd Desktop/mikrocontroller/ATTiny/ATTiny13A/
Nugrohos-MacBook-Air:ATTiny13A nugroho$ ls
coba.cof coba.eep.hex coba.hex coba.obj coba.s tn13Adef.inc
Nugrohos-MacBook-Air:ATTiny13A nugroho$ vavrdisasm coba.hex
0: c0 00 rjmp .+0 ; 0x2
2: e0 01 ldi R16, 0x01
4: bb 08 out $18, R16
6: bb 07 out $17, R16
8: cf ff rjmp .-2 ; 0x8
Nugrohos-MacBook-Air:ATTiny13A nugroho$
.

No comments:

Post a Comment