Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
21 years ago

gcc compiler for nios2

Hi,

I am looking for a nios2-elf-gcc compiler that runs under linux. I have a working nios-elf-gcc compiler for NIOS1 but can't find the NIOS2 version anywhere.

Jelle

3 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    The Nios II toolchain can be rebuilt under Linux using the source code found on the Nios II Embedded Processor CD.

    The source code should be installed onto your windows machine. I tarred and bzipped it, and then transferred it to my Linux machine.

    Word of warning... the toolchain is littered with CRLF's that really cause problems with the configure scripts and Makefiles. Any problems you might have are quite likely due to CRLF's. You may want to try running the source tree through a "dos2unix" type utility. I used "flip" to fix up the tree.

    I used the following environment variables while following the instructions below:

    target = nios2-elf
    prefix = /home/kenw/work/r6200
    scratch = /home/kenw/tmp

    <div class='quotetop'>QUOTE </div>

    --- Quote Start ---

    Building/Installing binutils

    $ mkdir -p $scratch/build/binutils

    $ cd $scratch/build/binutils

    $ $scratch/src/binutils/configure

    --target=$target

    --prefix=$prefix

    -v 2>&1 | tee configure.out

    $ make -w all install 2>&1 | tee make.out

    $ export PATH=$prefix/bin:$PATH

    Building/Installing gcc

    $ mkdir -p $scratch/build/gcc

    $ cd $scratch/build/gcc

    $ $scratch/src/gcc/configure

    --target=$target

    --prefix=$prefix

    --with-gnu-as

    --with-gnu-ld

    --with-newlib

    -v 2>&1 | tee configure.out

    $ make -w all-gcc install-gcc

    LANGUAGES="c c++" 2>&1 | tee make.out

    Building/Installing newlib

    $ mkdir -p $scratch/build/newlib

    $ cd $scratch/build/newlib

    $ $scratch/src/newlib/configure

    --target=$target

    --prefix=$prefix

    2>&1 | tee make.out

    $ cd $scratch/src/newlib/newlib

    $ cp configure.host.smallc configure.host

    $ make 2>&1 | tee make.out

    $ make install[/b]

    --- Quote End ---

    Good luck!
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    If you don&#39;t need linux toolchain support this very moment I suggest waiting a few weeks -- our next (Nios II 1.1) release will give you everything you need.

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Thanks for your reactions. I&#39;ve found the source files. It was an extra option during the installation of the NIOSII IDE.

    I compiled the source code and now I have a working compiler.

    Jelle