2013年7月29日月曜日

OpenRISC toolchain

Toolchain for OpenRISC cannot be built with the mainline source code. It was difficult for me to find the right way from openrisc web site.

After a couple of days of crawling, I found a repository maintained by Kevin Mehall.
It works perfectly, and its good point is gdb is also maintained.

If all libraries(GMP, MPFR and MPC) to build GCC have already been installed, simply do as following.
 
% git clone https://github.com/kevinmehall/openrisc-tools-build
% cd openrisc-tools-build
% git submodule update --init
% make -j3 PREFIX=

I wanted to build them on CentOS5.x machine and these libraries are not installed by default.
I wrote a preparation script to download and build these libraries.
These libraries are built as a static library, so setting LD_LIBRARY_PATH is not required.
If you faced the same problem, please try the following procedure.

% git clone https://github.com/kevinmehall/openrisc-tools-build
% cd openrisc-tools-build 
% git submodule update --init
% wget https://raw.github.com/yTakatsukasa/misc/master/openrisc_toolchain/toolchain.patch -O - | patch -p1
% bash ./prepare.sh
% make -j3 PREFIX=

Note that this patch disables openOCD. If you need openOCD, add openOCD to all: in Makefile.