2

How do I use the Arduino IDE to upload the last compiled code? I don't want to have to wait 2 minutes to upload compiled code when there are no changes. It's a big codebase where I frequently make one or two small changes and have some issue with my MCU or USB cables. Frequently the controller on my boards are damaged due to some overcurrent issue because of the high-heat nature of 3d printing. So having to wait an extra 2-5 minutes every time I experiment with this unacceptable.

Obviously, there is a keyboard shortcut to do this that I'm unaware of. Because otherwise this would add hours to development.

Please tell me how I can get Arduino-IDE to just 'upload without compiling' my sketch.

2
  • What version of the Arduino IDE are you using? It used to be rubbish, but later versions have better caching of compiled code. Alternatively UECIDE has far better caching than the Arduino IDE and recompilation is a lot faster because of that.
    – Majenko
    Sep 17, 2019 at 20:55
  • you can find the compile bin file in your temp folder, then use a different upload tool (or OTA) to send it out.
    – dandavis
    Sep 18, 2019 at 5:32

2 Answers 2

3

You can upload hex file to your board from command line without Arduino IDE.

To get the hex file, use in Arduino IDE in menu the command "Export compiled binary". It will save the hex file next to the ino file.

I assume your board in printer has AVR MCU. Then you can use avrdude from command line to upload the hex file again and again without any compilation.

The avrdude command on Windows is (if started from the sketch's folder):

%LOCALAPPDATA%\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/bin/avrdude -C%LOCALAPPDATA%\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf -v -patmega328p -carduino -PCOM11 -b115200 -D -Uflash:w:Blink.ino.hex:i

The command line is for the Blink sketch and for AVC boards package 1.6.21

2

This is what I have done. In the arduino IDE settings panel, turn on the "Show verbose output during compile and upload". This way whenever you are doing verify and upload you can see all the command that Arduino has performed. Now after you hit Verify or Upload it, you can copy the last command before the upload, such as

"/Users/fang/Library/Arduino15/packages/arduino/tools/avrdude/6.3.0-arduino17/bin/avrdude" "-C/Users/fang/Library/Arduino15/packages/arduino/tools/avrdude/6.3.0-arduino17/etc/avrdude.conf" -v -V -patmega32u4 -cavr109 "-P/dev/cu.usbmodem21101" -b57600 -D "-Uflash:w:/private/var/folders/xb/4609zdjx4tn3bv_6jh2nym_r0000gn/T/arduino/sketches/7972D54945A751059BF3114D2057C2B6/sketch_aug4c.ino.hex:i"

Now, when you need to upload without compiling again, just paste this line to the Terminal, it'll do the rest for you. Essentially you can see Arduino IDE is just a wrapper around these commands.

Update:

I also found another way which is kinda of different but more effective. If you happen to use Visual Studio Code, you can also try the PlatformIO plugin which can compile and upload code separately, I wrote an article about it here, https://windmaomao.medium.com/use-platformio-to-write-arduino-code-3c957c4e58b5

Your Answer

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

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