Arduino cheat sheet

From misc notes
Jump to navigation Jump to search

Arduino + cygwin + ino (ano) ハマりどころメモ

without Arduino IDE

arduino を cygwin 環境で commandline で build, upload までしたい。

  • arduino.cc の情報
Arduino from the Command Line

によると

Arturo

Arturo a.k.a ano というのがある。(Webでは ino というのがみつかるがメンテされてないので ino のメンテナンス引き継ぎ版が ano のようだ)

  • cygwin 準備

先ほど arduino.cc の記述によると ano は arduino IDE versions 1.6.1 は動くとのこと。

Arduino 1.6.x, 1.5.x BETA
arduino-1.6.1-windows.exe

をとってきてインストールする。

Windows 版の IDE は最新をつかいたいので、version 1.6.1 は /Program Files/Arduino を /cygwin/usr/share 配下に移動させる。
名前は Arduino から arduino に変える。(たんなる趣味)
Windows の権限管理の問題があるので arduino フォルダーのプロパティを開き、セキュリティ タブで *イケイケ* にしておく。


  • cygwin 特有の問題
toolchain-avr を cygwin で compile
The AVR toolchain used by the Arduino IDE

1.6.1 用は release 3.4.5

git clone -b 3.4.5 https://github.com/arduino/toolchain-avr.git
  • toolchain-avr ハマりどころ

cygwin 32bit 版つかうこと (64bit 版は hack は困難。32bit 版でおとなしく作ること)

    git
    wget
    unzip
    zip
    gperf
    bison
    flex
    make
    patch
    *** automake
    autoconf
    gcc-g++
    *** texinfo (must be at version 4.13 since 5+ won't work)
    libncurses-devel
    python-setuptools

Readme.md にあるように texinfo の指定バージョン 4.13 は cygwin にないので、自分でコンパイル。 ついでに automake-1.11.1 texinfo-4.13 は cygwin のパッケージつかわないで自分でコンパイルする。

arch.win32.build.bash はつかわない。なので MinGW 環境は不要。

wget してるソースが取れない場合があると build がコケるので事前にとっておく。

wget http://distribute.atmel.no/tools/opensource/Atmel-AVR-GNU-Toolchain/3.4.5/avr8-headers-6.2.0.469.zip
wget http://download.savannah.gnu.org/releases/avr-libc/avr-libc-1.8.0.tar.bz2
wget http://download.savannah.gnu.org/releases/avrdude/avrdude-6.0.1.tar.gz
wget http://mirror.switch.ch/ftp/mirror/gnu/autoconf/autoconf-2.64.tar.bz2
wget http://mirror.switch.ch/ftp/mirror/gnu/automake/automake-1.11.1.tar.bz2
wget http://mirror.switch.ch/ftp/mirror/gnu/binutils/binutils-2.24.tar.bz2
wget http://mirror.switch.ch/ftp/mirror/gnu/gcc/gcc-4.8.1/gcc-4.8.1.tar.bz2
wget http://mirror.switch.ch/ftp/mirror/gnu/gdb/gdb-7.8.tar.xz
wget http://mirror.switch.ch/ftp/mirror/gnu/gmp/gmp-5.0.2.tar.bz2
wget http://mirror.switch.ch/ftp/mirror/gnu/mpfr/mpfr-3.0.0.tar.bz2
wget http://switch.dl.sourceforge.net/project/libusb-win32/libusb-win32-releases/1.2.6.0/libusb-win32-bin-1.2.6.0.zip
wget http://switch.dl.sourceforge.net/project/libusb/libusb-1.0/libusb-1.0.18/libusb-1.0.18.tar.bz2
wget http://switch.dl.sourceforge.net/project/libusb/libusb-compat-0.1/libusb-compat-0.1.5/libusb-compat-0.1.5.tar.bz2
wget http://www.multiprecision.org/mpc/download/mpc-0.9.tar.gz
bash build.all.bash

数時間コンパイルにかかる。

メモ検証: -P '\\.\com5'

  • arduino usb serial の windows OS での初期化。

arduino の usb を刺しただけでは OS から serial device (COM5) としてみえてなので、windows OS で認識させる。

シリアルポートの使い方@windows
#!/bin/sh
mode.com $1: BAUD=115200 PARITY=N DATA=8 STOP=1 to=off xon=off odsr=off octs=on dtr=off rts=on idsr=off

このスクリプト動かす。

  • 配置
Configuring Eclipse to point to the IDE location

をヒントに...


  • ano の環境

/etc/ano.ini or ~/.anorc

[build]
board-model = uno
cpu = 8MHzatmega328p
arduino-dist = /usr/share/arduino

[upload]
board-model = uno
cpu = 8MHzatmega328p
arduino-dist = /usr/share/arduino
serial-port = /dev/ttyS4

[serial]
serial-port = /dev/ttyS4