Is there a way to export code for an arduino even as a hex file?

  • 2
    \$\begingroup\$ Yes, using avrdude from the command line, unless the security fuse has been set. It might even be possible then, but intentionally much harder, and not clear if anyone has yet defeated that security mechanism. \$\endgroup\$ Commented Mar 15, 2013 at 21:56
  • \$\begingroup\$ @ChrisStratton I was listening to a defcon talk where they talked about how it had been defeated. I can't remember which one it was, but google might remember. \$\endgroup\$ Commented Mar 15, 2013 at 21:58
  • \$\begingroup\$ It has been defeated for some microcontrollers, and not (at least to public knowledge, short of physical dissection) yet for others. \$\endgroup\$ Commented Mar 15, 2013 at 22:00
  • \$\begingroup\$ Yeah, I'm pretty sure it was dissected. \$\endgroup\$ Commented Mar 16, 2013 at 2:24

2 Answers 2


Perusing the source code of the Arduino bootloaders at https://github.com/arduino/Arduino/tree/master/hardware/arduino/bootloaders it appears that they do in fact support the stk500 readback functionality for flash memory, such that you can accomplish your goal with a client program such as avrdude.

So the answer to the question is that if you can access the bootloader, then yes you can read out the contents of the flash memory in a binary or hex format, without resorting to an external programmer.

If you cannot access the bootloader (reset troubles, or no intact bootloader present) then you may be able to do so with an external programmer, provided security fuse settings do not prevent this.

  • 2
    \$\begingroup\$ It turns out that not only is readback supported, the default avrdude verify behavior relies on it as it works by reading back a buffer and performing comparison on the PC. So essentially, anyone who has ever uploaded code to an ATmega based Arduino by letting the IDE invoke avrdude with the default configuration, has also implicitly read one out. \$\endgroup\$ Commented Feb 4, 2018 at 21:53

Yes, I have successfully pulled the boot kernel from one Arduino Board via ISCP and pushed it into another. The security fuses were not set. where avrdude will work. Back then I used AVR Studio with a STK500 as it had a GUI and I did not need to learn all the avrdude switches. Either will work.

Setting the fuse defeats open source. That said the boot kernel is provided in the IDE. ..\Arduino\hardware\arduino\bootloaders\atmega8\ATmegaBOOT.hex along with others variant chips.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.