Changes between Version 42 and Version 43 of TBR/UserManual/RTEMSAda


Ignore:
Timestamp:
Jul 5, 2007, 11:56:48 PM (12 years ago)
Author:
JoelSherrill
Comment:

Update for gcc 4.2.0

Legend:

Unmodified
Added
Removed
Modified
  • TBR/UserManual/RTEMSAda

    v42 v43  
    11= RTEMSAda =
    22
     3
     4GNAT/RTEMS is used to refer to the configuration of the GNU Ada compiler (GNAT) when used with RTEMS as the run-time environment.  GNAT/RTEMS provides a very full featured Ada programming and run-time environment.  An early version of GNAT/RTEMS was validated (http://sw-eng.falls-church.va.us/ajpo_databases/ada95_validated_compilers.html#67) on the SPARC/ERC32.  RTEMS has long had support for the Ada programming languages with the earliest work done against gnat 2.x.  In fact, the GNAT/RTEMS port predates the other ports of GNAT to embedded RTOS environments. 
     5
     6These instructions have been used to build GNAT/RTEMS with GCC 4.2.0 for the following target/bsp combinations with the indicated level of testing
     7
     8 *  arm-rtems4.8 - Ada hello world ran on edb7312 simulator
     9 *  bfin-rtems4.8 - nothing ran
     10 *  i386-rtems4.8 - Ada hello world ran on qemu with pc386 BSP
     11 *  m68k-rtems4.8 - nothing ran
     12 *  mips-rtems4.8 - Ada hello world ran on jmr3904
     13 *  powerpc-rtems4.8 - Ada hello world and ACATS ran on psim
     14 *  sparc-rtems4.8 - Ada hello world and ACATS ran on erc32
     15
     16
     17Laurent Guerby originally wrote these instructions using the sparc-rtems4.7 target and erc32 BSP.  His times are based on a Pentium M 1.7 GHz SuSE 9.3 machine.
     18
     19[wiki:TBR/User/JoelSherrill JoelSherrill] updated these instructions on 6 July 2007.  My times are based on a 2.00 Ghz T2500 Centrino Duo running Fedora Core 7.  I used the RTEMS RPMs as much as possible and ONLY built the packages that were absolutely necessary.  In all cases, you should use the latest patches available which correspond to shipping RPMs.  These should always be in the RTEMS source code at ''rtems/contrib/crossrpms/patches'' and at ftp://ftp.rtems.com/pub/rtems/SOURCES.
     20
     21As of 7 July 2007, there is a single technical issue which prevents Ada from being included in the standard RTEMS RPMs.  The Ada run-time libraries are '''NOT''' built multilib.  If this is resolved, then it is expected that Ada will be included in the RTEMS RPMs.
    322= Ada Programming/ RTEMS Build Instructions =
    423
    524
    6 Here are the build instructions, assuming $INSTALL is the prefix for the toolchain installation and $TARGET is the target code (tested with TARGET=sparc-rtems4.7), $BSP the RTEMS BSP (tested with BSP=erc32)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
     25These instructions assume the following:
     26
     27 *  $INSTALL is the prefix for the toolchain installation
     28 *  $TARGET is the target code (tested with TARGET=sparc-rtems4.7)
     29 *  $BSP the RTEMS BSP (tested with BSP=erc32)
     30
     31It is critical that you have a recent enough C/Ada native GCC in your $PATH.  It is usually necessary to build a native C/Ada native GCC of EXACTLY the same version as the version you are building cross to target RTEMS.
     32
     33Please perform each configure/make/make install in a separate empty build directory. Also set PATH=$INSTALL/bin:$PATH
    734= Patches =
    835
    936
    10  *  [ftp://ftp.rtems.com/pub/rtems/linux/redhat/7.3/i386/rpms/rtems-4.7/rtems-4.7-binutils-2.16.1-3/SOURCES/binutils-2.16.1-rtems-20050816.diff binutils-2.16.1-rtems-20050816.diff]
    11  *  [http://guerby.org/ftp/gdb-6.3-rtems-20050828-guerby.diff gdb-6.3-rtems-20050828-guerby.diff]
    12  *  [ftp://ftp.rtems.com/pub/rtems/linux/redhat/7.3/i386/rpms/rtems-4.7/rtems-4.7-gcc4.0.1newlib1.13.0-4/SOURCES/newlib-1.13.0-rtems-20050810.diff newlib-1.13.0-rtems-20050810.diff]
    13  *  [ftp://ftp.rtems.com/pub/rtems/linux/redhat/7.3/i386/rpms/rtems-4.7/rtems-4.7-autoconf-rtems-2.59-4/SOURCES/autoconf-2.59-quoting-20040817-1.diff autoconf-2.59-quoting-20040817-1.diff]
    14  *  [ftp://ftp.rtems.com/pub/rtems/linux/redhat/7.3/i386/rpms/rtems-4.7/rtems-4.7-automake-rtems-1.9.6-0/SOURCES/automake-1.8.1-rtems-20040112-1.diff automake-1.8.1-rtems-20040112-1.diff]
    15 
    16 Note: the original RTEMS patch for GDB doesn't work with sis when using GCC 4.0 and above, for reference it is available here: [ftp://ftp.rtems.com/pub/rtems/linux/redhat/7.3/i386/rpms/rtems-4.7/rtems-4.7-gdb-6.3-1/SOURCES/gdb-6.3-rtems-20050828.diff gdb-6.3-rtems-20050828.diff]
     37Please use the latest patches available for the tool versions you are using.  These should always be in the RTEMS source code at ''rtems/contrib/crossrpms/patches'' and at ftp://ftp.rtems.com/pub/rtems/SOURCES.
    1738= Autotools (1 minute)  =
    1839
    1940
    20  *  [http://ftp.gnu.org/gnu/autoconf/autoconf-2.59.tar.bz2 autoconf-2.59.tar.bz2 (1MB)]
    21  *  [http://ftp.gnu.org/gnu/automake/automake-1.9.6.tar.bz2 automake-1.9.6.tar.bz2 (1MB)]
    22 
    23 {{{
    24 ../autoconf-2.59/configure --prefix=$INSTALL
     41
     42If possible, please use the latest prebuilt autoconf and automake tools for your host and RTEMS version.  As of 7 July 2007, for Fedora 7, this corresponded to:
     43
     44 *  rtems-4.8-automake-1.10-5.fc7
     45  *  No Patch
     46 *  rtems-4.8-autoconf-2.61-5.fc7
     47  *  No Patch
     48
     49The versions above may be superceded at any time.  If they are not the latest when you are reading this, please be sure to check for a patch and USE it.  If you are unable or unwilling to use a prebuilt binary, then follow the following instructions to build your own binaries.
     50
     51{{{
     52mkdir b-autoconf
     53cd b-autoconf
     54../autoconf-2.61/configure --prefix=$INSTALL
    2555make
    2656make install
     
    2858
    2959{{{
    30 ../automake-1.9.6/configure --prefix=$INSTALL
     60mkdir b-automake
     61cd b-automake
     62../automake-1.19/configure --prefix=$INSTALL
    3163make
    3264make install
    3365}}}
    34 
    35 Note: please apply patches mentionned above (automake 1.8.1 patch will apply to 1.9.6).
    3666= Building binutils (3 minutes) =
    3767
    3868
    39 [http://ftp.gnu.org/gnu/binutils/binutils-2.16.1.tar.bz2 binutils-2.16.1.tar.bz2 (12MB)]
    40 {{{
    41 .../binutils-2.16.1/configure --build=i686-pc-linux-gnu --host=i686-pc-linux-gnu  --verbose --disable-nls \
     69[http://ftp.gnu.org/gnu/binutils/binutils-2.17.tar.bz2 binutils-2.17.tar.bz2 (12MB)]
     70
     71Apply any patches needed.  As of 7 July 2007, this was:
     72
     73 *  binutils-2.17-rtems4.8-20061021.diff
     74
     75
     76{{{
     77mkdir b-bin
     78cd b-bin
     79.../binutils-2.17/configure  --verbose --disable-nls \
    4280--target=$TARGET --prefix=$INSTALL
    4381make
     
    4583}}}
    4684
    47 Note: It is also possible to install the binutils RPMs in a non-default location using rpmpcio and mv.
    48 = newlib Setup =
    49 
    50 [ftp://sources.redhat.com/pub/newlib/newlib-1.13.0.tar.gz newlib-1.13.0.tar.gz (7.4MB)]
     85Note: It is also possible to install the binutils RPMs in a non-default location using rpm2cpio and mv.
     86= GCC and newlib Setup =
     87
     88
     89[http://ftp.gnu.org/gnu/gcc/gcc-4.2.0/gcc-4.2.0.tar.bz2 gcc-4.2.0.tar.bz2 (44MB)]
     90[ftp://sources.redhat.com/pub/newlib/newlib-1.15.0.tar.gz newlib-1.15.0.tar.gz (7.4MB)]
     91
     92Apply any patches needed.  As of 7 July 2007, this was:
     93
     94 *  gcc-core-4.2.0-rtems4.8-20070613.diff
     95 *  newlib-1.15.0-rtems4.8-20070413.diff
     96
     97In addition, gcc 4.2.0 requires the Ada run-time patch submitted as GCC PR 32640 (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32640).
     98
     99Be sure to patch your gcc newlib with the latest RTEMS newlib patch mentioned BEFORE linking newlib and libgloss into the gcc tree.
    51100
    52101Add newlib and libgloss links in the gcc source top level directory. 
    53 Be sure to patch your newlib with the latest RTEMS newlib patch mentionned above.
    54 
    55 {{{
    56 cd .../gcc-src/
    57 ln -s ../newlib-1.13.0/newlib ../newlib-1.13.0/libgloss .
     102
     103{{{
     104cd .../gcc-4.2.0/
     105ln -s ../newlib-1.15.0/newlib ../newlib-1.15.0/libgloss .
    58106}}}
    59107= First Build of non-multilib C Only (12 minutes) =
    60108
    61109
    62 {{{
    63 .../gcc-src/configure --enable-threads=rtems  --with-gnu-as --disable-multilib \
    64 --with-gnu-ld --with-newlib  --verbose --with-system-zlib --disable-nls \
    65 --enable-version-specific-runtime-libs \
    66 --enable-languages=c --target=$TARGET --prefix=$INSTALL
    67 make
    68 make install
    69 }}}
     110Building GNAT is a bit idiosyncratic.  You must build and install a toolset WITHOUT Ada first since building the GNAT run-time depends on at least an installed C Library. In addition, as mentioned earlier, the Ada run-time libraries are not built multilib so you must compile them with CPU dependent CFLAGS which match those required by your intended target CPU.
     111
     112{{{
     113mkdir b-gcc1
     114cd b-gcc1
     115../gcc-4.2.0/configure --enable-threads=rtems  --with-gnu-as --disable-multilib \
     116  --with-gnu-ld --with-newlib  --verbose --with-system-zlib --disable-nls \
     117  --enable-version-specific-runtime-libs \
     118  --enable-languages=c --target=$TARGET --prefix=$INSTALL
     119make
     120make install
     121}}}
     122
     123NOTE: Be sure to have a native GCC Ada compiler of the same of similar version.  Otherwise, it is possibly the cross-GNAT will fail to compile with a mysterious looking error. 
    70124= Build of non-multilib C and Ada (21 minutes) =
    71125
    72126
    73127{{{
    74 .../gcc-src/configure --enable-threads=rtems  --with-gnu-as --disable-multilib \
    75 --with-gnu-ld --with-newlib  --verbose --with-system-zlib --disable-nls \
    76 --enable-version-specific-runtime-libs \
    77 --enable-languages=c,ada --target=$TARGET --prefix=$INSTALL
    78 make
    79 make install
    80 }}}
     128mkdir b-gcc2
     129cd b-gcc2
     130../gcc-4.2.0/configure --enable-threads=rtems  --with-gnu-as --disable-multilib \
     131  --with-gnu-ld --with-newlib  --verbose --with-system-zlib --disable-nls \
     132  --enable-version-specific-runtime-libs \
     133  --enable-languages=c,ada --target=$TARGET --prefix=$INSTALL
     134make
     135make install
     136}}}
     137
     138You can include c++ in the list of languages if you wish.
    81139= Or Slower Build of multilibed C, C++, and Ada (XX minutes) =
    82140
    83141
    84 Note: untested
    85 
    86 {{{
    87 .../gcc-src/configure --enable-threads=rtems  --with-gnu-as \
    88 --with-gnu-ld --with-newlib  --verbose --with-system-zlib --disable-nls \
    89 --enable-version-specific-runtime-libs \
    90 --enable-languages=c,c++,ada --target=$TARGET --prefix=$INSTALL
     142Note: untested,
     143
     144{{{
     145../gcc-4.2.0/configure --enable-threads=rtems  --with-gnu-as \
     146  --with-gnu-ld --with-newlib  --verbose --with-system-zlib --disable-nls \
     147  --enable-version-specific-runtime-libs --enable-libada \
     148  --enable-languages=c,c++,ada --target=$TARGET --prefix=$INSTALL
    91149make
    92150make install
     
    103161cd .../build
    104162.../rtems/configure --disable-multilib --disable-cxx --enable-posix \
    105 --target=$TARGET --prefix=$INSTALL --enable-rtemsbsp=$BSP
     163  --enable-networking \
     164  --target=$TARGET --prefix=$INSTALL --enable-rtemsbsp=$BSP
    106165make
    107166make install
     
    112171
    113172
    114 [ftp://sources.redhat.com/pub/gdb/releases/gdb-6.3.tar.bz2 gdb-6.3.tar.bz2 (13MB)]
     173[ftp://sources.redhat.com/pub/gdb/releases/gdb-6.6.tar.bz2 gdb-6.6.tar.bz2 (13MB)]
    115174
    116175Apply latest RTEMS patch for gdb version (see above)
     
    118177{{{
    119178.../gdb-6.3/configure --build=i686-pc-linux-gnu --host=i686-pc-linux-gnu --verbose --disable-nls \
    120 --enable-sim --enable-sim-timebase --enable-sim-hardware \
    121 --target=$TARGET --prefix=$INSTALL
    122 make
    123 make install
    124 }}}
    125 
    126 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.
    127 {{{
    128 gcc ... support.c
    129 ../../../gdb-5.3/sim/ppc/ppc-instructions: In function 'convert''to''integer':
    130 ../../../gdb-5.3/sim/ppc/ppc-instructions:1221: error: label at end of compound statement
    131 make[wiki:2 2]: *** [wiki:Support.o support.o] Error 1
    132 make[wiki:2 2]: Leaving directory `/home/guerby/work/gcc/cross/build5/sim/ppc'
    133 make[wiki:1 1]: *** [wiki:All all] Error 2
    134 make[wiki:1 1]: Leaving directory `/home/guerby/work/gcc/cross/build5/sim'
    135 make: *** [wiki:All-sim all-sim] Error 2
    136 }}}
     179  --enable-sim --enable-sim-timebase --enable-sim-hardware \
     180  --target=$TARGET --prefix=$INSTALL
     181make
     182make install
     183}}}
     184
    137185= Compile and Test =
    138186
     
    144192   Ada.Text''IO.Put''Line ("Hello RTEMS Ada");
    145193end T;
    146 $ powerpc-rtems-gnatmake -f -g t -largs -BINSTALL -specs bsp_specs -qrtems
     194$ powerpc-rtems-gnatmake -f -g t -largs -B$INSTALL/$TARGET/$BSP -specs bsp_specs -qrtems
    147195...
    148196$ INSTALL/powerpc-rtems/psim/tests/runtest ./t
    149197}}}
    150198
    151 Then look in log/t
    152 
    153 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.
    154 
    155 Note2: It appears that gnat (gcc 4.1 CVS) is always looking for the cross tools in /usr/bin.
     199Then look in log/t.
     200
     201Note1: It appears that gnat (gcc 4.2.0) is mangling target names with periods in them.  CPU-rtems4.7 is turning into CPU-rtems4.
     202
     203Note2: It appears that gnat (gcc 4.1 CVS) is always looking for the cross tools in /usr/bin.  Unchecked in 4.2.0.
    156204= Old Build Instructions with GCC 3.2 =
    157205