shのクロス開発環境を作ります。ほとんど v850と同じです
事前に必要なことは 準備編を参照してください
Binutils
% cd binutils-2.22 % mkdir -p build_sh && cd build_sh % ../configure --target=sh-linux-elf \ --prefix=/home/syohei/local/sh --disable-nls % make % make check % make install % export PATH=/home/syohei/local/sh/bin:$PATH
GCC
newlibを展開しておき、その中のディレクトリをシンボリックリンクしておきます。
% cd gcc-4.7.1 % ln -sf ../newlib-1.20.0/newlib . % ln -sf ../newlib-1.20.0/libgloss . % mkdir -p build_sh && cd build_sh % ../configure --target=sh-linux-elf --prefix=/home/syohei/local/sh \ --disable-nls --enable-languages=c --with-gmp=/home/syohei/local \ --with-mpfr=/home/syohei/local --with-mpc=/home/syohei/local \ --with-ppl=/home/syohei/local --with-cloog=/home/syohei/local \ --with-newlib --with-headers=../newlib/libc/include --enable-lto --enable-cloog-backend=isl % make % make check % make install
newlib
% cd newlib-1.20.0 % mkdir -p build_sh && cd build_sh % ../configure --target=sh-linux-elf --prefix=/home/syohei/local/sh --disable-nls % make % make check % make install
GDB
% cd gdb-7.4.1 % mkdir -p build_sh && cd build_sh % ../configure --target=sh-linux-elf --prefix=/home/syohei/local/sh --disable-nls % make % make check % make install
テスト
Testgenの shのコンフィグファイルとして以下を作成します。
+{ compiler => 'sh-linux-elf-gcc', simulator => 'sh-linux-elf-run', c_flags => [ '-g', '-Dunix' ], ld_flags => [ '' ], options => ['-O0', '-O1', '-O2', '-Os', '-O3'], testdir => 'testsuite_sh', compile_only => 0, size => { char => 8, short => 16, int => 32, long => 32, pointer => 32, }, timeout => 10, color => 1, };
テスト生成, 実行
% perl bin/tgen.pl --config=config/sh_cross.cnf template/*.tt % cd testsuite_sh % ./runtest.pl
テスト結果
v850同様, 基本的な部分では問題なさそうです。
------------------------------------------ Total : 87970 Passed Compile : 87970 (100.0 %) Failed Compile : 0 ( 0.0 %) Passed Execute : 87970 (100.0 %) Failed Execute : 0 ( 0.0 %) ------------------------------------------