Arduino IDE / Eclipse ARM, AVR ― 2017年01月09日
Eclipse AVR で Arduino の環境を設定したときに生じた問題 (warning の解決) を記録に残すことにした。
去年の年末、HDD の換装と OS (Linux) のアップグレードを行った。
HDD で retry エラーが頻発していたためで、SDD に換装し、Linux Mint 18.1 をインストールした。
データのみバックアップしたので、ツール類 (Arduino, Eclipse) は、最初から設定することになった。
o Arduino IDE
バージョンが 1.8.0 になったが、インストールには問題がない。
Preferences で Duemilanove 1284p の設定ファイル (package_atmega1284p-1.0.0_index.json) を指定し、Boards Manager から Duemilanove 1284p を選択すれば、Duemilanove 1284p が使えるようになる。
o Eclipse + ARM plugin
前回 (2015/08/02 STM32 Nucleo STM32F072) 同様の手順 (GNU ARM Eclipse (http://gnuarmeclipse.livius.net/blog/)) の通りで、特に問題なくインストール/設定ができた。
o Eclipse + AVR plugin
これまでとは異なり、
https://www.codeproject.com/Articles/1003347/Creating-Arduino-programs-in-Eclipse
の手順にしたがってインストールした。
これで一応動作するのだが、Warning が消えない。
ignoring old commands for target `arduino/wiring_pulse.o' subdir.mk /Blink/Release/arduino line 251 C/C++ Problem
overriding commands for target `arduino/wiring_pulse.o' subdir.mk /Blink/Release/arduino line 258 C/C++ Problem
調べてみると、Build Project で自動生成される arduino/subdir.mk (Makefile) の中に target の arduino/wiring_pulse.o が 2 つあることがわかる。
wiring_pulse.S と wiring_pulse.c が同じ wiring_pulse.o を生成するような記述になっているのだ。
このままでは、後から記述された wiring_pulse.c だけが使用されて wiring_pulse.S は使用されない。
wiring_pulse.c で定義される関数 pulseIn() を使わなければ、エラーにはならないし、動作もするだろう。
しかし、それでは、pulseIn() を使いたくなったときに困ることになる。
Arduino IDE の場合は、どうなっているのだろう。
コンパイル・ログを調べると、Compiling core... の部分で、
wiring_pulse.S と wiring_pulse.c は、それぞれ wiring_pulse.S.o, wiring_pulse.c.o を生成するよになっていて、上記のような warning は発生しない。
"~/arduino-1.8.0/hardware/tools/avr/bin/avr-gcc" -c -g -x assembler-with-cpp -mmcu=atmega1284p -DF_CPU=16000000L -DARDUINO=10800 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-I~/arduino-1.8.0/hardware/arduino/avr/cores/arduino" "-I~/.arduino15/packages/Arduino AVR Board/hardware/avr/1.0.0/variants/standard" "~/arduino-1.8.0/hardware/arduino/avr/cores/arduino/wiring_pulse.S" -o "/tmp/arduino_build_106259/core/wiring_pulse.S.o"
"~/arduino-1.8.0/hardware/tools/avr/bin/avr-gcc" -c -g -Os -w -ffunction-sections -fdata-sections -MMD -mmcu=atmega1284p -DF_CPU=16000000L -DARDUINO=10800 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-I~/arduino-1.8.0/hardware/arduino/avr/cores/arduino" "-I~/.arduino15/packages/Arduino AVR Board/hardware/avr/1.0.0/variants/standard" "~/arduino-1.8.0/hardware/arduino/avr/cores/arduino/wiring.c" -o "/tmp/arduino_build_106259/core/wiring.c.o"
Arduino IDE は、独立したツール (環境) なので、Eclipse AVR のような別の環境に組み込まれて使われることは想定していないし、一方の Eclipce AVR は Arduino IDE のように独立した環境の一部を参照するような使い方は想定されていないだろう。
Arduino IDE と Eclipse AVR の両方を使いたいので、これらツール自体に変更を加えることはできない。
そこで、wiring_pulse.S を wiring_pulse_S.S などとリネームして回避することにする。
Arduino IDE では wiring_pulse_S.S.o が生成され、Eclipse AVR では wiring_pulse_S.o が生成されるので、いずれの環境でもエラーは発生しない。
今後は、Arduino IDE がアップグレードされるたびに wiring_pulse.S のリネームが必要になるが、Eclipse で Arduino の開発が行えるというメリットは大きい。
コメント
トラックバック
このエントリのトラックバックURL: http://walkingmix.asablo.jp/blog/2017/01/09/8311965/tb
※なお、送られたトラックバックはブログの管理者が確認するまで公開されません。
コメントをどうぞ
※メールアドレスとURLの入力は必須ではありません。 入力されたメールアドレスは記事に反映されず、ブログの管理者のみが参照できます。
※なお、送られたコメントはブログの管理者が確認するまで公開されません。