Export .elf and other output files

Hello,
I'm trying to use Arduino with Proteus for debug. This requires access to the .elf file. I KNOW I can specify the build path in preferences.txt BUT this is overwritten each time you compile. I am using 2 Arduinos in my project, and dont want to have to copy/paste after each compile (as I am doing now) but wondered if there was a way of extending the 'Export Compiled Binary ' option in the Sketch menu so that all the data would be in the Sketch folder.

Many thanks

Stevewidg

Unfortunately it's not possible to modify the behavior of Export Compiled Binary without actually changing the Java code of the IDE and rebuilding the IDE. Every other part of the compilation/upload process is very easy to modify or extend via the platform.txt file but not Export Compiled Binary. The reason is that Arduino has stubbornly retained a strict policy of not giving the user programmatic access to the location of the sketch folder despite repeated requests for this over the years. They're so afraid that doing that would lead to less beginner friendly 3rd party library APIs.

If you just need to save the .elf file to a specific folder this is easily done though. You can just add a hook to platform.txt:

Let me know if you need some instruction on how to find the correct platform.txt to modify.