Go Down

Topic: Uploading .ino files without starting arduino.exe (Read 2748 times) previous topic - next topic

Nick Gammon

Quote
... I do think that would be too easy since there is no software involved..


Too easy for the end-user huh? Ah well.
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

Airborne

#16
Mar 10, 2012, 11:51 am Last Edit: Mar 10, 2012, 01:02 pm by Airborne Reason: 1
Quote

Too easy for the end-user huh? Ah well.


Haha no, you are right.. for the end users it would be nicer to use a switch or something like that, but I do think it gets kinda complicated when you need to adjust a lot of variables in you compiled cpp file uploaded to the Arduino. For example, if you want to adjust the LEDs powered by the Arduino, to disable certain LEDs, buttons etc. I'd think that using software to adjust this settings by uploading new files would make your program run faster and it would also contain less bugs.

UPDATE:
I've managed to upload a simple file to the Arduino via commandline. I copied the build2134567341.tmp to my dekstop and renamed it to  build2134567341. After that I excuted the code given by the verbose output where I renamed the tmp paths to where the build file was stored. Which did exactly what I wanted! : )

I have only one question: what commandlines are used to upload the .hex file? (See attachment file for log.txt) I'm guessin the last 4 lines, but I'm not sure

tuxduino

Avrdude does the upload

C:\arduino-1.0\hardware/tools/avr/bin/avrdude -CC:\arduino-1.0\hardware/tools/avr/etc/avrdude.conf -v -v -v -v -patmega328p -carduino -P\\.\COM5 -b115200 -D -Uflash:w:C:\Users\Casper\Desktop\build7121856102984891376\sketch_feb15a.cpp.hex:i

Airborne


Avrdude does the upload

C:\arduino-1.0\hardware/tools/avr/bin/avrdude -CC:\arduino-1.0\hardware/tools/avr/etc/avrdude.conf -v -v -v -v -patmega328p -carduino -P\\.\COM5 -b115200 -D -Uflash:w:C:\Users\Casper\Desktop\build7121856102984891376\sketch_feb15a.cpp.hex:i


Great, that is all I needed to know. Thanks all for your help!

Airborne

Yesterday, I made a little Java program that uploads (.ino to ->).cpp files remotely to any Arduino board. If one might be interested how I figured out how to do this, the .java file is in the attachment aswell as a jar file that can be run.

Little tutorial:
1. Upload the file first to the Arduino via the Arduino IDE. Make sure verbose is on for compile. Enable this in at the tab file -> preferences. hit the checkbox for compile.
2. Copy the path to the buildxxxxxxxxxxxxx.tmp folder. You can find this path somewhere between the lines in the verbose output. This path should look like this: C:\Users\YourName\AppData\Local\Temp\build3834200296320359542.tmp if you are on Windows, but I'm sure that this file is also somewhere located on other OSs.
3. Copy that folder to your desktop, remove the .tmp extention, run the java program and follow the instructions. Make sure you know what you are doing ; )

The arguments that are send via the little java program are the commands to upload the file.


Casper

westfw

Code: [Select]
          message = "This program requires a target file to upload to the Arduino \ne.g.:sketch_feb15a.cpp\nThe extention .cpp is required, however the path may NOT be included";
        title = "Path required";
               :
          arduinoFolder + "\\hardware\\tools\\avr\\bin\\avr-gcc -Os -Wl,--gc-sections -mmcu=" + microcontroller + " -o " + targetFolderPath + "\\" + targetFilePath + ".elf " + targetFolderPath + "\\" + targetFilePath + ".o " + targetFolderPath + "\\core.a -L" + targetFolderPath + "\\build7121856102984891376 -lm",

But that doesn't upload the .ino file; it compiles and uploads the .cpp file that the Arduino IDE has generated.  I suppose that this is easier to edit than a binary, but it requires a pretty huge directory full of pre-compiled libraries to work, as well.
If you're willing to work with that quantity of pre-compiled binaries, then you might as well put the bits you are interested in changing into a separate linkable entity that is less dependent on the full Arduino environment (note that it is pretty easy to make ANY file into a  "linkable entity" using avr-objcopy...)

Airborne

#21
Mar 11, 2012, 12:45 pm Last Edit: Mar 11, 2012, 01:06 pm by Airborne Reason: 1

Code: [Select]
         message = "This program requires a target file to upload to the Arduino \ne.g.:sketch_feb15a.cpp\nThe extention .cpp is required, however the path may NOT be included";
       title = "Path required";
              :
         arduinoFolder + "\\hardware\\tools\\avr\\bin\\avr-gcc -Os -Wl,--gc-sections -mmcu=" + microcontroller + " -o " + targetFolderPath + "\\" + targetFilePath + ".elf " + targetFolderPath + "\\" + targetFilePath + ".o " + targetFolderPath + "\\core.a -L" + targetFolderPath + "\\build7121856102984891376 -lm",

But that doesn't upload the .ino file; it compiles and uploads the .cpp file that the Arduino IDE has generated.  I suppose that this is easier to edit than a binary, but it requires a pretty huge directory full of pre-compiled libraries to work, as well.


Correct and thanks for noticing.

Updated UploadtoArduino.java  // Same program without compiling just uploading the .hex file.

Go Up