Pages: 1 [2]   Go Down
Author Topic: Uploading .ino files without starting arduino.exe  (Read 2410 times)
0 Members and 1 Guest are viewing this topic.
Global Moderator
Offline Offline
Brattain Member
*****
Karma: 480
Posts: 18720
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

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


Offline Offline
Newbie
*
Karma: 0
Posts: 12
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

* UploadingViaCMD.txt (11.32 KB - downloaded 18 times.)
« Last Edit: March 10, 2012, 07:02:40 am by Airborne » Logged

Offline Offline
Edison Member
*
Karma: 26
Posts: 1339
You do some programming to solve a problem, and some to solve it in a particular language. (CC2)
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 12
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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!
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 12
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

* UploadtoArduino.java (6.21 KB - downloaded 17 times.)
* UploadtoArduino.jar (4.86 KB - downloaded 9 times.)
Logged

SF Bay Area (USA)
Offline Offline
Tesla Member
***
Karma: 132
Posts: 6739
Strongly opinionated, but not official!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
          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...)
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 12
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
         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.

* UploadtoArduino.java (5.8 KB - downloaded 15 times.)
« Last Edit: March 11, 2012, 07:06:13 am by Airborne » Logged

Pages: 1 [2]   Go Up
Jump to: