User:Columbus/OR1K Toolchain: Difference between revisions

From OSDev.wiki
Jump to navigation Jump to search
Content added Content deleted
m (Mentioned GDC)
(Added Link to or1k Assembly example)
Line 76: Line 76:
But you should know, that in the Assembler, you can only use [[GAS]]-Keywords, and or1k instructions.
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.
If you don't have problems with that, have fun with linking and so on as usual.

I found an example of or1k-Assembly code. It's the asm code of the libc implementation of the or1k toolchain. Its [http://opencores.org/websvn,filedetails?repname=openrisc&path=%2Fopenrisc%2Ftrunk%2Fgnu-stable%2Fnewlib-1.18.0%2Flibgloss%2For32%2Fcrt0.S here].


One could also combine with the GDC-Toolchain tutorial, to have a really special thing. I didn't try this, and I don't know if or1k breaks GDC
One could also combine with the GDC-Toolchain tutorial, to have a really special thing. I didn't try this, and I don't know if or1k breaks GDC


If you're interested, the or1k page is [http://opencores.org/or1k/Main_Page |here]. It contains the Architecture Specification, which names the instructions that you can use.
If you're interested, the or1k page is [http://opencores.org/or1k/Main_Page here]. It contains the Architecture Specification, which names the instructions that you can use.


== Sources ==
== Sources ==

Revision as of 16:28, 18 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.

I found an example of or1k-Assembly code. It's the asm code of the libc implementation of the or1k toolchain. Its here.

One could also combine with the GDC-Toolchain tutorial, to have a really special thing. I didn't try this, and I don't know if or1k breaks GDC

If you're interested, the or1k page is here. It contains the Architecture Specification, which names the instructions that you can use.

Sources

I got the main commands from the or1k Documentation

Then I combined them with the GCC-CrossCompiler tutorials.