Go Down

Topic: using arduino from command line (Read 2023 times) previous topic - next topic

bbogart

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.

mellis

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).  

mellis

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

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.

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy