How does Intel HEX relate to the bytes in flash?

Sadly I have not gotten a response from the author of the progammer sketch which I am using. His application has the potential for a optiboot section for the ATTiny85, but lacks a supporting byte array for said micro. I have a hex file which would appear to have address information as well as opcode. So what I need is either the file structure so I can parse out the opcode and discard the rest, or a file containing a byte array whose elements are the optiboot loader for the ATtiny85.

You could look at "optiloader", which includes its own little parser for .hex files; you just have to edit it (in hopefully obvious ways) to include the .hex inside the sketch.

Official doc

Intel HEX-record Format.pdf (114 KB)

The avr-objdump or avr-objdump.exe whilch is in the tools/avr/bin directory, can be used to dump the file as bytes. In theory it could also disassemble it, but I wasn't able to come with the right -m option to do it for the hex file.

Automatic disassembly
http://forum.arduino.cc/index.php/topic,46843.0.html

Specifically post #12
objdump -S BlinkASM.cpp.elf > disasm.txt

Ray

So "objdump -S optiloader_ATTIny85hex > bytefile.txt" would work?

objdump -S optiloader_ATTIny85hex > bytefile.txt

No, you must have the .elf which is created before the .hex .... You need to compile from source.

Ray

Have you seen this post?
http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&p=1082708

I have this problem with an attiny85 chip, on which I've loaded optiboot from GitHub - TCWORLD/ATTinyCore: ATTiny Core for Arduino 1.0+
<..>
amazing. ran the following command:
avrdude -c usbtiny -p t85 -P usb -U lfuse:
w:0xff:m -U hfuse:w:0xdf:m -U efuse:w:0xfe:m

to make sure SELFPRGEN is set. (efuse to 0xfe instead of 0xff)
Afterwards my sketch uploaded just fine.

Thank you david.prentice!! and greg, This would have taken me ages to find out. and sorry for the long post Wink

Edit - Added

Also included for the Tiny84 and Tiny85 is a functioning Optiboot bootloader. There are two versions of this:

The first is one which is the normal optiboot which can be compiled using the "make attiny84.bat" and "make attiny85.bat" files. This can be hit and miss whether it works due to the fact that the internal oscillator of the ATtiny's is not well calibrated.
The second is optiboot but it comes with the TinyTuner sketch built in. The bootloader takes up no additional space as the tuning sketch is overwritten by any uploaded program, however it allows the oscillator to be fully calibrated before sketches are downloaded. This is the version supplied (can be recompiled with "make attiny84_tuned.bat" and "make attiny85_tuned.bat" files). See the readme in the tiny\bootloades\optiboot\ folder for more info.

is it possible to fetch the binary from another chip with a bootloader already on it. I need to build a byte array to use with Nick Gammon's programmer application.

You should be able to use avrdude to get bytes from a microprocessor (assuming you have a second microprocessor of the same flavor, and it uses avrdude for download). You will need to invoke avrdude from the command line, and figure out where the bootloader lives in the microprocessor.

You should be able to use avrdude to get bytes from a microprocessor (assuming you have a second microprocessor of the same flavor, and it uses avrdude for download).

http://www.instructables.com/id/Copy-n-Paste-Arduino-Firmware/

Ray