[LM32]GNUツール(CentOS6.4_x86)

cd mico32_gnutools_src_7.1/binutils/
./configure --target=lm32-elf --prefix=/usr/local/lm32 --disable-nls
    :
all -Wstrict-prototypes -Wmissing-prototypes -Werror -g -O2 -c lm32-asm.c -o lm32-asm.o
cc1: warnings being treated as errors
lm32-asm.c: In function 'parse_imm':
lm32-asm.c:74: error: pointer targets in passing argument 4 of 'cgen_parse_signed_integer' differ in signedness
.././opcodes/../include/opcode/cgen.h:581: note: expected 'long int *' but argument is of type 'long unsigned int *'
lm32-asm.c: In function 'parse_lo16':
lm32-asm.c:147: error: pointer targets in passing argument 4 of 'parse_imm' differ in signedness
lm32-asm.c:65: note: expected 'long unsigned int *' but argument is of type 'long int *'
lm32-asm.c: In function 'lm32_cgen_parse_operand':
lm32-asm.c:341: error: pointer targets in passing argument 4 of 'parse_lo16' differ in signedness
lm32-asm.c:122: note: expected 'long int *' but argument is of type 'long unsigned int *'
make[4]: *** [lm32-asm.lo] Error 1
make[4]: Leaving directory `/usr/local/bin/mico32_gnutools_src_7.1/binutils/opcodes'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/usr/local/bin/mico32_gnutools_src_7.1/binutils/opcodes'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/usr/local/bin/mico32_gnutools_src_7.1/binutils/opcodes'
make[1]: *** [all-opcodes] Error 2
make[1]: Leaving directory `/usr/local/bin/mico32_gnutools_src_7.1/binutils'
make: *** [all] Error 2



(2014.6.1追記)
VMware上のCentOS6.5でも、Lattice Mico32のGNUツールがbinutilsのconfigureでエラーとなる。
そもそも環境の問題かと思い、lm32以外のbuildをしてみることに。
http://blog.bitran.co.jp/develop/2009/06/shgccwindows-vi.html

ここに従い、SH用のbuildをしてみる。
VMwareでCentOSを使ってる。

[root@localhost sh]# cat /etc/redhat-release
CentOS release 6.5 (Final)


上記のHPにURLが書いてあった通り、以下のデータをダウンロードしてくる。

7604 -rwxrwxrwx. 1 root root 7786190 May 31 08:42 /usr/local/sh/newlib-1.13.0.tar.gz
13084 -rwxrwxrwx. 1 root root 13397308 May 31 08:42 /usr/local/sh/gcc-core-3.4.5.tar.bz2
12264 -rwxrwxrwx. 1 root root 12558259 May 31 08:38 /usr/local/sh/binutils-2.16.1a.tar.bz2



/usr/local/shへ移動。tar.bz2やtar.gzを解凍する。

[root@localhost sh]# tar jxvf binutils-2.16.1a.tar.bz2
[root@localhost sh]# tar jxvf gcc-core-3.4.5.tar.bz2
[root@localhost sh]# tar zxvf newlib-1.13.0.tar.gz



以下手順でビルドする。

$ cd /usr/local/sh/binutils-2.16
$ mkdir obj
$ cd obj
$ ../configure --target=sh-hitachi-elf --prefix=/usr/local/sh --disable-nls
$ make
$ make install


最初やった時は、makeのとこでErrorが出て困ったが、yum update を実行してから再度やってみたら成功した。

これらが生成された。

[root@localhost bin]# pwd
/usr/local/sh/bin
[root@localhost bin]# lm
total 34980
3248 -rwxr-xr-x. 2 root root 3322877 May 31 18:12 sh-hitachi-elf-ld
2720 -rwxr-xr-x. 1 root root 2783993 May 31 18:12 sh-hitachi-elf-gprof
3184 -rwxr-xr-x. 2 root root 3257615 May 31 18:12 sh-hitachi-elf-as
2376 -rwxr-xr-x. 1 root root 2429429 May 31 18:12 sh-hitachi-elf-c++filt
2904 -rwxr-xr-x. 2 root root 2971052 May 31 18:12 sh-hitachi-elf-strip
2444 -rwxr-xr-x. 2 root root 2500911 May 31 18:12 sh-hitachi-elf-nm
408 -rwxr-xr-x. 1 root root 417193 May 31 18:12 sh-hitachi-elf-readelf
2408 -rwxr-xr-x. 1 root root 2464611 May 31 18:12 sh-hitachi-elf-addr2line
2904 -rwxr-xr-x. 1 root root 2971021 May 31 18:12 sh-hitachi-elf-objcopy
2376 -rwxr-xr-x. 2 root root 2430825 May 31 18:12 sh-hitachi-elf-ranlib
2264 -rwxr-xr-x. 1 root root 2316853 May 31 18:12 sh-hitachi-elf-strings
2376 -rwxr-xr-x. 2 root root 2430826 May 31 18:12 sh-hitachi-elf-ar
3084 -rwxr-xr-x. 2 root root 3154503 May 31 18:12 sh-hitachi-elf-objdump
2284 -rwxr-xr-x. 1 root root 2334770 May 31 18:12 sh-hitachi-elf-size



