= OS Xでの環境構築方法 = == 前提となる環境 == 予め以下のソフトウェアがインストールされているものとします。 * Mac OS X 10.8 * Xcode(App Storeからインストール) * macport == cfgのインストール == * boostライブラリのインストール {{{ $ port install boost }}} * cfgのconfigure & make {{{ $ ./configure --with-headers=/opt/local/include --with-libraries=/opt/local/lib --without-xml $ make depend; make }}} == mkimageのインストール == * u-bootのソースを取得し,toolsディレクトリ内でビルド(動作確認したバージョンは,u-boot-1.1.6) * 参考:http://mwlab.net/2011/07/kurobox-make-mkimage.html * makeではうまくいかないので、下記のmakeログだけを真似て実行する {{{ $ cd u-boot-1.1.6/tools $ ln -s ../common/environment.c environment.c $ ln -s ../lib_generic/crc32.c crc32.c $ gcc -g -Wall -pedantic -idirafter ../include -DTEXT_BASE= -DUSE_HOSTCC -O -c mkimage.c $ gcc -g -Wall -pedantic -idirafter ../include -DTEXT_BASE= -DUSE_HOSTCC -O -c crc32.c $ gcc -Wall -pedantic -idirafter ../include -DTEXT_BASE= -DUSE_HOSTCC -O  -o mkimage mkimage.o crc32.o $ strip mkimage  }}} * makeしたmkimageをパスの通ったディレクトリに置く {{{ cp mkimage /usr/local/bin/ }}} == GNUツールチェーンのインストール == * 下記はビルドに成功した一例であり,このとおりに実行してビルドできることを保証するものでなく,下記以外の方法でもビルドできる可能性があります.   * ライブラリ(gmp,mpfr,mpc,iconv)を port でインストール * mentor graphicsのウェブサイトからarm-none-eabiのツールチェーンのソースコードをダウンロードし,解凍する * 「codesourcery arm gcc」などでgoogle検索 {{{ $ tar xvjf arm-2014.05-28-arm-none-eabi.src.tar.bz2 }}} * ツールチェーンのインストールディレクトリを作成し,パスを通す {{{ $ mkdir /usr/local/arm-none-eabi_140528 $ export PATH=/usr/local/arm-none-eabi_140528/bin:$PATH }}} * binutilsのmake {{{ $ cd arm-2014.05-28-arm-none-eabi $ tar xvjf binutils-2014.05-28.tar.bz2  $ cd binutils-2014.05 $ mkdir work $ cd work/ $ ../configure --prefix=/usr/local/arm-none-eabi_140528 --target=arm-none-eabi --program-prefix=arm-none-eabi- $ make $ make install }}} * gccのmake(上からの続き) {{{ $ cd ../.. $ tar xvjf gcc-2014.05-28.tar.bz2  $ tar xvjf newlib-2014.05-28.tar.bz2  $ cd gcc-4.8-2014.05/ $ mkdir work $ cd work/ $ ../configure --prefix=/usr/local/arm-none-eabi_140528 --target=arm-none-eabi --with-newlib --with-headers=../../newlib-2014.05/newlib/libc/include --with-gmp=/opt/local --with-mpfr=/opt/local --with-mpc=/opt/local --with-libiconv-prefix=/opt/local --disable-nls --disable-shared --disable-libmudflap --disable-libssp --disable-libgomp --with-gnu-as --with-gnu-ld --disable-initfini-array --disable-threads --disable-bootstrap --enable-multilib --enable-languages=c,c++ $ ln -s /path/to/newlib-2014.05/newlib/libc/include/ /usr/local/arm-none-eabi_140528/arm-none-eabi/include $ make $ make install $ rm /usr/local/arm-none-eabi_140528/arm-none-eabi/include }}} * newlibのmake(上からの続き) {{{ $ cd ../.. $ cd newlib-2014.05 $ mkdir work $ cd work/ $ ../configure --prefix=/usr/local/arm-none-eabi_140528 --target=arm-none-eabi --enable-interwork --enable-multilib $ make $ make install }}} == ev3rtの準備 == * hrp2-ev3-beta1.1.zipをダウロードして解凍 {{{ $ unzip hrp2-ev3-beta1.1.zip }}} * 同梱されているcfgを削除し,上記で作成したcfgを使うようにする {{{ $ cd hrp2-ev3-beta1.1 $ rm -rf cfg $ ln -s /path/to/cfg .(cfgの実行バイナリでなく,トップディレクトリ) }}}     つまり,hrp2-ev3-beta1.1/cfg/cfg/cfg が実行バイナリ * アプリごとのMakefile(Makefile.app)を作成 {{{ $ cd workspace $ cp common/Makefile.app helloev3/Makefile.app }}} * make {{{ $ make app=helloev3 (動的ロードモジュール版の場合は, make mod=helloev3) }}} == bluetooth接続 == * EV3でアプリの実行を開始する * Mac内蔵のbluetoothを使用し,メニューバーのbluetoothアイコンから,「Bluetoothデバイスを設定」Mindsotrms EV3 を選択 * ピンコードを入力(デフォルトは0000)し,下記コマンドによりシリアル送受信を開始 {{{ $ screen /dev/tty.MindstormsEV3-SerialPor 115200 }}} *   ※デバイス名は変わる可能性があります.