Where is the compiled program stored on Windows 10?

I have several goals in learning about this...
One of them is finding where the source code is compiled to before it is uploaded to the device... Arduino Uno or EXP32.

Here are the questions:

1 - Clicking the "Verify" Icon on the Arduino IDE causes the source code to compile but not upload to the device... correct?

2 - Where on a Windows 10 PC would the code compile to... which folder?

3 - Where on a Linux Mint machine would the code compile to?

One of my other goals is to alternately use the espTools utility to upload the "binary blob" to an esp32 DevKit v4 board... or whatever.

Thanks for any help.

Have you tried turning on verbose reporting for compilation in Preferences and looking at the output ?

I just turned on "verbose reporting" and pasted the tons and tons and tons of output into Notepad++
Now my eyes are rolling back in my head.

My Source Code was saved via the Arduino IDE as...
program-test

Question 1: Arduino IDE saves this as...
program-test.ino
right?
And it is a text file... right?

Question 2: I thought the compiled file would be saved as...
program-test.bin
but then I read that the Arduino IDE saves it as
program-test.hex
right?

Question 3: I still can't figure out where the compiled file is saved on the Windows 10 PC I'm using...

Thanks for any help.

My mistake. You need to turn on verbose reporting for upload to see what you are looking for. Turn off the verbose output for compilation to make things clearer and look for a line like this

avrdude: reading input file "C:\Users\Bob2\AppData\Local\Temp\arduino_build_586883/sketch_may05b.ino.hex"

and you will see the exact name and location of the file that avrdude uploads

OK I did that but it seems my Arduino IDE is using espTools and not avrdude.

When I installed espTools did I accidentally tell the Arduino IDE to us it instead of avrdude?

Also, is the file name I'm looking for a filename.bin or filename.hex?
(I see a filename.bin but not a filename.hex in the folder that "I think" the Arduino IDE is compiling to...)

Thanks for the help.

No, you are using an ESP processor and not surprisingly that does not use avrdude to upload the code

However, all is not lost. In the Sketch menu of the IDE you will see an option to Export the compiled binary file which is an option that I have never needed to use

OK, that was a good tip... and education on avrdude and esptool :slight_smile:

The exported file ended up (I think) in...
C:\Users\user-01\Documents\Arduino\esp32 code by me\esp32_blink_3pins
with a file name of...
esp32_blink_3pins.ino.esp32.bin

And the source file is in the same folder named...
esp32_blink_3pins.ino
Does that seem right?

And, fyi, among my goals here is to learn how to upload a compiled program to the esp32 using espTool... just so you know where I'm headed. I relatively new to both Arduino and esp32 thus the inquiries.
Thanks for the help.

By default I believe that the file ends up in the sketch directory with a name related to the name of the sketch if you have saved the sketch, that is

I have found that in Windows, the IDE creates a bunch of files in a Temp folder that we don't have control over. Here is a sketch I compiled yesterday for example.
This location may be hidden, so you may have to unhide it to see the files.
The .hex will be moved to the Sketch folder with the "Sketch:Export compiled binary" command.

Should the compiled file end in .bin or .hex?

I see a .bin file but, so far, no .hex.

Thanks for the help all

I depends on which file format the uploader tool requires. AVRDUDE requires a .hex file, so that is why the Arduino AVR Boards platform configures the build system to produce a .hex file.

esptool requires a .bin file, so that is why the esp32 boards platform configures the build system to produce a .bin file.

Try the Export Compiled Binary option, that should result in a .hex file in your sketch folder.

From Redirecting

When you do a Sketch > Export compiled Binary in the Arduino IDE, the compiled binary is copied from the build folder to the sketch folder. Two binaries are copied; the standard binary, and a binary that has been merged with the bootloader file (identified by the .with_bootloader in the filename).

Two recipes affect how Export compiled Binary works:

  • recipe.output.tmp_file: Defines the binary's filename in the build folder.
  • recipe.output.save_file: Defines the filename to use when copying the binary file to the sketch folder.

Here you can see the recipe for AVR:
https://github.com/arduino/ArduinoCore-avr/blob/1.8.3/platform.txt#L77

recipe.output.save_file={build.project_name}.{build.variant}.hex

and here for ESP32:
https://github.com/espressif/arduino-esp32/blob/1.0.6/platform.txt#L99

recipe.output.save_file={build.project_name}.{build.variant}.bin

And the upload recipes:

https://github.com/arduino/ArduinoCore-avr/blob/1.8.3/platform.txt#L106

tools.avrdude.upload.pattern="{cmd.path}" "-C{config.path}" {upload.verbose} {upload.verify} -p{build.mcu} -c{upload.protocol} "-P{serial.port}" -b{upload.speed} -D "-Uflash:w:{build.path}/{build.project_name}.hex:i"

https://github.com/espressif/arduino-esp32/blob/1.0.6/platform.txt#L111

tools.esptool_py.upload.pattern="{path}/{cmd}" --chip esp32 --port "{serial.port}" --baud {upload.speed}  --before default_reset --after hard_reset write_flash -z --flash_mode {build.flash_mode} --flash_freq {build.flash_freq} --flash_size detect 0xe000 "{runtime.platform.path}/tools/partitions/boot_app0.bin" 0x1000 "{runtime.platform.path}/tools/sdk/bin/bootloader_{build.boot}_{build.flash_freq}.bin" 0x10000 "{build.path}/{build.project_name}.bin" 0x8000 "{build.path}/{build.project_name}.partitions.bin"
tools.esptool_py.upload.pattern.linux=python "{path}/{cmd}" --chip esp32 --port "{serial.port}" --baud {upload.speed}  --before default_reset --after hard_reset write_flash -z --flash_mode {build.flash_mode} --flash_freq {build.flash_freq} --flash_size detect 0xe000 "{runtime.platform.path}/tools/partitions/boot_app0.bin" 0x1000 "{runtime.platform.path}/tools/sdk/bin/bootloader_{build.boot}_{build.flash_freq}.bin" 0x10000 "{build.path}/{build.project_name}.bin" 0x8000 "{build.path}/{build.project_name}.partitions.bin"

There is an undocumented (?) option that you can add to your preferences.txt file:

build.path=/tmp/Arduino1.8.13Build/

(that's for my Mac. I'm not sure exactly what you'd use for windows...)

It is documented here:
https://arduino.github.io/arduino-cli/latest/platform-specification/#build-process

However, you could still consider it undocumented since the fact that you can set build properties in preferences.txt is not documented. That deficiency is tracked here:

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.