.bashrcへ以下を追加。

export PATH=$PATH:/usr/local/sh/bin



cd /usr/local/sh/gcc-3.4.5/
mkdir obj
cd obj
../configure --target=sh-hitachi-elf --prefix=/usr/local/sh --with-gnu-as --with-gnu-ld --with-newlib --with-headers= /usr/local/sh/newlib-1.13.0/newlib/libc/include
binutils同様。config.logにerrorの文字は無い。
make
make install



make install後はこうなった。

[root@localhost obj]# lm /usr/local/sh/bin/sh-hitachi-elf-*
196 -rwxr-xr-x. 2 root root 198438 May 31 21:56 /usr/local/sh/bin/sh-hitachi-elf-gcc
196 -rwxr-xr-x. 2 root root 198438 May 31 21:56 /usr/local/sh/bin/sh-hitachi-elf-gcc-3.4.5
196 -rwxr-xr-x. 1 root root 199997 May 31 21:56 /usr/local/sh/bin/sh-hitachi-elf-cpp
16 -rwxr-xr-x. 1 root root 15824 May 31 21:56 /usr/local/sh/bin/sh-hitachi-elf-gccbug
64 -rwxr-xr-x. 1 root root 64289 May 31 21:56 /usr/local/sh/bin/sh-hitachi-elf-gcov
3248 -rwxr-xr-x. 2 root root 3322877 May 31 18:12 /usr/local/sh/bin/sh-hitachi-elf-ld
2720 -rwxr-xr-x. 1 root root 2783993 May 31 18:12 /usr/local/sh/bin/sh-hitachi-elf-gprof
3184 -rwxr-xr-x. 2 root root 3257615 May 31 18:12 /usr/local/sh/bin/sh-hitachi-elf-as
2376 -rwxr-xr-x. 1 root root 2429429 May 31 18:12 /usr/local/sh/bin/sh-hitachi-elf-c++filt
2904 -rwxr-xr-x. 2 root root 2971052 May 31 18:12 /usr/local/sh/bin/sh-hitachi-elf-strip
2444 -rwxr-xr-x. 2 root root 2500911 May 31 18:12 /usr/local/sh/bin/sh-hitachi-elf-nm
408 -rwxr-xr-x. 1 root root 417193 May 31 18:12 /usr/local/sh/bin/sh-hitachi-elf-readelf
2408 -rwxr-xr-x. 1 root root 2464611 May 31 18:12 /usr/local/sh/bin/sh-hitachi-elf-addr2line
2904 -rwxr-xr-x. 1 root root 2971021 May 31 18:12 /usr/local/sh/bin/sh-hitachi-elf-objcopy
2376 -rwxr-xr-x. 2 root root 2430825 May 31 18:12 /usr/local/sh/bin/sh-hitachi-elf-ranlib
2264 -rwxr-xr-x. 1 root root 2316853 May 31 18:12 /usr/local/sh/bin/sh-hitachi-elf-strings
2376 -rwxr-xr-x. 2 root root 2430826 May 31 18:12 /usr/local/sh/bin/sh-hitachi-elf-ar
3084 -rwxr-xr-x. 2 root root 3154503 May 31 18:12 /usr/local/sh/bin/sh-hitachi-elf-objdump
2284 -rwxr-xr-x. 1 root root 2334770 May 31 18:12 /usr/local/sh/bin/sh-hitachi-elf-size



最後はnewlib。


$ cd /usr/local/sh/newlib-1.13.0
$ mkdir obj
$ cd obj
$ ../configure --target=sh-hitachi-elf --prefix=/usr/local/sh
$ make
$ make install



そしてgccバージョンが確認出来たら完了。

[root@localhost ~]# sh-hitachi-elf-gcc -v
Reading specs from /usr/local/sh/lib/gcc/sh-hitachi-elf/3.4.5/specs
Configured with: ../configure --target=sh-hitachi-elf --prefix=/usr/local/sh --with-gnu-as --with-gnu-ld --with-newlib --with-headers= /usr/local/sh/newlib-1.13.0/newlib/libc/include
Thread model: single
gcc version 3.4.5



Lattice Mico32用GNUツールのbuildは失敗したが、これでやっと1つ成功例ができた。

(2014.6.2追記)
Lattice Mico32に戻り、configureのerror解析。
(mico32_gnutools_src_7.1/binutils/)

VMwareのCentOS6.4をyum updateで更新したら、CentOS6.5になり、configureした時のエラーが
こうなった。

conftest.c:2: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'me'


これまた有力な情報が見つからない。binutils/README見たら、手順は、configure → make → make install とある。
READMEを参考にこれやったらerror内容が変わった。

export CC=gcc
binutils/configure --target=lm32-elf --prefix=/usr/local/lm32 --disable-nls


こんなエラーになり、原因調査中。

<binutils/config.logの最初のerror>
conftest.c:9:28: error: ac_nonexistent.h: No such file or directory




(2014.6.14追記)
どうもlattice mico32用GNUソースでビルドに成功するものが無いと思っていたら
今度はこんなページ見つけた。
http://www.das-labor.org/wiki/Soc-lm32/lm32-toolchain_install_the_crosscompiler
ここから
Source (gcc3.4.6): lm32-src-patched
をダウンロードし、tar jxvfで解凍し、rootでmakeとしただけ。

  :
make[5]: Nothing to be done for `all'.
make[5]: Leaving directory `/usr/local/bin/lm32/lm32/build-gcc/lm32-elf/mmultiply-enabled/mbarrel-shift-enabled/libiberty/testsuite'
/bin/sh ../../../../../gcc/libiberty/../mkinstalldirs /usr/local/lm32//lm32-elf/lib/`/usr/local/bin/lm32/lm32/build-gcc/gcc/xgcc -B/usr/local/bin/lm32/lm32/build-gcc/gcc/ -B/usr/local/lm32//lm32-elf/bin/ -B/usr/local/lm32//lm32-elf/lib/ -isystem /usr/local/lm32//lm32-elf/include -isystem /usr/local/lm32//lm32-elf/sys-include -O2 -g -O2 -mmultiply-enabled -mbarrel-shift-enabled -print-multi-os-directory`
/usr/bin/install -c -m 644 libiberty.a /usr/local/lm32//lm32-elf/lib/`/usr/local/bin/lm32/lm32/build-gcc/gcc/xgcc -B/usr/local/bin/lm32/lm32/build-gcc/gcc/ -B/usr/local/lm32//lm32-elf/bin/ -B/usr/local/lm32//lm32-elf/lib/ -isystem /usr/local/lm32//lm32-elf/include -isystem /usr/local/lm32//lm32-elf/sys-include -O2 -g -O2 -mmultiply-enabled -mbarrel-shift-enabled -print-multi-os-directory`/libiberty.an
( cd /usr/local/lm32//lm32-elf/lib/`/usr/local/bin/lm32/lm32/build-gcc/gcc/xgcc -B/usr/local/bin/lm32/lm32/build-gcc/gcc/ -B/usr/local/lm32//lm32-elf/bin/ -B/usr/local/lm32//lm32-elf/lib/ -isystem /usr/local/lm32//lm32-elf/include -isystem /usr/local/lm32//lm32-elf/sys-include -O2 -g -O2 -mmultiply-enabled -mbarrel-shift-enabled -print-multi-os-directory` ; lm32-elf-ranlib libiberty.an )
mv -f /usr/local/lm32//lm32-elf/lib/`/usr/local/bin/lm32/lm32/build-gcc/gcc/xgcc -B/usr/local/bin/lm32/lm32/build-gcc/gcc/ -B/usr/local/lm32//lm32-elf/bin/ -B/usr/local/lm32//lm32-elf/lib/ -isystem /usr/local/lm32//lm32-elf/include -isystem /usr/local/lm32//lm32-elf/sys-include -O2 -g -O2 -mmultiply-enabled -mbarrel-shift-enabled -print-multi-os-directory`/libiberty.an /usr/local/lm32//lm32-elf/lib/`/usr/local/bin/lm32/lm32/build-gcc/gcc/xgcc -B/usr/local/bin/lm32/lm32/build-gcc/gcc/ -B/usr/local/lm32//lm32-elf/bin/ -B/usr/local/lm32//lm32-elf/lib/ -isystem /usr/local/lm32//lm32-elf/include -isystem /usr/local/lm32//lm32-elf/sys-include -O2 -g -O2 -mmultiply-enabled -mbarrel-shift-enabled -print-multi-os-directory`/libiberty.a
make[5]: Entering directory `/usr/local/bin/lm32/lm32/build-gcc/lm32-elf/mmultiply-enabled/mbarrel-shift-enabled/libiberty/testsuite'
make[5]: Nothing to be done for `install'.
make[5]: Leaving directory `/usr/local/bin/lm32/lm32/build-gcc/lm32-elf/mmultiply-enabled/mbarrel-shift-enabled/libiberty/testsuite'
make[4]: Leaving directory `/usr/local/bin/lm32/lm32/build-gcc/lm32-elf/mmultiply-enabled/mbarrel-shift-enabled/libiberty'
make[3]: Leaving directory `/usr/local/bin/lm32/lm32/build-gcc/lm32-elf/libiberty'
make[3]: Entering directory `/usr/local/bin/lm32/lm32/build-gcc/lm32-elf/libiberty/testsuite'
make[3]: Nothing to be done for `install'.
make[3]: Leaving directory `/usr/local/bin/lm32/lm32/build-gcc/lm32-elf/libiberty/testsuite'
make[2]: Leaving directory `/usr/local/bin/lm32/lm32/build-gcc/lm32-elf/libiberty'
make[1]: Leaving directory `/usr/local/bin/lm32/lm32/build-gcc'
touch buid-gcc.complete
[root@localhost lm32]#


Makefileに一切合財のビルドをしてくれるようになってるみたい。
しかも、これまでerrorが出てたconfigureでもerrorは存在しない。

[root@localhost lm32]# lm */config.log
4 -rw-r--r--. 1 root root 1478 Jun 14 06:37 build-gcc/config.log
4 -rw-r--r--. 1 root root 2738 Jun 14 06:32 build-newlib/config.log
4 -rw-r--r--. 1 root root 1478 Jun 14 06:29 build-gcc-bootstrap/config.log
4 -rw-r--r--. 1 root root 2738 Jun 14 06:27 build-binutils/config.log
4 -rw-r--r--. 1 1000 1000 1523 Mar 19 2007 gcc/config.log
[root@localhost lm32]# grep error !$
grep error */config.log
[root@localhost lm32]#



Makefile記載のbin生成先の以下を見ても、成功してる模様。

[root@localhost bin]# lm
total 25216
192 -rwxr-xr-x. 2 root root 193887 Jun 14 06:45 lm32-elf-gcc
192 -rwxr-xr-x. 2 root root 193887 Jun 14 06:45 lm32-elf-gcc-3.4.4
196 -rwxr-xr-x. 1 root root 198586 Jun 14 06:45 lm32-elf-cpp
16 -rwxr-xr-x. 1 root root 15794 Jun 14 06:44 lm32-elf-gccbug
64 -rwxr-xr-x. 1 root root 61888 Jun 14 06:44 lm32-elf-gcov
196 -rwxr-xr-x. 2 root root 199191 Jun 14 06:44 lm32-elf-c++
196 -rwxr-xr-x. 2 root root 199191 Jun 14 06:44 lm32-elf-g++
2428 -rwxr-xr-x. 2 root root 2485587 Jun 14 06:29 lm32-elf-ld
2656 -rwxr-xr-x. 2 root root 2716393 Jun 14 06:29 lm32-elf-as
1688 -rwxr-xr-x. 1 root root 1725078 Jun 14 06:29 lm32-elf-c++filt
2212 -rwxr-xr-x. 2 root root 2261400 Jun 14 06:29 lm32-elf-strip
1756 -rwxr-xr-x. 2 root root 1795449 Jun 14 06:29 lm32-elf-nm
412 -rwxr-xr-x. 1 root root 417861 Jun 14 06:29 lm32-elf-readelf
1724 -rwxr-xr-x. 1 root root 1762244 Jun 14 06:29 lm32-elf-addr2line
2212 -rwxr-xr-x. 1 root root 2261369 Jun 14 06:29 lm32-elf-objcopy
1688 -rwxr-xr-x. 2 root root 1728510 Jun 14 06:29 lm32-elf-ranlib
1580 -rwxr-xr-x. 1 root root 1614326 Jun 14 06:29 lm32-elf-strings
1692 -rwxr-xr-x. 2 root root 1728519 Jun 14 06:29 lm32-elf-ar
2520 -rwxr-xr-x. 2 root root 2576682 Jun 14 06:29 lm32-elf-objdump
1596 -rwxr-xr-x. 1 root root 1632483 Jun 14 06:29 lm32-elf-size
[root@localhost bin]# pwd
/usr/local/lm32/bin
[root@localhost bin]#

スポンサーサイト
カレンダー
04 | 2014/05 | 06
- - - - 1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
累積訪問者
現在の訪問者
現在の閲覧者数:
最新記事
最新トラックバック
最新コメント
月別アーカイブ
カテゴリ
プロフィール

bobgosso

Author:bobgosso
FPGAのブログへようこそ!

検索フォーム
RSSリンクの表示
リンク
ブロとも申請フォーム

この人とブロともになる

QRコード
QRコード