avrdude to load bootloader and a program at the same time

I have installed the libusb drivers for the avrisp mk2 programmer and that is working. From the Arduino IDE if I choose to load a bootloader via the avrisp mk2 and then load my arduino sketch that works. Does anyone know how to get to this to one step?

I was thinking there might be a way to do this if I installed a standalone version of avrdude. I did get this loading a bootloader, but the chip didn't work. I'm sure it's something else I'm missing (perhaps I could just use one of the makefiles that the arduino bootloader uses?). But before I go to the trouble of this I thought I'd check to see if it's going to be reasonable to load the bootloader and an initial sketch?

Anyone have experience with this?


You can merge the .hex files to do that.

Just remove the ":00000001FF" line of your main program's .hex file and append the bootloader code.

I finally got around to testing this and it worked great. Thanks!

I’m curious as to why you would want to use the AVRISP to load a bootloader along with the program? You generally use a bootloader to load a program when you don’t have or for some reason don’t want to use an ISP programmer.

[Edit] Never mind - I missed the word “initial” when I read it the first time.


Hello everybody,

I started writing a simple tool a couple of days ago for just this task: merging two Arduino Hex-files into one. If you are brave enough to try some beta-software, please go ahead here: https://github.com/tobiasvogel/hexMerger ;)

The latest released version can always be found under "Release" at the top of the page.

Please be aware that I just started this project, so there may be bugs, or it even may not work at all under certain circumstances. Leave a comment or feedback and I will be happy to review it and improve the tool as far as I can!