Go Down

Topic: Problem compiling and uploading from command line (Read 708 times) previous topic - next topic

matt1632

I'm running linux and trying to use the command line to upload arduino sketches.  I installed avr-gcc, avr-libc, binutils, binutils-avr, and avrdude from my distribution's package repository.  I downloaded the files from www.arduino.cc/en/Hacking/CommandLine and tried to compile the blink example but it doesn't work.  My terminal shows this:
Code: [Select]
x@x:~/arduino$ make
# Here is the "preprocessing".
# It creates a .cpp file based with the same name as the .pde file.
# On top of the new .cpp file comes the WProgram.h header.
# At the end there is a generic main() function attached.
# Then the .cpp file will be compiled. Errors during compile will
# refer to this new, automatically generated, file.
# Not the original .pde file you actually edit...
test -d applet || mkdir applet
echo '#include "WProgram.h"' > applet/Blink.cpp
cat Blink.pde >> applet/Blink.cpp
cat /home/x/arduino-0011/hardware/cores/arduino/main.cxx >> applet/Blink.cpp
/home/x/arduino-0011/hardware/tools/avr/bin/avr-gcc -c -mmcu=atmega168 -I. -gstabs -DF_CPU=16000000 -I/home/x/arduino-0011/hardware/cores/arduino -Os -Wall -Wstrict-prototypes -std=gnu99  /home/x/arduino-0011/hardware/cores/arduino/pins_arduino.c -o /home/x/arduino-0011/hardware/cores/arduino/pins_arduino.o
make: /home/x/arduino-0011/hardware/tools/avr/bin/avr-gcc: Command not found
make: *** [/home/x/arduino-0011/hardware/cores/arduino/pins_arduino.o] Error 127

Here's the stuff I set in the makefile:
Code: [Select]
TARGET = Blink
INSTALL_DIR = /home/x/arduino-0011
PORT = /dev/ttyUSB0
UPLOAD_RATE = 19200
AVRDUDE_PROGRAMMER = stk500v1
MCU = atmega168
F_CPU = 16000000


What could be causing this problem?  

(P.S. This uploads the same way the regular Arduino software does right? It won't overwrite the bootloader or anything?)

mellis

You'll want to change some of the variables below "Below here nothing should be changed...".  :)

AVR_TOOLS_PATH should point to /usr/bin or wherever avr-gcc, etc. are installed.  And ARDUINO should point to where the Arduino core source code is.

matt1632

Thanks, it works great now!  If anyone else is having the same problem you will also have to change AVRDUDE_FLAGS's path to avrdude.conf from $(INSTALL_DIR)/hardware/tools/avr/etc/avrdude.conf to $(INSTALL_DIR)/hardware/tools/avrdude.conf.

Go Up