Pages: [1]   Go Down
Author Topic: using arduino from command line  (Read 1472 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 9
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

What are the commands used by the JAVA IDE to compile & upload to the board?

I'd like to write a few scripts for minimalist systems w/out java.

How to compile the code?

How to upload it to the board?

Maybe a serial debugger?

Thanks.
Logged

Forum Administrator
Cambridge, MA
Offline Offline
Faraday Member
*****
Karma: 9
Posts: 3538
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm working on gathering a Makefile and instructions for doing this, but for the moment here are some of the commands.  

Arduino compiles your programs in /tmp when verifying:


tools/avr/bin/avr-gcc -c -g -Os -I/Users/dmellis/Source/arduino/trunk/build/macosx/build/work/lib/targets/arduino -w -mmcu=atmega8 -DF_CPU=16000000L /Users/dmellis/Source/arduino/trunk/build/macosx/build/work/lib/targets/arduino/buffer.c -o/tmp/build19841.tmp/buffer.c.o
tools/avr/bin/avr-gcc -c -g -Os -I/Users/dmellis/Source/arduino/trunk/build/macosx/build/work/lib/targets/arduino -w -mmcu=atmega8 -DF_CPU=16000000L /Users/dmellis/Source/arduino/trunk/build/macosx/build/work/lib/targets/arduino/pins_arduino.c -o/tmp/build19841.tmp/pins_arduino.c.o
tools/avr/bin/avr-gcc -c -g -Os -I/Users/dmellis/Source/arduino/trunk/build/macosx/build/work/lib/targets/arduino -w -mmcu=atmega8 -DF_CPU=16000000L /Users/dmellis/Source/arduino/trunk/build/macosx/build/work/lib/targets/arduino/Serial.c -o/tmp/build19841.tmp/Serial.c.o
tools/avr/bin/avr-gcc -c -g -Os -I/Users/dmellis/Source/arduino/trunk/build/macosx/build/work/lib/targets/arduino -w -mmcu=atmega8 -DF_CPU=16000000L /Users/dmellis/Source/arduino/trunk/build/macosx/build/work/lib/targets/arduino/uart.c -o/tmp/build19841.tmp/uart.c.o
tools/avr/bin/avr-gcc -c -g -Os -I/Users/dmellis/Source/arduino/trunk/build/macosx/build/work/lib/targets/arduino -w -mmcu=atmega8 -DF_CPU=16000000L /Users/dmellis/Source/arduino/trunk/build/macosx/build/work/lib/targets/arduino/wiring.c -o/tmp/build19841.tmp/wiring.c.o
tools/avr/bin/avr-g++ -c -g -Os -I/Users/dmellis/Source/arduino/trunk/build/macosx/build/work/lib/targets/arduino -w -fno-exceptions -mmcu=atmega8 -DF_CPU=16000000L /tmp/build19841.tmp/Temporary_2725_4125.cpp -o/tmp/build19841.tmp/Temporary_2725_4125.cpp.o
tools/avr/bin/avr-g++ -c -g -Os -I/Users/dmellis/Source/arduino/trunk/build/macosx/build/work/lib/targets/arduino -w -fno-exceptions -mmcu=atmega8 -DF_CPU=16000000L /Users/dmellis/Source/arduino/trunk/build/macosx/build/work/lib/targets/arduino/HardwareSerial.cpp -o/tmp/build19841.tmp/HardwareSerial.cpp.o
tools/avr/bin/avr-g++ -c -g -Os -I/Users/dmellis/Source/arduino/trunk/build/macosx/build/work/lib/targets/arduino -w -fno-exceptions -mmcu=atmega8 -DF_CPU=16000000L /Users/dmellis/Source/arduino/trunk/build/macosx/build/work/lib/targets/arduino/WRandom.cpp -o/tmp/build19841.tmp/WRandom.cpp.o
tools/avr/bin/avr-gcc -Os -Wl,-u,vfprintf -lprintf_flt -lm,-Map=/Users/dmellis/Source/arduino/trunk/build/macosx/build/work//tmp/build19841.tmp/foobar.map,--cref -mmcu=atmega8 -o /tmp/build19841.tmp/foobar.elf /tmp/build19841.tmp/buffer.c.o /tmp/build19841.tmp/pins_arduino.c.o /tmp/build19841.tmp/Serial.c.o /tmp/build19841.tmp/uart.c.o /tmp/build19841.tmp/wiring.c.o /tmp/build19841.tmp/Temporary_2725_4125.cpp.o /tmp/build19841.tmp/HardwareSerial.cpp.o /tmp/build19841.tmp/WRandom.cpp.o
tools/avr/bin/avr-objcopy -O srec -R .eeprom /tmp/build19841.tmp/foobar.elf /tmp/build19841.tmp/foobar.rom
tools/avr/bin/avr-objcopy -O ihex -R .flash /tmp/build19841.tmp/foobar.elf /tmp/build19841.tmp/foobar.hex


You should replace /Users/dmellis/Source/arduino/trunk/build/macosx/build/work with your Arduino directory (e.g. /Applications/arduino-0004 or /usr/local/arduino).  
Logged

Forum Administrator
Cambridge, MA
Offline Offline
Faraday Member
*****
Karma: 9
Posts: 3538
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Arduino builds your sketch in its applet directory when uploading:


tools/avr/bin/avr-gcc -c -g -Os -I/Users/dmellis/Source/arduino/trunk/build/macosx/build/work/lib/targets/arduino -w -mmcu=atmega8 -DF_CPU=16000000L /Users/dmellis/Source/arduino/trunk/build/macosx/build/work/lib/targets/arduino/buffer.c -o/Users/dmellis/Documents/Arduino/foobar/applet/buffer.c.o
tools/avr/bin/avr-gcc -c -g -Os -I/Users/dmellis/Source/arduino/trunk/build/macosx/build/work/lib/targets/arduino -w -mmcu=atmega8 -DF_CPU=16000000L /Users/dmellis/Source/arduino/trunk/build/macosx/build/work/lib/targets/arduino/pins_arduino.c -o/Users/dmellis/Documents/Arduino/foobar/applet/pins_arduino.c.o
tools/avr/bin/avr-gcc -c -g -Os -I/Users/dmellis/Source/arduino/trunk/build/macosx/build/work/lib/targets/arduino -w -mmcu=atmega8 -DF_CPU=16000000L /Users/dmellis/Source/arduino/trunk/build/macosx/build/work/lib/targets/arduino/Serial.c -o/Users/dmellis/Documents/Arduino/foobar/applet/Serial.c.o
tools/avr/bin/avr-gcc -c -g -Os -I/Users/dmellis/Source/arduino/trunk/build/macosx/build/work/lib/targets/arduino -w -mmcu=atmega8 -DF_CPU=16000000L /Users/dmellis/Source/arduino/trunk/build/macosx/build/work/lib/targets/arduino/uart.c -o/Users/dmellis/Documents/Arduino/foobar/applet/uart.c.o
tools/avr/bin/avr-gcc -c -g -Os -I/Users/dmellis/Source/arduino/trunk/build/macosx/build/work/lib/targets/arduino -w -mmcu=atmega8 -DF_CPU=16000000L /Users/dmellis/Source/arduino/trunk/build/macosx/build/work/lib/targets/arduino/wiring.c -o/Users/dmellis/Documents/Arduino/foobar/applet/wiring.c.o
tools/avr/bin/avr-g++ -c -g -Os -I/Users/dmellis/Source/arduino/trunk/build/macosx/build/work/lib/targets/arduino -w -fno-exceptions -mmcu=atmega8 -DF_CPU=16000000L /Users/dmellis/Documents/Arduino/foobar/applet/foobar.cpp -o/Users/dmellis/Documents/Arduino/foobar/applet/foobar.cpp.o
tools/avr/bin/avr-g++ -c -g -Os -I/Users/dmellis/Source/arduino/trunk/build/macosx/build/work/lib/targets/arduino -w -fno-exceptions -mmcu=atmega8 -DF_CPU=16000000L /Users/dmellis/Source/arduino/trunk/build/macosx/build/work/lib/targets/arduino/HardwareSerial.cpp -o/Users/dmellis/Documents/Arduino/foobar/applet/HardwareSerial.cpp.o
tools/avr/bin/avr-g++ -c -g -Os -I/Users/dmellis/Source/arduino/trunk/build/macosx/build/work/lib/targets/arduino -w -fno-exceptions -mmcu=atmega8 -DF_CPU=16000000L /Users/dmellis/Source/arduino/trunk/build/macosx/build/work/lib/targets/arduino/WRandom.cpp -o/Users/dmellis/Documents/Arduino/foobar/applet/WRandom.cpp.o
tools/avr/bin/avr-gcc -Os -Wl,-u,vfprintf -lprintf_flt -lm,-Map=/Users/dmellis/Source/arduino/trunk/build/macosx/build/work//Users/dmellis/Documents/Arduino/foobar/applet/foobar.map,--cref -mmcu=atmega8 -o /Users/dmellis/Documents/Arduino/foobar/applet/foobar.elf /Users/dmellis/Documents/Arduino/foobar/applet/buffer.c.o /Users/dmellis/Documents/Arduino/foobar/applet/pins_arduino.c.o /Users/dmellis/Documents/Arduino/foobar/applet/Serial.c.o /Users/dmellis/Documents/Arduino/foobar/applet/uart.c.o /Users/dmellis/Documents/Arduino/foobar/applet/wiring.c.o /Users/dmellis/Documents/Arduino/foobar/applet/foobar.cpp.o /Users/dmellis/Documents/Arduino/foobar/applet/HardwareSerial.cpp.o /Users/dmellis/Documents/Arduino/foobar/applet/WRandom.cpp.o
tools/avr/bin/avr-objcopy -O srec -R .eeprom /Users/dmellis/Documents/Arduino/foobar/applet/foobar.elf /Users/dmellis/Documents/Arduino/foobar/applet/foobar.rom
tools/avr/bin/avr-objcopy -O ihex -R .flash /Users/dmellis/Documents/Arduino/foobar/applet/foobar.elf /Users/dmellis/Documents/Arduino/foobar/applet/foobar.hex
Logged

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

Any chance how to manage this from Xcode ?
Meaning, writing the C code, debug it and then upload it to the Arduino's flash ?
It seems bTop product does that.
Logged

Pages: [1]   Go Up
Jump to: