Go Down

Topic: executable code uploader (Read 3 times) previous topic - next topic

Udo Klein

No, it depends on the question how you want to support it. You will have to package the HEX file. This is something that can be done with the normal IDE.

Then you have to provide plattform specific code that will be able to push the HEX into the Arduino. The question is here how much installation you want to burden on the end user. Ideally I think it should be no installation at all. Now you need something that abstracts you somehow from the specific platform and allows you to push the HEX file into the arduino.

If you could assume that the target has already something like Perl or Python this could be easier. Otherwise you will most probably have to go for different (C??) executables.
Check out my experiments http://blog.blinkenlight.net

Osgeld

processing, which the ide is written on, will spit out exe's for most platforms, but that doesnt solve the "how to get the hex file uploaded"

Udo Klein

But processing will spit out executables for the platform it is running on. He needs an uploader for each platform.

The upload itself should not be that hard. In the end it is a serial protocoll.
Check out my experiments http://blog.blinkenlight.net

stevecooley

Processing will spit out executables for Mac, Windows, and Linux... at least, that's what it does on the mac. I don't know what it does on the other platforms, but the mac version of the IDE spits out three executables.

Udo Klein

So obviously I lack some knowledge about processing. How come  that it can spit out executables for 3 platforms that can run on three platforms without installation? Or are these executables that require processing to be already installed?
Check out my experiments http://blog.blinkenlight.net

stevecooley

Nope, processing need not be installed to run their executables.  It's pretty cool. :)  Now, my ignorance on how the arduino IDE does it's thing will shine clearly through if it hasn't yet, but my best guess is that in order to do something similar for code uploading from an executable is that the IDE would need to essentially contain the avr dude stuff for all three platforms in order to be able to package that up if exporting a sketch to an executable uploader.  So that would increase the size of the IDE download.  

Udo Klein

Correct, the IDE uses avrdude. At least it does so on my linux installation. But it would not really need avrdude for talking to the bootloader.

I just had a quick glance at the adafruit bootloader http://www.wulfden.org/TheShoppe/freeduino/ADABOOT.shtml (because google brought it up as the first hit for me).

--> It is pretty straightforward serial communication. So the program would work like this:

1) Pulse DTR to start the bootloader
2) provide the initialization
3) push the hex into the arduino

You may wonder why avrdude is needed at all? Most probably to support different programmers but definitely not for this.
Check out my experiments http://blog.blinkenlight.net

wesen

Hi people, I've been working with a modified version of Arduino for my MIDI development, and my friend Christian wrote this application called the Patch Manager which is a kind of "app store" for our firmwares.
It works really nicely. There is also a compile option for this to produce a small java executable for osx, windows and linux that accepts a hex file and uploads it to the device.

wesen

and now that i can post links:

Here is a small video to show how it works:

http://ruinwesen.com/blog?id=995

and here is a screenshot:

http://bl0rg.net/~manuel/patch-manager.png

It's opensource and available at http://github.com/wesen/mididuino/ , it may require a bit of substantial modifications to work with other stuff, but it's maybe interesting to you as an idea.


wortelsoft

#24
Jan 21, 2010, 02:08 pm Last Edit: Jan 21, 2010, 02:10 pm by wortelsoft Reason: 1
In the applet folder which is in the folder where your project is stored there is a .hex file which is the compiled version of your programm.
This send to the arduino by avrdude.

See:

http://arduino.cc/en/Hacking/BuildProcess

so basicly you need to make/do the following (just how i would do it):

1 Create a program which checks availlable com ports.
2 send a special command through each com port and check if it gets the right answer from the arduino (this have to be programmed in the arduino)
3 start avrdude with the right command string to upload the hex file to the right comport (or even just let the program send the hex file)

Done

Step 2 might not be necesary you could also just let avrdude upload the file to every availlable comport.

edit:
Udo allready did write this before

stevecooley

This is from the avrdude documentation:

Quote

2.3 Example Command Line Invocations
Download the file diag.hex to the ATmega128 chip using the STK500 programmer connected to the default serial port:

Code: [Select]
% avrdude -p m128 -c stk500 -e -U flash:w:diag.hex

avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.03s
avrdude: Device signature = 0x1e9702
avrdude: erasing chip avrdude: done.
avrdude: performing op: 1, flash, 0, diag.hex
avrdude: reading input file "diag.hex"
avrdude: input file diag.hex auto detected as Intel Hex
avrdude: writing flash (19278 bytes):
Writing | ################################################## | 100% 7.60s
avrdude: 19456 bytes of flash written
avrdude: verifying flash memory against diag.hex:
avrdude: load data flash data from input file diag.hex:
avrdude: input file diag.hex auto detected as Intel Hex
avrdude: input file diag.hex contains 19278 bytes
avrdude: reading on-chip flash data:
Reading | ################################################## | 100% 6.83s
avrdude: verifying ...
avrdude: 19278 bytes of flash verified
avrdude: safemode: Fuses OK
avrdude done. Thank you.




So this means that I would need to package up the avrdude binary along with a script for each platform I'd want to have an executable for, right? I'm just trying to get my head around how I would do this.  seems like you guys are saying I need:

* avrdude binary
* my hex file
* some kind of script to call avrdude with the right parameters to send the hex file to, it looks like, the default serial port or some variation on that depending on how you would generate a list of available serial devices.

I wonder if I could build any of this in processing to get me part of the way to having an executable for each platform.

wortelsoft

You could look at how the arduino IDE does that part. But I think it could be easier to make a script / programm for each platform as the serial communication is platform dependent and you don't have much more to do with the script / programm.

Udo Klein

#27
Jan 22, 2010, 05:15 pm Last Edit: Jan 22, 2010, 05:16 pm by udoklein Reason: 1
Do you know this:
http://github.com/George1024/Arduino-Copier
http://github.com/George1024/Arduino-Copier/blob/97dbc28583d27c0b4f8616599954cdd84a15f5a8/BlinkVirus/Copier.pde

Obviously it contains code for flashing Arduinos. This could serve as a starting point for an uploader that has a smaller footprint than AVRDUDE.

Cheers, Udo
Check out my experiments http://blog.blinkenlight.net

audioguytodd

Quote
welllll, since you asked: http://beatseqr.com/blog/


Very nice!! I am impressed!!! ;D


stevecooley

Hey, isn't there a way to get the IDE to do this without having to include the source?  Like under the file menu, a new option to upload a precompiled hex file.  I don't think asking my users to download the IDE would be too much to ask, but asking them to download the IDE and the libraries I'm using, and setting it all up the way I have it... that's probably too far.  However, a precompiled hex file would be easy to distribute, and I think if this feature were added, easy for my users of various technical proficiency would be able to handle.

Go Up