{"id":936,"date":"2015-08-04T13:42:56","date_gmt":"2015-08-04T12:42:56","guid":{"rendered":"http:\/\/www.kanda.com\/blog\/?p=936"},"modified":"2024-01-11T12:46:52","modified_gmt":"2024-01-11T11:46:52","slug":"find-arduino-hex-files-output-binaries","status":"publish","type":"post","link":"https:\/\/www.kanda.com\/blog\/microcontrollers\/avr-microcontrollers\/find-arduino-hex-files-output-binaries\/","title":{"rendered":"Where to find Arduino Hex files or Output Binaries"},"content":{"rendered":"

You can use a normal AVR ISP programmer to upload Arduino sketches to an Arduino board or to an AVR microcontroller in your own circuit, such as ATmega328P, ATmega8 or ATmega2561, but first you need to know how to find the hex files that the programmer needs. The Arduino IDE makes this as hard as possible for some reason. This post shows you how to find them and also how to make Arduino put them in an easier place to find in future.<\/p>\n

<\/p>\n

Any ISP will need what Arduino calls output binaries and the rest of the world calls HEX files. These are produced when you Verify\/Compile your sketch and contain the data the AVR microcontroller needs to run. The Arduino IDE creates them in temporary folders in your user libraries or \/tmp folders on MAC, with a typical path like this<\/p>\n

C:\\Documents and Settings\\your_username\\Local Settings\\Temp\\build3526495849735274299.tmp.<\/p>\n

This changes with every build, which makes it really difficult to locate them, especially the most recent version. A better way is to change the Build Path in Arduino so it puts them somewhere sensible.<\/p>\n

The method has changed in Arduino 2.0 so see later section for this version<\/p>\n

Arduino Version 1<\/h3>\n

Run Arduino IDE <\/strong>and choose File -> Preferences<\/strong>. This dialog box will appear,<\/p>\n

\"Arduino<\/a>
Arduino Preferences Dialog<\/figcaption><\/figure>\n

Switch on Show Verbose Output During Compilation<\/strong> so we can see what is going on. This may be useful later and can always be switched off again. At the bottom is a path to your preferences.txt file that we are going to edit. This path is different on different Operating Systems and in some cases may be hidden by your system. If you can’t find this path in Explorer, try Organise -> Folder and Search Options -> View Tab<\/strong> and select Show hidden files, folders and drives.<\/p>\n

Once you have found preferences.txt<\/em> file, close your Arduino IDE and open this file in a text editor like Notepad.\u00a0 Add a build path anywhere in the file. Here is an example but select your own preferred folder location.<\/p>\n

build.path=C:\\Myproject<\/strong><\/p>\n

Important Note: <\/strong>You must create this empty folder yourself now as Arduino won’t and will give errors.<\/em><\/p>\n

Save the file and reopen Arduino and Verify\/Compile your sketch again. This time the output files we need should always appear in the folder you have added to preferences.txt. This path should also appear towards the end of the Arduino output window after a successful compile.<\/p>\n

If everything has gone right, your folder should be full of output files, mostly with .o and .d extensions. These are used by linker and can be ignored. The important files will be these, where the sketch is called Blink1.ino, so look for your own sketch name –<\/p>\n