converting hex code to assembly

I'm interesting in converting the Hex code which is produced when I compile a program into assembly, I've heared that you need some kind of disassembly for the exact microcontroller that is being programmed. in my arduino i have atmega168. anyone knows where i can find a disassembly program for this chip?


If you are looking to view the assembler produced by the arduino compiler, see this thread:

I think i got a problem:

C:\Documents and Settings\Dragonuv\Desktop\arduino-0010\hardware\tools\avr\bin>avr-objdump.exe -S c:\Blink.hex > test.txt avr-objdump.exe: Can't disassemble for architecture UNKNOWN!

Why does this happen ? Will the output file be seen as cpp? Can I make it be seen as assembly?

Thanks :)

Its the .elf file that you dump, not the hex file. The elf file contains lots of information that avr-objdump uses to mix assembly with the C source code.

Works great, thanks.

But it still leads me to the question: what does the .hex file include?

The hex file contains the runtime machine code, it's what Arduino will get when you upload a sketch. But the hex file has all of the high level information stripped out so even if you had a dissassembler you would find the output much more difficult to interpret than the output from avr-objdump.

someone of you can tell me why when I apply the avr-objdump. exe to the .elf file it generates an empty txt file? :-? any suggestion?

try running it from the command line to see if you get the exptected output: avr-objdump.exe -S mysketch.elf

I follow your instructions in the post linked above. that's what you're suggesting me I presume, but the result is a blank txt file