I have an ATmega2560 on an Arduino board that I've been playing with. For some reason, avrdude won't tell me how the fuses are set: it says all 24 of them are 0, which doesn't make a lot of sense.
Anyway, the Atmel datasheet says (page 59) that a reset begins execution from the Reset Vector. The exact location of the Reset Vector depends on the fuses, which I can't read, but the default value of BOOTRST is 1, in which case the Reset Vector is zero
So I'm looking at the .hex file that the Arduino IDE created for upload to the board, and it starts out like this (spaces added for clarity):
:10 0000 00 0C9472000C9486000C9486000C948600 6C
If you're not familiar with Intel .hex format, the 32 digits in the middle of the line are 16 bytes of data that are to be written at the address 0000 second from the left.
So it looks like the first instruction is 0C94, which, according to the best of my hand-disassembly capabilities, works out to ADD R9, R4. The next instruction would then be 7200, which is ANDI R0, $20.
That's some really weird vector code--that is, not a vector at all--and it leads me to believe that I have a framing error here, especially since 94 looks like it could be the beginning of a JMP instruction, although if it were, the fourth digit would need to be C or D, not 2.
What's going on here? How does this Reset Vector stuff work with the avrdude upload of the Arduino .hex file?