Arduino環境構築

  • 2008年10月10日(金)

[arduino] Linux環境のインストール

Installing Arduino on Linux を参照しつつ、Linux環境のインストール。

必要portsは以下の感じ。

  • JRE (diablo-jdk-1.6.0.07.02)
  • devel/avr-gcc
  • devel/avr-libc
    • doxygen-1.5.6_1 -> dvipsk-tetex-5.95a_2(conflict ja-ptex-tetex-3.1.9_8)への依存で転ける

devel/avr-libcのために以下の設定。

  • /etc/make.conf
fuji [ /etc ] % diff -u make.conf.20081010 /etc/make.conf
--- make.conf.20081010  2008-10-10 09:29:19.000000000 +0900
+++ /etc/make.conf      2008-10-10 10:09:17.000000000 +0900
@@ -7,3 +7,6 @@
 PERL_VER=5.8.8
 PERL_VERSION=5.8.8
 OVERRIDE_LINUX_BASE_PORT=f8
+# for avr-libc / doxygen
+WITHOUT_LATEX=true
+NOPORTDOCS=true

素の状態で実行すると、以下のような感じ。

fuji [ work/arduino/arduino-0011 ] % ./arduino

Experimental:  JNI_OnLoad called.
Stable Library
=========================================
Native lib Version = RXTX-2.1-7
Java lib Version   = RXTX-2.1-7

java.io.IOException: Cannot run program "/usr/home/mutoh/work/arduino/arduino-0011/hardware/tools/avr/bin/avr-gcc": java.io.IOException: error=2, No such file or directory
        at java.lang.ProcessBuilder.start(ProcessBuilder.java:459)
        at java.lang.Runtime.exec(Runtime.java:593)
        at java.lang.Runtime.exec(Runtime.java:466)
        at processing.app.Library.build(Library.java:400)
        at processing.app.LibraryManager.buildAllUnbuilt(LibraryManager.java:228)
        at processing.app.Editor.prepareLibraries(Editor.java:384)
        at processing.app.Base.<init>(Base.java:161)
        at processing.app.Base.main(Base.java:104)
Caused by: java.io.IOException: java.io.IOException: error=2, No such file or directory
        at java.lang.UNIXProcess.<init>(UNIXProcess.java:148)
        at java.lang.ProcessImpl.start(ProcessImpl.java:65)
        at java.lang.ProcessBuilder.start(ProcessBuilder.java:452)
        ... 7 more
Unspecified platform, no launcher available.

どうも、ハードコーディングされている様子。

fuji [ work/arduino/arduino-0011 ] % egrep tools/avr/bin/ **/* 
Binary file hardware/cores/wiring/buffer.o matches
Binary file hardware/cores/wiring/twi.o matches
Binary file hardware/cores/wiring/uart.o matches
Binary file lib/pde.jar matches

[Digal]->[Blink]でテストしつつ調整。

しばらくは、一つずつプログラムへのリンクを作成。

fuji [ work/arduino/arduino-0011 ] % cd hardware/tools 
fuji [ arduino-0011/hardware/tools ] % mkdir -p avr/bin
fuji [ arduino-0011/hardware/tools ] % cd avr/bin 
fuji [ tools/avr/bin ] % ln -s /usr/local/bin/avr-gcc
fuji [ tools/avr/bin ] % ln -s /usr/local/bin/avr-g++
fuji [ tools/avr/bin ] % ln -s /usr/local/bin/avr-ar 
fuji [ tools/avr/bin ] % ln -s /usr/local/bin/avr-objcopy
fuji [ tools/avr/bin ] % ln -s /usr/local/bin/avr-size
  ...

いや、キリがない…

fuji [ tools/avr/bin ] % cd ..
fuji [ hardware/tools/avr ] % rm -rf bin 
fuji [ hardware/tools/avr ] % ln -s /usr/local/bin 

Okay.

Binary sketch size: 1096 bytes (of a 14336 byte maximum)

Uploadしたら以下のとおり。

avrdude: Yikes!  Invalid device signature.
         Double check connections and try again, or use -F to override
         this check.

hardware/tools/avrdudeは、なんだかpatchedのようだ。

fuji [ work/arduino/avrdude-5.4-arduino-src ] % ./configure
fuji [ work/arduino/avrdude-5.4-arduino-src ] % make  
fuji [ work/arduino/avrdude-5.4-arduino-src ] % pushd /usr/local/bin/
fuji [ /usr/local/bin ] % sudo mv avrdude avrdude.org

一度この状態でuploadする。 どうも、アーカイブに含まれるのではなく、arduino-0011/hardware/tools/avr/bin/avrdude(=/usr/local/bin/avrdude)を使っている様子。

java.io.IOException: Cannot run program "/usr/home/mutoh/work/arduino/arduino-0011/hardware/tools/avr/bin/avrdude": java.io.IOException: error=2, No such file or directory
	at java.lang.ProcessBuilder.start(ProcessBuilder.java:459)
	at java.lang.Runtime.exec(Runtime.java:593)
	at java.lang.Runtime.exec(Runtime.java:466)
	at processing.app.Uploader.executeUploadCommand(Uploader.java:123)
	at processing.app.AvrdudeUploader.avrdude(AvrdudeUploader.java:161)
	at processing.app.AvrdudeUploader.uploadViaBootloader(AvrdudeUploader.java:71)
	at processing.app.AvrdudeUploader.uploadUsingPreferences(AvrdudeUploader.java:43)
	at processing.app.Sketch.upload(Sketch.java:1632)
	at processing.app.Sketch.exportApplet(Sketch.java:1701)
	at processing.app.Editor$41.run(Editor.java:2004)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
Caused by: java.io.IOException: java.io.IOException: error=2, No such file or directory
	at java.lang.UNIXProcess.<init>(UNIXProcess.java:148)
	at java.lang.ProcessImpl.start(ProcessImpl.java:65)
	at java.lang.ProcessBuilder.start(ProcessBuilder.java:452)
	... 17 more
fuji [ work/arduino/avrdude-5.4-arduino-src ] % sudo cp avrdude /usr/local/bin 

う、ダメ…

avrdude: libusb access not available in this configuration
avrdude: error at hardware/tools/avrdude.conf:384: programmer type not specified
Last modified: 2009-01-25
Post-it: New Post-it (help)

Text color: [_][_][_][_]

Background: [_][_][_][_][_][_]

Draw Line:

x: y: