wiki:TBR/UserManual/RTEMSAda

Version 32 (modified by Guerby, on Dec 7, 2005 at 12:58:03 AM) (diff)

/* Build GDB (4 minutes) */

RTEMSAda

Ada / RTEMS Build Instructions

Here are the build instructions, assuming $INSTALL is the prefix for the toolchain installation and $TARGET is the target code (tested with $TARGET=powerpc-rtems4.7), and that you have a recent enough c,ada native GCC in PATH (timings are given on a Pentium M 1.7 GHz SuSE 9.3 machine). Please perform each configure/make/make install in a separate empty build directory. Also set PATH=$INSTALL/bin:$PATH

Patches

Autotools (1 minute)

../autoconf-2.59/configure --prefix=$INSTALL
make 
make install
../automake-1.9.6/configure --prefix=$INSTALL
make 
make install

Note: please apply patches mentionned above (automake 1.8.1 patch will apply to 1.9.6).

Building binutils (3 minutes)

binutils-2.16.1.tar.bz2 (12MB)

.../binutils-2.16.1/configure --build=i686-pc-linux-gnu --host=i686-pc-linux-gnu  --verbose --disable-nls \
--target=$TARGET --prefix=$INSTALL
make
make install

Note: It is also possible to install the binutils RPMs in a non-default location using rpmpcio and mv.

newlib Setup

newlib-1.13.0.tar.gz (7.4MB)

Add newlib and libgloss links in the gcc source top level directory. Be sure to patch your newlib with the latest RTEMS newlib patch mentionned above.

cd .../gcc-src/
ln -s ../newlib-1.13.0/newlib ../newlib-1.13.0/libgloss .

First Build of non-multilib C Only (12 minutes)

.../gcc-src/configure --enable-threads=rtems  --with-gnu-as --disable-multilib \
--with-gnu-ld --with-newlib  --verbose --with-system-zlib --disable-nls \
--enable-version-specific-runtime-libs \
--enable-languages=c --target=$TARGET --prefix=$INSTALL
make
make install

Build of non-multilib C and Ada (21 minutes)

.../gcc-src/configure --enable-threads=rtems  --with-gnu-as --disable-multilib \
--with-gnu-ld --with-newlib  --verbose --with-system-zlib --disable-nls \
--enable-version-specific-runtime-libs \
--enable-languages=c,ada --target=$TARGET --prefix=$INSTALL
make
make install

Or Slower Build of multilibed C, C++, and Ada (XX minutes)

.../gcc-src/configure --enable-threads=rtems  --with-gnu-as \
--with-gnu-ld --with-newlib  --verbose --with-system-zlib --disable-nls \
--enable-version-specific-runtime-libs \
--enable-languages=c,c++,ada --target=$TARGET --prefix=$INSTALL
make
make install

Note1: please use GCC >= 20050208 (after Nathanael commit for PR ada/19489)

Note2: As of 17 Nov 2005, ada/socket.c needed an extern int h_errno; added to make it compile for *-rtems* since RTEMS networking .h files are not included with newlib patch here

Build RTEMS from CVS (4 minutes)

cvs -z3 -d :pserver:anoncvs@www.rtems.com:/usr1/CVS login
cvs -z3 -d :pserver:anoncvs@www.rtems.com:/usr1/CVS co rtems
cd rtems
./bootstrap
autoconf
cd .../build
.../rtems/configure --disable-multilib --disable-cxx  --enable-rtemsbsp=psim --enable-posix \
--target=$TARGET --prefix=$INSTALL
make
make install

Note: autoconf must be recent and include RTEMS patches.

Build GDB (4 minutes)

gdb-6.3.tar.bz2 (13MB)

Apply latest RTEMS patch for gdb version (see above)

.../gdb-6.3/configure --build=i686-pc-linux-gnu --host=i686-pc-linux-gnu --verbose --disable-nls \
--enable-sim --enable-sim-timebase --enable-sim-hardware \
--target=$TARGET --prefix=$INSTALL
make
make install

Note1: GCC 4.0.0 (and GCC 3.4) fails to compile gdb 5.3 as follows, you need to use GCC 3.3 OR add semi-colons as needed to make gcc happy.

gcc ... support.c
../../../gdb-5.3/sim/ppc/ppc-instructions: In function 'convert''to''integer':
../../../gdb-5.3/sim/ppc/ppc-instructions:1221: error: label at end of compound statement
make[wiki:2 2]: *** [wiki:Support.o support.o] Error 1
make[wiki:2 2]: Leaving directory `/home/guerby/work/gcc/cross/build5/sim/ppc'
make[wiki:1 1]: *** [wiki:All all] Error 2
make[wiki:1 1]: Leaving directory `/home/guerby/work/gcc/cross/build5/sim'
make: *** [wiki:All-sim all-sim] Error 2

Compile and Test

$ cat t.adb
with Ada.Text_IO;
procedure T is
begin
   Ada.Text''IO.Put''Line ("Hello RTEMS Ada");
end T;
$ powerpc-rtems-gnatmake -f -g t -largs -BINSTALL -specs bsp_specs -qrtems
...
$ INSTALL/powerpc-rtems/psim/tests/runtest ./t

Then look in log/t

Note1: It appears that gnat (gcc 4.1 CVS) is mangling target names with periods in them. CPU-rtems4.7 is turning into CPU-rtems4.

Note2: It appears that gnat (gcc 4.1 CVS) is always looking for the cross tools in /usr/bin.

Old Build Instructions with GCC 3.2

make
make -C gcc cross-gnattools
make -C gcc ada.all.cross
make -C gcc GNATLIBCFLAGS="${GNATLIBCFLAGS}" gnatlib
make install