Pages: [1]   Go Down
Author Topic: Programing arduino by command line (windows)  (Read 2103 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Full Member
***
Karma: 1
Posts: 104
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi.

I guess it has to be possible and I want to try it. Can I upload code to arduino using cmd windows console? I read about winavr but I don't know how it works.

Do you know a webpage with a good tutorial or reference to check?
Logged

Denmark
Offline Offline
Edison Member
*
Karma: 36
Posts: 1084
Happy Hobbyist
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

This command line will upload the blink328.hex to the Arduino

avrdude -patmega328p -Pcom20 -carduino -D -U flash:w:blink328.hex:i

There is a avrdude guide here:

http://www.ladyada.net/learn/avr/avrdude.html
Logged

Offline Offline
Full Member
***
Karma: 1
Posts: 104
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi. Thanks for answering me.

I am trying using that tutorial but I am not able to do it. I have a ftdi board and arduino FIO.

I tried some examples in that page but anyone works, finally, I am trying with this line:

avrdude -c avrispmkII -b 9600 -P  COM10 -p atmega328p -U flash:w:Blink.cpp.hex:i

I tried with some others compilers but noone works and Arduino IDE has selected avrispmkII and it can upload code.

I have Blinck.cpp.hex in directory  in which I am running this command. I have no Blink.hex file, just with cpp.hex...

Rx led on ftdi board switches on and never gets off. Tx led never gets on.


Nothing appears on screen after I execute that line.
Logged

Denmark
Offline Offline
Edison Member
*
Karma: 36
Posts: 1084
Happy Hobbyist
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

If you enable verbose output in the Arduino IDE (file->preferences->show verbose output during output)
You can see which parameters Arduino use:

Code:
D:\arduino-1.01\arduino-1.0.1-windows (1)\arduino-1.0.1\hardware/tools/avr/bin/avrdude -CD:\arduino-1.01\arduino-1.0.1-windows (1)\arduino-1.0.1\hardware/tools/avr/etc/avrdude.conf -v -v -v -v -patmega328p -carduino -P\\.\COM20 -b115200 -D -Uflash:w:C:\Users\EC\AppData\Local\Temp\build3006186476715730111.tmp\Blink.cpp.hex:i



In my example i had just renamed the Blink.cpp.hex.

Also note the -v options. It enables verbose output, and will show error messages etc.
« Last Edit: November 29, 2012, 01:21:09 pm by Erni » Logged

Offline Offline
Full Member
***
Karma: 1
Posts: 104
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank you Erni, I can upload code now. I am going to check how to compile before uploading it.
Logged

Denmark
Offline Offline
Edison Member
*
Karma: 36
Posts: 1084
Happy Hobbyist
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Glad you have it working Suriken
I am absolutely no expert, but for compiling, I think you should search for makefile. There has been a lot of thread about this subject.
Let us know if you succed.
Logged

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

Check this out too:
https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5-from-command-line
Logged

Pages: [1]   Go Up
Jump to: