Arduino Forum

Topics => Device Hacking => Topic started by: EmilyJane on Sep 10, 2011, 01:01 am

Title: Atmega disassembler for OS X
Post by: EmilyJane on Sep 10, 2011, 01:01 am
Does anyone have a favorite Atmega disassembler that runs under OS X?. I can boot into Windows if I have to so if there is a particularly good (free) one for Windows, I might be interested. I have the object code out of the AAG weather station that I would like to disassemble, just for grins.
Title: Re: Atmega disassembler for OS X
Post by: johnwasser on Sep 10, 2011, 04:13 am
What format is the object code?  .o?  .hex?

The Arduino distribution includes avr-objdump and avr-readelf which can read and disassemble various object formats.

In a terminal window, try:  /Applications/Arduino22.app/Contents/Resources/Java/hardware/tools/avr/bin/avr-objdump -h (yourfile)
Title: Re: Atmega disassembler for OS X
Post by: EmilyJane on Sep 10, 2011, 05:02 am

What format is the object code?  .o?  .hex?

The Arduino distribution includes avr-objdump and avr-readelf which can read and disassemble various object formats.

In a terminal window, try:  /Applications/Arduino22.app/Contents/Resources/Java/hardware/tools/avr/bin/avr-objdump -h (yourfile)


I saved in .hex. I'll give that a try! Thanks!
Title: Re: Atmega disassembler for OS X
Post by: EmilyJane on Sep 10, 2011, 05:42 pm


What format is the object code?  .o?  .hex?

The Arduino distribution includes avr-objdump and avr-readelf which can read and disassemble various object formats.

In a terminal window, try:  /Applications/Arduino22.app/Contents/Resources/Java/hardware/tools/avr/bin/avr-objdump -h (yourfile)


I saved in .hex. I'll give that a try! Thanks!


That pointed me in the right direction. The right switches are: avr-objdump -j .sec1 -d -m avr flash.hex
Title: Re: Atmega disassembler for OS X
Post by: EmilyJane on Sep 14, 2011, 04:17 pm
Well, I disassembled the factory object code from the weather station. I have no previous experience with looking at disassembled C code for the Atmel processors if this was indeed originally written in C, but it looks pretty straightforward. They used the Y-register as a stack frame pointer for local variable storage and the UART receive routine is interrupt driven. It's an interesting experiment taking apart their code, but I don't think I'm going to spend much more time on it. There aren't any real mysteries about how to use the existing hardware.