Arduino on RPM-based linux distro

I've just received my Arduino and I'm trying to install the software on my laptop which is running Mandriva 2006. I was trying to follow the general outline in the "Arduino on Linux" topic, but I've run into a few brick walls.

I can't seem to find a way to install avr-gcc (or gcc-avr) in Mandriva. There is a package for avra, which seems to be an assembler for avr based chips, but other than compiling avr-gcc myself, I'm not sure what to do. Any ideas on this? (The same goes for avr-libc and uisp.)

For some good news, it looks like the proper kernel support is in place, because when I plug in the arduino board to the usb, I get this:

dmesg
usb 2-1: new full speed USB device using uhci_hcd and address 5
ftdi_sio 2-1:1.0: FTDI FT232BM Compatible converter detected
usb 2-1: FTDI FT232BM Compatible converter now attached to ttyUSB0

So, I'm not sure what the next step is. Any pointers?

Thanks!

That's the main problem on linux now... that every distribuition has a different set of pre-compiled components available.

I had it running on mandriva 2006 a while ago but that machine has long been reinstalled so the files are gone..:frowning:

a bad news and a good news :slight_smile:
Unfortunatly you need to recompile the avr-gcc but the good news is that guido socher has written an article about using avr chips with linux that has a step by step guide on how to compile avr-gcc, libc and uisp.
http://www.linuxfocus.org/English/November2004/article352.shtml

then you just need to put the files in the tools directory inside the arduino directory (where you have your arduino executable)
the rest of the instructions are similar.

let us know about your progress

massimo

Thanks for the pointers. I've got the IDE running. Now, trying to upload to the board I get a ton of errors, ending with the following:

