Nugroho's blog.: Disassembler

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:

323f (5) amp (1) android (12) apple (7) arduino (18) art (1) assembler (21) astina (4) ATTiny (23) blackberry (4) camera (3) canon (2) cerita (2) computer (106) crazyness (11) debian (1) delphi (39) diary (286) flash (8) fortran (6) freebsd (6) google apps script (8) guitar (2) HTML5 (10) IFTTT (7) Instagram (7) internet (12) iOS (5) iPad (6) iPhone (5) java (1) javascript (1) keynote (2) LaTeX (6) lazarus (1) linux (29) lion (15) mac (28) macbook air (8) macbook pro (3) macOS (1) Math (3) mathematica (1) maverick (6) mazda (4) microcontroler (35) mountain lion (2) music (37) netbook (1) nugnux (6) os x (36) php (1) Physicist (29) Picture (3) programming (189) Python (109) S2 (13) software (7) Soliloquy (125) Ubuntu (5) unix (4) Video (8) wayang (3) yosemite (3)