User:Columbus/OR1K Toolchain: Difference between revisions

From OSDev.wiki
Jump to navigation Jump to search
Content added Content deleted
No edit summary
No edit summary
Line 1: Line 1:
A tutorial, how to build a OpenRISC toolchain.
A tutorial, how to build a OpenRISC toolchain.
At the end of the tutorial, you have a GCC-Toolchain for or1k. I'm trying to use it for OS deving.
At the end of the tutorial, you have a GCC-Toolchain for or1k. I'm trying to use it for OS deving.
I'd be happy, if someone could write a Barebone for it, because I don't understand the or1k opcodes/mnemonics.
I'll update it, when I've found other/better solutions, or a toolchain, that is good for OS deving.


== Prerequisites ==
== Prerequisites ==
Line 50: Line 50:
--prefix=/opt/or1k-toolchain --enable-shared \
--prefix=/opt/or1k-toolchain --enable-shared \
--disable-itcl --disable-tk --disable-tcl \
--disable-itcl --disable-tk --disable-tcl \
--disable-winsup --disable-gdbtk \
--disable-winsup --disable-gdbtk --disable-nls \
--disable-libgui --disable-rda --disable-sid \
--disable-libgui --disable-rda --disable-sid \
--enable-sim --disable-or1ksim --enable-gdb \
--enable-sim --disable-or1ksim --enable-gdb \
Line 66: Line 66:
--prefix=/opt/or1k-toolchain --enable-languages=c,c++ \
--prefix=/opt/or1k-toolchain --enable-languages=c,c++ \
--disable-shared --disable-libssp --with-newlib \
--disable-shared --disable-libssp --with-newlib \
--disable-werror
--disable-werror --disable-nls --without-headers


make -j8
make -j8
Line 73: Line 73:


== Further ==
== Further ==
You now have a C/C++ Compiler, and an Assembler with or1k as target.
You can now
But you should know, that in the Assembler, you can only use [[GAS]]-Keywords, and or1k instructions.
<source lang="bash">ls /opt/or1k-toolchain/bin</source>
If you don't have problems with that, have fun with linking and so on as usual.
To see what got installed, and what the commands are you should use.
Use
<source lang="bash">or1k-elf-run <filename></source>
To run an or1k-application

Revision as of 14:15, 9 November 2014

A tutorial, how to build a OpenRISC toolchain. At the end of the tutorial, you have a GCC-Toolchain for or1k. I'm trying to use it for OS deving. I'd be happy, if someone could write a Barebone for it, because I don't understand the or1k opcodes/mnemonics.

Prerequisites

You must have git installed, and the folder /opt/or1k-toolchain should exist, and the user you're using should have write access.

Compiling the toolchain

The toolchain gets installed to /opt/or1k-toolchain In some directory do

# Clone repos
git clone git://github.com/openrisc/or1k-src.git
git clone git://github.com/openrisc/or1k-gcc.git
# Create build directories
mkdir build-or1k-src build-or1k-gcc
# Extend $PATH
export PATH=$PATH:/opt/or1k-toolchain

# Build src
cd build-or1k-src

../or1k-src/configure --target=or1k-elf      \
--prefix=/opt/or1k-toolchain --enable-shared \
--disable-itcl   --disable-tk --disable-tcl  \
--disable-winsup --disable-gdbtk             \
--disable-libgui --disable-rda --disable-sid \
--disable-sim    --disable-gdb --with-sysroot \
--disable-newlib --disable-libgloss          \
--disable-werror

make -j8
make install

# Build gcc
cd ../bld-or1k-gcc

../or1k-gcc/configure --target=or1k-elf           \
--prefix=/opt/or1k-toolchain --enable-languages=c \
--disable-shared --disable-libssp --disable-werror

make -j8
make install -j8

# Rebuild src with newlib
cd ../bld-or1k-src
rm -rf *

../or1k-src/configure --target=or1k-elf      \
--prefix=/opt/or1k-toolchain --enable-shared \
--disable-itcl   --disable-tk --disable-tcl  \
--disable-winsup --disable-gdbtk --disable-nls \
--disable-libgui --disable-rda --disable-sid \
--enable-sim  --disable-or1ksim --enable-gdb \
--with-sysroot   --enable-newlib             \
--enable-libgloss --disable-werror

make -j8
make install -j8

# Rebuild gcc with newlib
cd ../bld-or1k-gcc
rm -rf *

../or1k-gcc/configure --target=or1k-elf               \
--prefix=/opt/or1k-toolchain --enable-languages=c,c++ \
--disable-shared --disable-libssp --with-newlib       \
--disable-werror --disable-nls --without-headers

make -j8
make install -j8

Further

You now have a C/C++ Compiler, and an Assembler with or1k as target. But you should know, that in the Assembler, you can only use GAS-Keywords, and or1k instructions. If you don't have problems with that, have fun with linking and so on as usual.