./arduino/trunk/build/linux/work/lib/targets/arduino/wiring.c:393: error: REFS1' undeclared (first use in this function) ./arduino/trunk/build/linux/work/lib/targets/arduino/wiring.c:393: error: invalid lvalue in assignment ./arduino/trunk/build/linux/work/lib/targets/arduino/wiring.c:394: error: REFS0' undeclared (first use in this function)
./arduino/trunk/build/linux/work/lib/targets/arduino/wiring.c:394: error: invalid lvalue in assignment
./arduino/trunk/build/linux/work/lib/targets/arduino/wiring.c:400: error: ADCSRA' undeclared (first use in this function) ./arduino/trunk/build/linux/work/lib/targets/arduino/wiring.c:400: error: ADPS2' undeclared (first use in this function)
./arduino/trunk/build/linux/work/lib/targets/arduino/wiring.c:400: error: invalid lvalue in assignment
./arduino/trunk/build/linux/work/lib/targets/arduino/wiring.c:401: error: ADPS1' undeclared (first use in this function) ./arduino/trunk/build/linux/work/lib/targets/arduino/wiring.c:401: error: invalid lvalue in assignment ./arduino/trunk/build/linux/work/lib/targets/arduino/wiring.c:402: error: ADPS0' undeclared (first use in this function)
./arduino/trunk/build/linux/work/lib/targets/arduino/wiring.c:402: error: invalid lvalue in assignment
./arduino/trunk/build/linux/work/lib/targets/arduino/wiring.c:405: error: `ADEN' undeclared (first use in this function)
./arduino/trunk/build/linux/work/lib/targets/arduino/wiring.c:405: error: invalid lvalue in assignment
Atmel AVR ATmega8 is found.
Error: No such file or directory
Firmware Version: 1.18
Firmware Version: 1.18
-> ./arduino/trunk/build/linux/work/examples/leds/knight_rider/knight_rider_1/applet/knight_rider_1.hex

Weird. I'm guessing that your AVR include files aren't where Arduino is looking for them. Make sure that /tools/avr/avr/include has ctype.h, errno.h, etc and a subdirectory named avr/ with boot.h, crc16.h, etc. If not, make a symbolic link to wherever your AVR header files are installed.

Can you post the beginning of the long string of errors?

Your guess was right, but I made the sym-link and the problem still occurs. Here is the start of the errors:


[root@localhost linux]# ./run.sh
Devel Library

Native lib Version = RXTX-2.1-7pre17
Java lib Version = RXTX-2.1-7pre17

/home/morris/arduino/trunk/build/linux/work/lib/targets/arduino/wiring.c:25:20:
avr/io.h: No such file or directory

/home/morris/arduino/trunk/build/linux/work/lib/targets/arduino/wiring.c:26:27:
avr/interrupt.h: No such file or directory

/home/morris/arduino/trunk/build/linux/work/lib/targets/arduino/wiring.c:27:24:
avr/signal.h: No such file or directory

/home/morris/arduino/trunk/build/linux/work/lib/targets/arduino/wiring.c:28:23:
avr/delay.h: No such file or directory

/home/morris/arduino/trunk/build/linux/work/lib/targets/arduino/wiring.c:29:19:
stdio.h: No such file or directory

In file included from /home/morris/arduino/trunk/build/linux/work/lib/targets/ar
duino/wiring.c:49:

/home/morris/arduino/trunk/build/linux/work/lib/targets/arduino/wiring.h:59: err
or: syntax error before "boolean"

/home/morris/arduino/trunk/build/linux/work/lib/targets/arduino/wiring.h:60: err
or: syntax error before "byte"


Here is the how the avr libraries directories are set up:

[root@localhost include]# pwd
/home/morris/arduino/trunk/build/linux/work/tools/avr/avr/include
[root@localhost include]# ls
assert.h avr/ compat/ ctype.h errno.h inttypes.h math.h setjmp.h stdint.h stdio.h stdlib.h string.h util/
[root@localhost include]# cd avr
[root@localhost avr]# pwd
/home/morris/arduino/trunk/build/linux/work/tools/avr/avr/include/avr
[root@localhost avr]# ls
boot.h io2323.h io4434.h ioat94k.h iom1280.h iom165.h iom325.h iom6450.h iom88.h iotn13.h iotn26.h iotn861.h sfr_defs.h
crc16.h io2333.h io76c711.h iocan128.h iom1281.h iom168.h iom3290.h iom645.h iom8.h iotn15.h iotn28.h iotnx4.h signal.h
delay.h io2343.h io8515.h iocan32.h iom128.h iom169.h iom329.h iom6490.h iomx8.h iotn22.h iotn44.h iotnx5.h sleep.h
eeprom.h io43u32x.h io8534.h iocan64.h iom161.h iom16.h iom32.h iom649.h iomxx0_1.h iotn2313.h iotn45.h iotnx61.h version.h
interrupt.h io43u35x.h io8535.h iocanxx.h iom162.h iom323.h iom48.h iom64.h iomxx4.h iotn24.h iotn461.h parity.h wdt.h
io1200.h io4414.h io86r401.h io.h iom163.h iom324.h iom640.h iom8515.h iotn11.h iotn25.h iotn84.h pgmspace.h
io2313.h io4433.h io90pwmx.h iom103.h iom164.h iom3250.h iom644.h iom8535.h iotn12.h iotn261.h iotn85.h portpins.h

I run the "run.sh" script from /home/morris/arduino/trunk/build/linux as root to get rid of the lock file errors.

Thanks for the help. I think I'm really close now.

Okay, upon relooking at the Arduino source, I see that it doesn't specifically add that directory to the include path. Instead, avr-gcc should, by default, automatically add its include directory to the include path. This means that it needs to be installed in the location for which it was configured. Did you "make install" it? How did you build it?

If nothing works, you could, try copying the contents of your avr include/ directory (and avr/ and other subdirectories) into /lib/targets/arduino. It's nasty, but it might work.

I used 'make install' to put everything into /usr/local/avr, then made symbolic links to the /tools directory.

Your suggestion helped, now I have another error:


[root@localhost linux]# ./run.sh
Devel Library

Native lib Version = RXTX-2.1-7pre17
Java lib Version = RXTX-2.1-7pre17

/usr/local/avr/lib/gcc/avr/3.4.6/../../../../avr/bin/ld: crtm8.o: No such file:

Atmel AVR ATmega8 is found.
Error: No such file or directory
Firmware Version: 1.18
Firmware Version: 1.18
-> /home/morris/arduino/trunk/build/linux/work/examples/leds/knight_rider/knigh
[root@localhost linux]#


No matter what I try, I can't get it to see the crtm8.o file, which is in work/tools/avr/lib/avr4/

Any more ideas?

Is it also in /usr/local/avr/lib/avr4? The avr-gcc toolchain is going to be looking for things in /usr/local/avr. How are your symlinks set up? You might try simply linking work/tools/avr straight to /usr/local/avr.

I tried resetting the symlinks, still no go. This is how it is set up:


[root@localhost tools]# pwd
/home/morris/arduino/trunk/build/linux/work/tools
[root@localhost tools]# ls -l
total 0
lrwxrwxrwx 1 root root 15 Mar 20 20:41 avr -> /usr/local/avr//


I'm not sure what to try. I did some googling for crtm8.o and didn't come up with much. I guess it is a avr-libc problem and not really specific to arduino, though. I don't suppose the version of avr-gcc (3.4.6) that I built makes a difference, would it?

It might. We're using avr-gcc 4.0.2. It's possible that somewhere, something expects version 4, though I'm not sure what, since your whole installation is version 3. What version of avr libc are you using? What version of avr binutils?

avr-libc-1.4.3, binutils-2.16.1 and gcc-3.4.6. I will try gcc-4 and see if it helps.

Okay, recompiled avr-gcc using gcc-4.0.3, same results:


[root@localhost linux]# ./run.sh
Devel Library

Native lib Version = RXTX-2.1-7pre17
Java lib Version = RXTX-2.1-7pre17

/usr/local/avr/lib/gcc/avr/4.0.3/../../../../avr/bin/ld: crtm8.o: No such file: No such file or directory

Atmel AVR ATmega8 is found.
Error: No such file or directory
Firmware Version: 1.18
Firmware Version: 1.18
-> /home/morris/arduino/trunk/build/linux/work/examples/leds/knight_rider/knight_rider_1/applet/knight_rider_1.hex


I may try reinstalling avr-libc, but I'm not sure what to do differently.

New errors:


/home/morris/arduino/trunk/build/linux/work/lib/targets/arduino/crtm8.o: In function `__vector_default':

