LoginSignup
4
3

More than 3 years have passed since last update.

WSL上へのh8300クロスコンパイル環境構築

Last updated at Posted at 2019-05-19

やりたいこと

組み込みOSの勉強のために,参考文献[1]の内容を順に進めたい.でも,windwosマシンしかないので,環境はWSLで進めました.
最終的に,無事Hello World! までできました.

手順

# buildutils のビルド
# http://core.ring.gr.jp/pub/GNU/binutils/ から最新版をダウンロード
tar xvzf builtutils-2.31.tar.gz
cd ./buildutils-2.31
./configure --target=h8300-elf --disable-nls
sudo make install

# gcc のビルド
# http://core.ring.gr.jp/pub/GNU/gcc/ から最新版をダウンロード
tar xvzf gcc-8.2.0
sudo apt install libgmp-dev
sudo apt install libmpc-dev
sudo apt install libmpfr-dev
./configure --target=h8300-elf --disable-nls --disable-threads --disable-shared --enable-languages=c
make all-gcc
sudo make install-gcc

# k8write のビルドは文献[1]通りでOK.
cd {kzload.mot のパス}
{h8writeのパス}/h8write -3069 -f20 kzload.mot /dev/ttyS{シリアルポート番号}

躓いたポイント

cc の configure エラー

文献[1]の通りに進めると,gccの configure で --with-gmp, --with-mpc, --with-mpfr をつけるように言われますが,パッケージのインストールをすれば configure は無事に完了するようになりました.

gcc の make エラー

configure はクリアしたものの,そのあとの make で,libgcc.mvars が見つからないというエラーで止まります.文献[2] に従って,make の代わりに make all-gcc とすると大丈夫です. sudo make install も同様に sudo make install-gcc とします.

h8write 実行時に FATAL:Can not open the input file.

motファイルを相対パスで指定すると,なぜかこうなるらしいです.motファイルのあるパスで,k8write側をパス指定して実行すると解決しました.

h8write 実行時に FATAL:Can not to set line speed and put Query mode.

マイコンボード側が正しく書き込みモードになっていなかったようです.ACアダプタの抜き差しで直りました.

h8write 実行時に FATAL:Can not open the line to the H8/OS system.

シリアルの指定が間違っているときに,こうなりました.

参考文献

[1] 坂井弘亮, 「12ステップで作る組み込みOS自作入門」, カットシステム
[2] Linux Forums [SOLVED] gcc make error, missing 'libgcc.mvars'

4
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
3