Using non-rtems gcc for NIOS2 port

Waschk,Kolja rtems at telos.de
Fri Jan 13 17:42:03 UTC 2006


Hi;

I'm currently compiling my (basic, not yet published) port of RTEMS for
Altera's NIOS2 processor using the original tools provided by Altera, i.e. a
nios2-elf-* toolchain based on gcc RTEMS with a (non-RTEMS) newlib-1.12.

Because the NIOS2 target is not in the official FSF gcc source tree and I
still haven't got any comment from Altera about the future of this, I
decided it would be nice to let people use just what's there with the
appropriate options.

However, this way it's not a simple "./configure && some extra && make
install", because some extra options have to be specified. Maybe you have
ideas how the following workarounds could be avoided (or beautified):

1.

I want to compile newlib and rtems for --target=nios2-rtems, but all the
tool names are prefixed nios2-elf- and wouldn't be detected during
./configure for --target=nios2-rtems, neither in newlib/ nor rtems/. I
now have it working with definitions of all tool names in the calling
environment, such as

  OBJDUMP_FOR_TARGET=nios2-elf-objdump

and I had to add all these (LD|NM|OBJDUMP|..., 9 new options) to
rtems/acinclude.m4 so that configure actually passes them down in target
build directories. That looks somewhat inelegant.

2.

For ./configure in rtems/, several options have to be specified as
CFLAGS_FOR_TARGET to make sure that my rtems-specific version of newlib is
used instead of the one built with the compiler. Cut&pasted that part of my
build script looks like

export CFLAGS_FOR_TARGET="-nostdinc\
 -isystem $PREFIX/$TARGET/include -isystem $GCCDIR/include \
 -B$PREFIX/$TARGET/lib/ -B$PREFIX/$TARGET/lib/$TARGET/$GCCVER \
 -msys-lib=c -msys-crt0=$PREFIX/$TARGET/lib/crt0.o \
 -DSYSTEM_BUS_WIDTH=32 -D__rtems__ -D__USE_INIT_FINI__"

  cd $BUILD-rtems
  $RTEMS/configure  \
    --target=$TARGET  \
    --prefix=$PREFIX  \
...

Ideally, configure should detect the situation itself and add the proper
ptions for the nios2 situation (as good as possible).

Comments and ideas welcome. I may have overlooked some magic
"--prefix-for-target-tools" option ;)

If, OTOH, everyone says it's okay to go with the need for a special build
script when you want to build nios2-rtems, then fine ...

Kolja

-- 
Mr. Kolja Waschk, telos.de - +49(40) 450173-0; Fax -99
telos EDV Systementwicklung GmbH - Schlueterstrasse 16 - D-20146 Hamburg




More information about the users mailing list