Can't upload larger sketch to mega2560 using windows

Hello all,
I need some help. I'm having problems uploading using WinXP or 2003, but on Linux I can upload fine. I'm using Arduino-1.0 on all three OS's. The symptom is that the upload hangs indefinitely. No error messages, no joy. I can upload any number of samples and smaller sketches and they work fine, but my production sketch of 36742 bytes will not upload. If I comment out some of the code, it'll upload. But I need that code! I've checked for !!!, that is not my problem. The only other thing I can tell you is that while watching the LEDs while uploading, I see that the tx and rx LEDs both go from blinking to not blinking momentarily, then the rx LED goes out, followed by the tx LED. Avrdude hangs indefinitely at this point and has to be killed. I've tried some of the solutions posted by other users, such as replacing my avr tools with those from version 0022, no joy. replaced "mega25602560.upload.protocol=stk500v2" with "...=wiring", no joy. I don't have a clue what else to try.

Do you have a very large number of strings in the program. e.g.
Serial.print("Lots and lot of these?");

On second thought, if it uploads on Linux that may not be the problem.

Actually, I do have a lot of statements just like that. Why, what is the relevance ?

I'm using a 328-based Duemilanove which only has 2kB of SRAM, which is where literal strings are stored unless you move them into flash memory. The Mega has 8kB of SRAM so you would need a lot of those strings to cause a problem and if you are exeeding the limit of SRAM in your Arduino then it should fail on both WIndows and Linux.
But, it might be worth trying this just to see if it helps.
Wherever you have a statement like this:
Serial.print("whatever"); // or .println
change it to:

The F() macro puts the string in flash memory and the Serial.print/println statements will print it from there.


OK, I've may have solved the issue, though I may have introduced other issues. I am now running Arduino from the git repository. Evidently the avr tool chain from Arduino-1.0 has issues that are resolved with the avr tool chain from the current development version on the git repository. My sketch now uploads without issues.