Let's make the world a better place using digital technologies!

Building RTEMS (Real-Time Executive for Multiprocessor Systems) for Coldfire using Opensource Tools

It really took me a couple of days to set things straight for a successful build. Here are the steps that I followed. Before starting, make sure you have ca. 1GB free space as the temporary files can easily consume a lot of space. I built everything on andLinux running on a Windows XP host.

  • Create necessary folders:
    mkdir /usr/local/rtems/source
    mkdir /usr/local/rtems/source/tools
    mkdir /usr/local/rtems/rtems-4.8
  • Add the path:
  • Install the pre-requisites:
    apt-get install automake gdb bzip2 texinfo autoconf patch
  • Get and build the development tools:
    cd /usr/local/rtems/source/tools
    wget http://www.rtems.com/ftp/pub/rtems/SOURCES/binutils-2.18.tar.bz2
    wget http://www.rtems.com/ftp/pub/rtems/SOURCES/gcc-4.2.2.tar.bz2
    wget http://www.rtems.com/ftp/pub/rtems/SOURCES/newlib-1.15.0.tar.gz

    Unzip the files:
    bzcat binutils-2.18.tar.bz2 | tar xf -
    tar -xvzf newlib-1.15.0.tar.gz
    bzcat gcc-4.2.2.tar.bz2 | tar xf -

    Get and apply the patches:
    wget http://www.rtems.com/ftp/pub/rtems/SOURCES/binutils-2.18-rtems4.8-20071104.diff
    wget http://www.rtems.com/ftp/pub/rtems/SOURCES/newlib-1.15.0-rtems4.8-20071221.diff
    wget http://www.rtems.com/ftp/pub/rtems/SOURCES/gcc-core-4.2.2-rtems4.8-20071127.diff

    cd binutils-2.18
    patch -p1 <../binutils-2.18-rtems4.8-20071104.diff cd ..

    cd newlib-1.15.0
    patch -p1 <../newlib-1.15.0-rtems4.8-20071221.diff cd ..

    cd gcc-4.2.2
    patch -p1 <../gcc-core-4.2.2-rtems4.8-20071127.diff rm -rf newlib ln -s ../newlib-1.15.0/newlib newlib cd ..

    Make and instal necessary libraries

    wget http://ftp.sunet.se/pub/gnu/gmp/gmp-4.2.2.tar.gz
    tar -xvf gmp-4.2.2.tar.gz
    cd gmp-4.2.2
    make install
    cd ..

    wget http://www.mpfr.org/mpfr-current/mpfr-2.3.1.tar.bz2
    bzcat mpfr-2.3.1.tar.bz2 | tar -xf -
    cd mpfr-2.3.1
    make install
    cd ..

    Make a temporary build folder:
    rm -rf build
    mkdir build
    cd build

    ../binutils-2.18/configure -target=m68k-rtems4.8 -prefix=/usr/local/rtems/rtems-4.8
    make -w all install
    cd ..

    If you want to get the latest version of CVS-head you may use:
    cd /usr/src/rtems-4.9-9MAY08/source
    cvs -d :pserver:anoncvs@www.rtems.com:/usr1/CVS login

    (Press ENTER for password)
    cvs -d :pserver:anoncvs@www.rtems.com:/usr1/CVS -z 9 co -P rtems
    cd rtems
    (This will generate the configure script)
    cd ..
    In this case, however, the instructions given here may not apply exactly as they are.

    Clean the build folder:
    rm -rf build
    mkdir build
    cd build

    Now configure the gcc:
    ../gcc-4.2.2/configure -target=m68k-rtems4.8 \
    -prefix=/usr/local/rtems/rtems-4.8 \
    -with-gnu-as -with-gnu-ld -with-newlib -verbose \
    -with-system-zlib -disable-nls \
    -enable-version-specific-runtime-libs \
    -enable-threads=rtems \

    make -w all (It can take about an hour and newlib will also be compiled along with)
    make -w install
    cd ..\..
    (pwd: source)

  • Get and build RTEMS-4.8

    wget http://www.rtems.com/ftp/pub/rtems/4.8.0/rtems-4.8.0.tar.bz2
    bzcat rtems-4.8.0.tar.bz2 | tar -xf -

    Make a clean build folder:
    rm -rf build
    mkdir build
    cd build

    Configure the rtems:
    ../rtems-4.8.0/configure -target=m68k-rtems4.8 \
    -prefix=/usr/local/rtems/rtems-4.8 \
    -enable-cxx -disable-tests -enable-networking \
    (-enable-docs is broken, results in @include `version.texi': No such file or directory.)

    Make the kernel for a given target:
    make -w RTEMS_BSP="av5282" install

    make RTEMS_BSP="uC5282" does not succeed because of the following gcc-4.2.2 error:
    ../../../../../../rtems-4.8.0/c/src/../../cpukit/shttpd/log.c: In function '_shttpd_log_access':
    ../../../../../../rtems-4.8.0/c/src/../../cpukit/shttpd/log.c:139: error: insn does not satisfy its constraints:
    (insn 74 158 159 10 ../../../../../../rtems-4.8.0/c/src/../../cpukit/shttpd/log.c:117 (set (mem/c:SI (plus:SI (reg/f:SI 14 %a6)
    (reg:SI 1 %d1)) [57 D.6862+0 S4 A16])
    (mem/s:SI (plus:SI (reg/v/f:SI 10 %a2 [orig:48 c ] [48])
    (const_int 220 [0xdc])) [2 .loc.io.total+0 S4 A16])) 34 {*movsi_cf} (nil)
    ../../../../../../rtems-4.8.0/c/src/../../cpukit/shttpd/log.c:139: internal compiler error: in reload_cse_simplify_operands, at

    Install RTEMS:
    make -w install

  • Build Addon Packages For Command Line Utilities
    wget http://www.rtems.com/ftp/pub/rtems/4.8.0/rtems-addon-packages-4.8.0.tar.bz2

    Set the RTEMS_MAKEFILE_PATH variable to the BSP location:
    export RTEMS_MAKEFILE_PATH=/usr/local/rtems/rtems-4.8/m68k-rtems4.8/av5282
    cd /usr/local/rtems/source/rtems-addon-packages-4.8.0

    (If you have more than one targets, this needs to be done for each of them)
    Make the add-on tools
    sh bit



View more posts from this author

Leave a Reply

Your email address will not be published. Required fields are marked *