2
votes

I want to compile the sketch with the Arduino IDE but then locate the bin file and upload it using another program.

How can I design a custom uploader for Arduino (specifications, etc.)?

3
Why would you want to do that? – spring
@skinnyTOD I am developing a project in witch the arduino acts as a programmer for a device and after the program is done it has another use 2-1 – opc0de
If you use the Arduino plugin for Microsoft Visual Studio it always compiles to the same location which is easier to automate in the way you describe. The upload can also be called using a simple macro. – Visual Micro

3 Answers

2
votes

You can already do this with avrdude. If you don't absolutely need to develop another program, try using this.

If you absolutely must implement your own programmer, check out the stk500 protocol.

Sample usage:

/usr/local/bin/avrdude -V -F -C /etc/avrdude.conf -p atmega328p -P /dev/ttyACM0 
    -c stk500v1 -b 57600 -U flash:w:applet/helloworld.hex

Multiplatform tutorial:

Here's a similar program (written in c#) that relies on avrdude:

Command line example:

The following is the command that should be used for uploading a program to an Arduino Duemilanove (with an ATmega168 chip).

avrdude -c arduino -p m168 -P usb -U flash:w:FILENAME

replace FILENAME with the hex file you wish to upload to the board. This assumes that you want to write a file to the flash memory. You can of course verify or read from different portions of memory depending on your chip but I’ll leave you to figure that out from the AVRdude manual.

1
votes

You need to develop something which can speak the Arduino bootloader protocol. I suggest consulting the Arduino documentation and code available at http://arduino.cc for more information.

1
votes

See the makefile - there is a separate task for uploading the binary to Arduino. This way you will find the tool that does it and the parameters (I don't remember from the top of my head) and you will be able to do it manually (using the tool) instead from IDE. Writing a tool like that seems to be reinventing the wjeel.