: multiple definition of `__vectors'

/usr/local/avr/lib/gcc/avr/4.0.3/../../../../avr/lib/avr4/crtm8.o:../../../../crt1/gcrt1.S:123: first defined here

/home/morris/arduino/trunk/build/linux/work/lib/targets/arduino/crtm8.o: In function `__vector_18':

: multiple definition of `__bad_interrupt'

/usr/local/avr/lib/gcc/avr/4.0.3/../../../../avr/lib/avr4/crtm8.o:../../../../crt1/gcrt1.S:123: first defined here

/home/morris/arduino/trunk/build/linux/work/examples/leds/knight_rider/knight_rider_1/applet/timer.c.o: In function `delay_us':

/home/morris/arduino/trunk/build/linux/work/lib/targets/arduino/timer.c:56: undefined reference to `__udivmodhi4'

/home/morris/arduino/trunk/build/linux/work/examples/leds/knight_rider/knight_rider_1/applet/timer.c.o: In function `timerPause':

/home/morris/arduino/trunk/build/linux/work/lib/targets/arduino/timer.c:220: undefined reference to `__divmodsi4'

/home/morris/arduino/trunk/build/linux/work/lib/targets/arduino/timer.c:225: undefined reference to `__mulsi3'

/home/morris/arduino/trunk/build/linux/work/lib/targets/arduino/timer.c:225: undefined reference to `__udivmodsi4'

/home/morris/arduino/trunk/build/linux/work/lib/targets/arduino/timer.c:227: undefined reference to `__udivmodsi4'

/home/morris/arduino/trunk/build/linux/work/lib/targets/arduino/timer.c:227: undefined reference to `__mulsi3'

/home/morris/arduino/trunk/build/linux/work/examples/leds/knight_rider/knight_rider_1/applet/wiring.c.o: In function `printIntegerInBase':

/home/morris/arduino/trunk/build/linux/work/lib/targets/arduino/wiring.c:267: undefined reference to `__udivmodsi4'

/home/morris/arduino/trunk/build/linux/work/lib/targets/arduino/wiring.c:268: undefined reference to `__udivmodsi4'

/home/morris/arduino/trunk/build/linux/work/examples/leds/knight_rider/knight_rider_1/applet/wiring.c.o: In function `millis':

/home/morris/arduino/trunk/build/linux/work/lib/targets/arduino/wiring.c:324: undefined reference to `__mulsi3'

/home/morris/arduino/trunk/build/linux/work/lib/targets/arduino/wiring.c:324: undefined reference to `__udivmodsi4'

/home/morris/arduino/trunk/build/linux/work/examples/leds/knight_rider/knight_rider_1/applet/buffer.c.o: In function `bufferGetFromFront':

/home/morris/arduino/trunk/build/linux/work/lib/targets/arduino/buffer.c:48: undefined reference to `__udivmodhi4'

/home/morris/arduino/trunk/build/linux/work/examples/leds/knight_rider/knight_rider_1/applet/buffer.c.o: In function `bufferDumpFromFront':

/home/morris/arduino/trunk/build/linux/work/lib/targets/arduino/buffer.c:66: undefined reference to `__udivmodhi4'

/home/morris/arduino/trunk/build/linux/work/examples/leds/knight_rider/knight_rider_1/applet/buffer.c.o: In function `bufferGetAtIndex':

/home/morris/arduino/trunk/build/linux/work/lib/targets/arduino/buffer.c:78: undefined reference to `__udivmodhi4'

/home/morris/arduino/trunk/build/linux/work/examples/leds/knight_rider/knight_rider_1/applet/buffer.c.o: In function `bufferAddToEnd':

/home/morris/arduino/trunk/build/linux/work/lib/targets/arduino/buffer.c:89: undefined reference to `__udivmodhi4'

/home/morris/arduino/trunk/build/linux/work/examples/leds/knight_rider/knight_rider_1/applet/uart.c.o: In function `uartSetBaudRate':

/home/morris/arduino/trunk/build/linux/work/lib/targets/arduino/uart.c:93: undefined reference to `__udivmodsi4'

Atmel AVR ATmega8 is found.
Error: No such file or directory
Firmware Version: 1.18
Firmware Version: 1.18
-> /home/morris/arduino/trunk/build/linux/work/examples/leds/knight_rider/knight_rider_1/applet/knight_rider_1.hex