Path to project build/binaries

Hi,

Could you please help me with my questions?

I create a copy of Blink example sketch and save it as BlinkBin. Folder looks like this:
image

Now, I create folder 'bin'
image

I build the sketch and binaries are in some strange folder, away from my source code.

Questions:
Q1: How tell IDE to copy all binaries (or whatever file from folder "B89EF70E0F1381CA9D5211E696A59CDE") to my "c:\Users\frank\Documents\Arduino\BlinkBin\bin".

E.g. copy following files into my BlinkBin/bin:
BlinkBin.ino.with_bootloader.bin
BlinkBin.ino.with_bootloader.hex
BlinkBin.ino.elf BlinkBin.ino.hex
BlinkBin.ino.eep

Q2: Why is the build/binaries in separate folder from where the source code is ?

Q3: How do I change the build folder - idealy to where my source code is.

Thank you
Frank

Sketch / Export Compiled Binary should do the trick. In IDE 1.x it will place it in the sketch directory, on IDE 2.x it will create a build directory in the sketch directory.

1 Like

I guess that that is because a design decision was made to put it put it there; it's the temporary build directory.

Can it be changed ?

I knew that that question would come :smiley: And I don't know the answer.

1 Like

Not when using Arduino IDE. If you required this, use the official Arduino CLI command line tool. You can set the build path via the --build-path flag of the arduino-cli compile command:

https://arduino.github.io/arduino-cli/latest/commands/arduino-cli_compile/#options

If you tell us why you want to do this thing, we might be able to give better advice.

Have you tried using the IDE's Sketch > Export Compiled Binary feature as suggested by @sterretje? If that didn't meet your requirements, why not?

1 Like

E.g. when I want to keep track of the files with git. I do not want to remember do 'sketch>export' - this is not lazyness, things are just not done in this way.

This is rather interesting. Arduino IDE is the 1st one (uVision, QtCreator, MSVC) that keeps build files so hiden away from user. I wonder how you can even ask 'why you want to do this' - I wonder in a 'positive' way. No offence meant. Or in my other post someone asked why I would want to compile a single file and not the whole project. Somewhat different world. I find this fascinating. It just makes me think and sad how much time of creative people is wasted with waiting to build files/link project every time.

That makes sense if you think about the difference between the original purpose of Arduinos and the multitude of uses to which they are put these days

1 Like

Checking binaries into a repository is something developers generally go to lengths to avoid. Isn't the source code sufficient?

No problem. You can configure Arduino IDE to always export the binaries. I'll provide instructions you can follow to do that:

  1. Select File > Quit from the Arduino IDE menus if it is running.
    All IDE windows will close.
  2. Open the file at the following path in any text editor:
    C:\Users\frank\.arduinoIDE\arduino-cli.yaml
    
  3. Change these lines of the file:
    sketch:
      always_export_binaries: false
    
    To this:
    sketch:
      always_export_binaries: true
    
  4. Save the file.
  5. Start Arduino IDE.

You will now find that, even when you do a normal "Verify/Compile" operation in Arduino IDE, the compiled binaries are saved under the build subfolder of the sketch.

I don't know that they could be considered "hiden". The type of advanced user who would be interested in accessing them should have no difficulty doing so.

It is easy to fall into the fallacy of thinking that everyone has requirements identical to our own, but my experience of supporting Arduino users for over a decade tells me that 99.9% of Arduino IDE users have no interest in these files. Of course it is understandable that you consider your requirements personally paramount, but it is not reasonable to act as if Arduino is betraying the community as a whole by not bending over backwards to facilitate an incredibly rare use case which is already supported.

1 Like

Great, thank you for the instructions.

Interesting, thank you for sharing this 'behind the curtain' info.

Very true. Even though, as I said and I think we agree, Arduino is rather exception here. And for good reason - different audience. I am still trying to adjust.

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