Go Down

Topic: converting hex code to assembly (Read 4846 times) previous topic - next topic

dragonuv

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?

Thanks.

mem

If you are looking to view the assembler produced by the arduino compiler, see this thread: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1207951658

dragonuv

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 :)

mem

#3
Apr 25, 2009, 01:12 pm Last Edit: Apr 25, 2009, 01:13 pm by mem Reason: 1
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.

dragonuv

Works great, thanks.

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

mem

#5
Apr 25, 2009, 03:26 pm Last Edit: Apr 25, 2009, 03:28 pm by mem Reason: 1
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.

vinnyc

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?

mem

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



vinnyc

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

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy