How can I upload to my Arduino without compiling?

I'm constantly forgetting to plug my USB back into my Arduino before I upload and I often get annoying avrDude not in sink messages and problems with my COM port. Every single time I want to upload I have to wait for my code to compile, even if that exact same code has already been compiled five or six times. Is there any way to upload my code directly to my Arduino without compiling, assuming it's already been compiled at least once and hasn't been edited since? Just to clarify: I know you have to compile your code every time you change anything, I'm not talking about that. I'm only talking about code that I've compiled and haven't edited since it was compiled and then uploading that to my Arduino without having to go through the compiling process again. Thanks!

If you haven't changed anything, why do you need to upload again? The code is already in the Arduino.

Set the IDE to verbose and have a look at how avrdude is called. Copy this to the commandline and it should upload the file again.

1.0.1 only recompiles necessary changes.

Of course any other process than clicking "upload" will certainly take you longer than just clicking upload and waiting the few seconds the process takes.

I don't have the world's fastest computer, but most of my Arduino compiles take less than an hour.

...less than an hour.

Wow, that's some huge program! :P

AWOL: If you haven't changed anything, why do you need to upload again? The code is already in the Arduino.

That is the key to the OP's question. If there are no changes to the sketch then there in no reason to upload the same sketch again into to the arduino. The sketch loaded prior is stored in flash memory on the chip which is non-volatile and does not go away or change just because you powered off and on the arduino.

Lefty

retrolefty: That is the key to the OP's question.

No. It isn't. In fact, it has nothing to do with the original question.

The key to the OP's question is the statement: "I'm constantly forgetting to plug my USB back into my Arduino before I upload"

Further strengthen with: "Is there any way to upload my code directly to my Arduino without compiling, assuming it's already been compiled at least once and hasn't been edited since?"

Which closed with: "I'm only talking about code that I've compiled and haven't edited since it was compiled and then uploading that to my Arduino without having to go through the compiling process again. "

So the Original Poster is talking about the sequence:

  1. Edit Code
  2. Hit Upload
  3. Realize Arduino is not connected.
  4. Connect Arduino
  5. Hit Upload again. --> Watch compiling process start from beginning. They want to avoid compiling again.

In an attempt at being cute, AWOL's comment was off-topic to the original question.

I don't do "cute". Ask anyone who knows me.

TCWORLD:

...less than an hour.

Wow, that's some huge program! :P

Perhaps James was just being cute?

Lefty

sometimes I use the Arduino board to program multiple chips to the same script. It re-compiles each time. Fortunately it takes less than an hour... 10- 20 seconds.. to compile, annoying, but I think we can live with it.

RPCoyle: sometimes I use the Arduino board to program multiple chips to the same script.

I hope you're using a ZIF socket shield or something similar to do that; DIP sockets aren't designed for constant plugging/unplugging - their contacts will eventually become weak, and poor contact will result (causing you all kinds of subtle, random and difficult to debug errors).

Is anyone having this problem with the newest version of arduino (1.0.1)? Things should not get recompiled unless you've changed them since you last compiled.

WizenedEE: Is anyone having this problem with the newest version of arduino (1.0.1)? Things should not get recompiled unless you've changed them since you last compiled.

Are you sure of that? I thought it (1.0.1) would not recompile any library source files if they haven't changed, but would still always recompile the main sketch.

Lefty

Maybe the OP's real question should be "How can I remember to plug the USB cable into the Arduino?"

8)

retrolefty:

WizenedEE:
Is anyone having this problem with the newest version of arduino (1.0.1)? Things should not get recompiled unless you’ve changed them since you last compiled.

Are you sure of that? I thought it (1.0.1) would not recompile any library source files if they haven’t changed, but would still always recompile the main sketch.

Lefty

That is correct.

In other words, why Arduino IDE does not have an interface similar to avrdude GUI? Considering that one of the goals is to support other AVRs as well, I think is time to have the required tool to upload the .hex files.

Why we need it... Imagine that maybe I'm making boards for others, boards which use different ATmegas and I need to upload hex files to test the board functionality, frequently switching from one ATmega to another (and obviously, from a hex file to another). For those hex files, I need to compile only once. But there can be various scenarios...

For the start, it will be good to have a GUI interface to Optiboot bootloader. BTW, Optiboot bootloader support ATmega168P which is not yet supported by Arduino IDE and such interface will help if you decided to go beyond Arduino language.


Edit: A funny thing: the users of MPIDE wants the same thing!

http://www.arduino.cc/playground/Learning/CommandLine

However I suggest to not go for make but for scons.

https://github.com/suapapa/arscons

scons is much easier to pickup and maintain.

[quote author=Udo Klein link=topic=113862.msg878259#msg878259 date=1343755381] However I suggest to not go for make but for scons.

https://github.com/suapapa/arscons

scons is much easier to pickup and maintain. [/quote]

Despite the fact that make is used literally everywhere? And it's as simple as (for my makefile) typing "make" "make upload" or "make monitor" (or "make upload monitor")

[quote author=Tom Carpenter link=topic=113862.msg856630#msg856630 date=1342035765]

...less than an hour.

Wow, that's some huge program! :P [/quote] 3ms is less than an hour. Just thought I'd point that out.

I find myself in the same situation as the original poster sometimes: I have to wait for the whole sketch to recompile because I forgot to plug in the board. Is there any way to get the basic Arduino IDE to only compile/link the parts that have changed? This would also be useful for compiling sketches with multiple files: if you haven't changed the file, it doesn't need to recompile.

make is used quite often for historic / backwards compatibility reasons. If you start from scratch there is no need to go for make. Make has awkward syntax and little to no debug support. scons on the other hand is based on python. That is instead of tricking your way through complicated stuff you can just code it (and debug it). I find scons way simpler to pick up than make. I defintely invested more time in scons than in make. For the very reason that make has lots of nasty surprises and scons is simple. For my private projects I will use scons over make 99 out of 100.