Go Down

Topic: Programing arduino by command line (windows) (Read 2295 times) previous topic - next topic

Suriken

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?

Erni

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

Suriken

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.

Erni

#3
Nov 29, 2012, 07:16 pm Last Edit: Nov 29, 2012, 07:21 pm by Erni Reason: 1
If you enable verbose output in the Arduino IDE (file->preferences->show verbose output during output)
You can see which parameters Arduino use:

Code: [Select]

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.

Suriken

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

Erni

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.

cdan

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

Go Up