Changes between Version 47 and Version 48 of TBR/UserManual/RTEMSAda


Ignore:
Timestamp:
Feb 14, 2008, 7:10:36 AM (12 years ago)
Author:
Cicalese
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • TBR/UserManual/RTEMSAda

    v47 v48  
    1414 *  sparc-rtems4.8 - Ada hello world and ACATS ran on erc32
    1515
     16These instructions have been used to build GNAT/RTEMS with GCC 4.2.3 for the following target/bsp combinations with the indicated level of testing
     17
     18 *  powerpc-rtems4.9 - ticker example ran on psim
    1619
    1720Laurent 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.
     
    1922[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.
    2023
     24Cindy Cicalese updated these instructions on 14 February 2008 based upon testing psim on Fedora 7 with RTEMS 4.9.
     25
    2126As 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.
    22 = Ada Programming/ RTEMS Build Instructions =
    23 
    24 
    25 These instructions assume the following strings in the instructions are replaced with values appropriate for you.  Do NOT use these as environment variables.  Setting an environment variable named INSTALL in particular will cause trouble with GNU build packages.
    26 
    27  *  INSTALL is the prefix for the toolchain installation
     27= General Ada Programming/RTEMS Build Instructions =
     28
     29
     30These instructions assume the following strings in the instructions are replaced with values appropriate for you.  These ''may'' not work if you use these as environment variables, so do so at your own risk.
     31
     32 *  INSTALL_DIR is the prefix (installation directory) for the toolchain installation
    2833 *  TARGET is the target code (tested with TARGET=sparc-rtems4.7)
    2934 *  BSP the RTEMS BSP (tested with BSP=erc32)
    3035
    31 It 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 
    33 Please perform each configure/make/make install in a separate empty build directory. Also set PATH=INSTALL/bin:$PATH
    34 = Patches =
    35 
     36It is critical that you have a recent enough C/Ada native GCC in your $PATH before beginning.
     37
     38Please perform each configure/make/make install trio in a separate empty build directory. In the directions below, the versions for RTEMS 4.9 are used. If you are building RTEMS 4.8, update the commands below with the appropriate older versions. Also set PATH=INSTALL_DIR/bin:$PATH.
     39
     40Finally, some weird behavior has been observed when trying to build GCC on Fedora using an NTFS file system.
     41= Source Code and Patches =
     42
     43
     44If you are building from source code, download all of the necessary source code archives, unpackage them, and apply the appropriate patches.
    3645
    3746Please 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.
    38 = Autotools (1 minute)  =
    39 
    40 
    41 
    42 If 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 
    49 The 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  *  http://ftp.gnu.org/gnu/autoconf/autoconf-2.61.tar.bz2
    52  *  http://ftp.gnu.org/gnu/automake/automake-1.10.tar.bz2
     47
     48As of 13 February 2008, the current source code and patches for RTEMS 4.9 are as follows:
     49
     50<blockquote>
     51{| border=1 cellspacing=0 cellpadding=10 style="background:#ccffcc;"
     52|+ RTEMS 4.9 Sources and Patches
     53|- style="background:#0066cc;"
     54!Component
     55!Version
     56!Source Code
     57!Diff Date
     58!Diff
     59|-
     60|autoconf
     61|2.61
     62|[ftp://ftp.gnu.org/gnu/autoconf/autoconf-2.61.tar.bz2 ftp]
     63|
     64|
     65|-
     66|automake
     67|1.10
     68|[ftp://ftp.gnu.org/gnu/automake/automake-1.10.tar.bz2 ftp]
     69|
     70|
     71|-
     72|binutils
     73|2.18
     74|[ftp://ftp.gnu.org/gnu/binutils/binutils-2.18.tar.bz2 ftp]
     75|2007-11-04
     76|[ftp://ftp.rtems.com/pub/rtems/SOURCES/binutils-2.18-rtems4.9-20071104.diff ftp]
     77|-
     78|rowspan=2|gcc
     79|rowspan=2|4.2.3
     80|rowspan=2|[ftp://ftp.gnu.org/gnu/gcc/gcc-4.2.3/gcc-4.2.3.tar.bz2 ftp]
     81|''core:'' 2008-02-02
     82|[ftp://ftp.rtems.com/pub/rtems/SOURCES/gcc-core-4.2.3-rtems4.9-20080202.diff ftp]
     83|-
     84|''Ada:'' 2008-02-07
     85|[ftp://ftp.rtems.com/pub/rtems/SOURCES/gcc-ada-4.2.3-rtems4.9-20080207.diff ftp]
     86|-
     87|newlib
     88|1.16.0
     89|[ftp://sources.redhat.com/pub/newlib/newlib-1.16.0.tar.gz ftp]
     90|2008-01-31
     91|[ftp://ftp.rtems.com/pub/rtems/SOURCES/newlib-1.16.0-rtems4.9-20080131.diff ftp]
     92|-
     93|gdb
     94|6.7.1
     95|[ftp://ftp.gnu.org/gnu/gdb/gdb-6.7.1.tar.bz2 ftp]
     96|2007-12-16
     97|[ftp://ftp.rtems.com/pub/rtems/SOURCES/gdb-6.7.1-rtems4.9-20071216.diff ftp]
     98|-
     99|}
     100</blockquote>
     101
     102As of 7 July 2007, the current source code and patches for RTEMS 4.8 are as follows:
     103
     104<blockquote>
     105{| border=1 cellspacing=0 cellpadding=10 style="background:#ccffcc;"
     106|+ RTEMS 4.8 Sources and Patches
     107|- style="background:#0066cc;"
     108!Component
     109!Version
     110!Source Code
     111!Diff Date
     112!Diff
     113|-
     114|autoconf
     115|2.61
     116|[ftp://ftp.gnu.org/gnu/autoconf/autoconf-2.61.tar.bz2 ftp]
     117|
     118|
     119|-
     120|automake
     121|1.10
     122|[ftp://ftp.gnu.org/gnu/automake/automake-1.10.tar.bz2 ftp]
     123|
     124|
     125|-
     126|binutils
     127|2.17
     128|[ftp://ftp.gnu.org/gnu/binutils/binutils-2.17.tar.bz2 ftp]
     129|2006-10-21
     130|[ftp://ftp.rtems.com/pub/rtems/SOURCES/binutils-2.17-rtems4.8-20061021.diff ftp]
     131|-
     132|gcc
     133|4.2.0
     134|[ftp://ftp.gnu.org/gnu/gcc/gcc-4.2.0/gcc-4.2.0.tar.bz2 ftp]
     135|2007-06-13
     136|[ftp://ftp.rtems.com/pub/rtems/SOURCES/gcc-core-4.2.0-rtems4.8-20070613.diff ftp]
     137|-
     138|newlib
     139|1.15.0
     140|[ftp://sources.redhat.com/pub/newlib/newlib-1.15.0.tar.gz ftp]
     141|2007-04-13
     142|[ftp://ftp.rtems.com/pub/rtems/SOURCES/newlib-1.15.0-rtems4.8-20070413.diff ftp]
     143|-
     144|gdb
     145|6.6
     146|[ftp://ftp.gnu.org/gnu/gdb/gdb-6.6.tar.bz2 ftp]
     147|
     148|
     149|-
     150|}
     151</blockquote>
     152
     153Rather than building from source code, you may be able to use the pre-built versions of the code provided for various architectures at ftp://ftp.rtems.com/pub/rtems/.  For example, an RPM for autoconf 2.61 for Fedora 7 is available at ftp://ftp.rtems.com/pub/rtems/linux/4.8/fedora/7/i386/rtems-4.8-autoconf-2.61-5.fc7.noarch.rpm. However, be aware that problems have been identified if the version of the pre-built binutils has an INSTALL_DIR different from the one you are using for the other tools. It is also possible to install the binutils RPMs in a non-default location using rpm2cpio and mv, but this may cause problems in finding "as" on some platforms.
     154= Building autoconf and automake (1 minute)  =
     155
    53156
    54157{{{
    55158mkdir b-autoconf
    56159cd b-autoconf
    57 ../autoconf-2.61/configure --prefix=INSTALL
     160../autoconf-2.61/configure --prefix=INSTALL_DIR
    58161make
    59162make install
     
    63166mkdir b-automake
    64167cd b-automake
    65 ../automake-1.19/configure --prefix=INSTALL
     168../automake-1.10/configure --prefix=INSTALL_DIR
    66169make
    67170make install
    68171}}}
    69172= Building binutils (3 minutes) =
    70 
    71 
    72 [http://ftp.gnu.org/gnu/binutils/binutils-2.17.tar.bz2 binutils-2.17.tar.bz2 (12MB)]
    73 
    74 Apply any patches needed.  As of 7 July 2007, this was:
    75 
    76  *  binutils-2.17-rtems4.8-20061021.diff
    77173
    78174
     
    80176mkdir b-bin
    81177cd b-bin
    82 .../binutils-2.17/configure  --verbose --disable-nls \
    83 --target=TARGET --prefix=INSTALL
    84 make
    85 make install
    86 }}}
    87 
    88 Note: It is also possible to install the binutils RPMs in a non-default location using rpm2cpio and mv.
     178../binutils-2.18/configure  --verbose --disable-nls \
     179--target=TARGET --prefix=INSTALL_DIR
     180make
     181make install
     182}}}
    89183= GCC and newlib Setup =
    90184
    91185
    92 [http://ftp.gnu.org/gnu/gcc/gcc-4.2.0/gcc-4.2.0.tar.bz2 gcc-4.2.0.tar.bz2 (44MB)]
    93 [ftp://sources.redhat.com/pub/newlib/newlib-1.15.0.tar.gz newlib-1.15.0.tar.gz (7.4MB)]
    94 
    95 Apply any patches needed.  As of 7 July 2007, this was:
    96 
    97  *  gcc-core-4.2.0-rtems4.8-20070613.diff
    98  *  newlib-1.15.0-rtems4.8-20070413.diff
     186It 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. So, starting from a relatively recent native C and Ada GCC, you will probabaly need to build a new native C and Ada GCC. You will then proceed to build a C cross-compiler and then a C and Ada cross-compiler.
    99187
    100188Be sure to patch your gcc newlib with the latest RTEMS newlib patch mentioned BEFORE linking newlib and libgloss into the gcc tree.
     
    103191
    104192{{{
    105 cd .../gcc-4.2.0/
    106 ln -s ../newlib-1.15.0/newlib ../newlib-1.15.0/libgloss .
    107 }}}
    108 = First Build of non-multilib C Only (12 minutes) =
     193cd ../gcc-4.2.3/
     194ln -s ../newlib-1.16.0/newlib ../newlib-1.16.0/libgloss .
     195}}}
     196= Build non-multilib C and Ada Native Compiler (1 hour) =
     197
     198
     199
     200{{{
     201mkdir b-native
     202cd b-native
     203../gcc-4.2.3/configure --with-gnu-as --disable-multilib \
     204  --with-gnu-ld --verbose --with-system-zlib --disable-nls \
     205  --enable-version-specific-runtime-libs \
     206  --enable-languages=c,ada --prefix=INSTALL_DIR
     207make
     208make install
     209}}}
     210= Build non-multilib C Cross-Compiler (12 minutes) =
    109211
    110212
     
    114216mkdir b-gcc1
    115217cd b-gcc1
    116 ../gcc-4.2.0/configure --enable-threads=rtems  --with-gnu-as --disable-multilib \
     218../gcc-4.2.3/configure --enable-threads=rtems  --with-gnu-as --disable-multilib \
    117219  --with-gnu-ld --with-newlib  --verbose --with-system-zlib --disable-nls \
    118220  --enable-version-specific-runtime-libs \
    119   --enable-languages=c --target=TARGET --prefix=INSTALL
    120 make
    121 make install
    122 }}}
    123 
    124 NOTE: 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. 
    125 = Build of non-multilib C and Ada (21 minutes) =
     221  --enable-languages=c --target=TARGET --prefix=INSTALL_DIR
     222make
     223make install
     224}}}
     225
     226NOTE: 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.
     227= Build non-multilib C and Ada Cross-Compiler (21 minutes) =
    126228
    127229
     
    129231mkdir b-gcc2
    130232cd b-gcc2
    131 ../gcc-4.2.0/configure --enable-threads=rtems  --with-gnu-as --disable-multilib \
     233../gcc-4.2.3/configure --enable-threads=rtems  --with-gnu-as --disable-multilib \
    132234  --with-gnu-ld --with-newlib  --verbose --with-system-zlib --disable-nls \
    133235  --enable-version-specific-runtime-libs \
    134   --enable-languages=c,ada --target=TARGET --prefix=INSTALL
     236  --enable-languages=c,ada --target=TARGET --prefix=INSTALL_DIR
    135237make
    136238make install
     
    138240
    139241You can include c++ in the list of languages if you wish.
    140 = Or Slower Build of multilibed C, C++, and Ada (XX minutes) =
     242= Or Slower Build of multilibed C, C++, and Ada Cross-Compiler (XX minutes) =
    141243
    142244
     
    144246
    145247{{{
    146 ../gcc-4.2.0/configure --enable-threads=rtems  --with-gnu-as \
     248../gcc-4.2.3/configure --enable-threads=rtems  --with-gnu-as \
    147249  --with-gnu-ld --with-newlib  --verbose --with-system-zlib --disable-nls \
    148250  --enable-version-specific-runtime-libs --enable-libada \
    149   --enable-languages=c,c++,ada --target=TARGET --prefix=INSTALL
     251  --enable-languages=c,c++,ada --target=TARGET --prefix=INSTALL_DIR
     252make
     253make install
     254}}}
     255= Build GDB (4 minutes) =
     256
     257
     258{{{
     259mkdir b-gdb
     260cd b-gdb
     261../gdb-6.7.1/configure --verbose --disable-nls \
     262  --enable-sim --enable-sim-timebase --enable-sim-hardware \
     263  --target=TARGET --prefix=INSTALL_DIR
    150264make
    151265make install
     
    153267= Build RTEMS from CVS (4 minutes) =
    154268
     269
     270First, get the RTEMS source code. For RTEMS 4.9, use:
    155271
    156272{{{
    157273cvs -z3 -d :pserver:anoncvs@www.rtems.com:/usr1/CVS login
    158274cvs -z3 -d :pserver:anoncvs@www.rtems.com:/usr1/CVS co rtems
     275}}}
     276
     277For RTEMS 4.8, use:
     278
     279{{{
     280cvs -z3 -d :pserver:anoncvs@www.rtems.com:/usr1/CVS login
     281cvs -z3 -d :pserver:anoncvs@www.rtems.com:/usr1/CVS co -r rtems-4-8-branch rtems
     282}}}
     283
     284Then, build RTEMS:
     285
     286{{{
    159287cd rtems
    160288./bootstrap
    161 cd .../build
     289cd ..
     290mkdir b-rtems
     291cd b-rtems
    162292.../rtems/configure --disable-multilib --disable-cxx --enable-posix \
    163293  --enable-networking \
    164   --target=TARGET --prefix=INSTALL --enable-rtemsbsp=BSP
     294  --target=TARGET --prefix=INSTALL_DIR --enable-rtemsbsp=BSP
    165295make
    166296make install
     
    168298
    169299Note: autoconf must be recent and include RTEMS patches.
    170 = Build GDB (4 minutes) =
    171 
    172 
    173 [ftp://sources.redhat.com/pub/gdb/releases/gdb-6.6.tar.bz2 gdb-6.6.tar.bz2 (13MB)]
    174 
    175 Apply latest RTEMS patch for gdb version (see above)
    176 
    177 {{{
    178 .../gdb-6.3/configure --build=i686-pc-linux-gnu --host=i686-pc-linux-gnu --verbose --disable-nls \
    179   --enable-sim --enable-sim-timebase --enable-sim-hardware \
    180   --target=TARGET --prefix=INSTALL
    181 make
    182 make install
    183 }}}
    184 
    185300= Compile and Test =
    186301
    187302{{{
    188 $ cat t.adb
     303$ cat > t.adb
    189304with Ada.Text_IO;
    190305procedure T is
    191306begin
    192    Ada.Text''IO.Put''Line ("Hello RTEMS Ada");
     307   Ada.Text_IO.Put_Line ("Hello RTEMS Ada");
    193308end T;
    194 $ powerpc-rtems-gnatmake -f -g t -largs -BINSTALL/TARGET/BSP -specs bsp_specs -qrtems
     309<Control-D>
     310$ powerpc-rtems-gnatmake -f -g t -largs -BINSTALL_DIR/TARGET/BSP -specs bsp_specs -qrtems
    195311...
    196 $ INSTALL/powerpc-rtems/psim/tests/runtest ./t
     312$ INSTALL_DIR/powerpc-rtems/psim/tests/runtest ./t
    197313}}}
    198314
     
    202318
    203319Note2: It appears that gnat (gcc 4.1 CVS) is always looking for the cross tools in /usr/bin.  Unchecked in 4.2.0.
     320
     321Note3: Does not appear to work in RTEMS 4.9.
    204322= Old Build Instructions with GCC 3.2 =
    205323