ColdFire Techniques

Building RTEMS for the ColdFire with Cygwin/WinNT

Here's my first attempt at a Getting Started guide for folk who don't want to go the whole hog and build their own compiler binaries but want to use and develop RTEMS for the ColdFire. Linux users might find this useful but should follow the RTEMS getting started docs to find out how to build the toolset.

Files Needed:

Installing Cygwin32 B20.1

This section describes the process of installing the version Beta20.1 VERSION of the Cygwin32 environment. It assumes that this toolset is installed in c:\coldfire.

  1. Run full.exe and install to c:\coldfire\cygnus (rather than the c:\cygnus default).
  2. Run the Cygwin32 icon on the start menu.
  3. At the bash/shell prompt run:
      umount /
      mount -b c:\\coldfire /
  4. Create the /bin, /tmp, /source and /build directories.
      mkdir /bin
      mkdir /tmp
      mkdir /source
      mkdir /build
      mkdir /build/rtems
      mkdir /home
      mkdir /tftpboot
  5. The light Bourne shell provided with Cygwin B20.1 is buggy. You should copy it to a fake name and copy bash.exe to sh.exe:
      cd /cygnus/cygnus-b20/H-i586-cygwin32/bin
      mv sh.exe old_sh.exe
      cp bash.exe sh.exe
  6. The shell has to be present in /bin directory to run shell scripts properly:
      cp /cygnus/cygnus-b20/H-i586-cygwin32/bin/sh.exe /bin
      cp /cygnus/cygnus-b20/H-i586-cygwin32/bin/bash.exe /bin
  7. Edit the c:\coldfire\cygnus\cygwin-b20\cygnus.bat file and add the following lines:
      SET CYGWIN=binmode
      SET HOME=/home
    This makes Cygwin pipes 8 bit clean and sets your unix home directory(~) to /home which is necessary for some programs

Installing the RTEMS Compiler

RTEMS requires a specially configured compiler. To unpack this run:
  cd /
  tar -xvf //c/download/files/gcc-m68k-rtems-win32-R2.tar.bz2 --use-compress-program=bzip2
You will need to add c:\coldfire\gcc-m68k\bin to the PATH statement in c:\coldfire\cygnus\cygwin-b20\cygwin.bat. Note you can safely install a copy of this compiler over the top of an existing m68k-coff compiler as the new compiler is m68k-rtems-*.

Copy the updated cygwin1.dll from /gcc-m68k/ to /cygnus/cygnus-b20/H-i586-cygwin32/bin/. You must do this otherwise the compiler will fail to run.

Restart the Cygwin shell and run m68k-rtems-gcc -v to check the compiler is working. The compiler will print its version information something like:
bash-2.02$ m68k-rtems-gcc -v
Reading specs from \gcc-m68k\lib\gcc-lib\m68k-rtems\egcs-2.91.60\specs
gcc driver version egcs-2.91.60 19981201 (egcs-1.1.1 release) executing gcc vers
ion egcs-2.91.58

Installing RTEMS

Go to the source directory /source and:

  1. Unpack the RTEMS-4.0.0 source:
    tar -xzvf //c/download/files/rtems-4_0_0.tar.gz
  2. Unpack the ColdFire Board Support Packages:
      tar -xzvf //c/download/files/rtems-coldfire-bsp-981120.tar.gz
  3. Go to the RTEMS build directory /build/rtems and configure RTEMS:
      /source/rtems-4.0.0/configure --target=m68k-rtems --disable-posix --disable-tests
       --enable-rtemsbsp=sbc5206 --prefix=/gcc-m68k
  4. This configures RTEMS to not have support for the POSIX thread API and not to build all the tests and only enable the sbc5206 BSP. These options are enabled by default but take a long time to build. You can use the SBC5307 BSP by using --enable-rtemsbsp=sbc5307. RTEMS will be installed to the c:\coldfire\gcc-m68k\rtems directory change the --prefix value to point elsewhere if you want.

  5. Build RTEMS by typing "make".

It should then go ahead and build the whole of RTEMS and copy the sample EXEs to the /tftpboot directory. You can then point your TFTP server at c:\coldfire\tftpboot and try running something ;)

Doing something meaningful with RTEMS

OK. You've built RTEMS and got the examples running and now you want to use it for a REAL application. To do this you must first install it by running "make install".

Unpack the simple C applicaton from the RTEMS web site into a suitable directory(anywhere you like). To get it to build you must tell the application's makefile where to pick up the RTEMS configuration and library. Type the following:

  export RTEMS_MAKEFILE_PATH=/gcc-m68k/rtems/sbc5206

Then run "make" to build the sample app and it will copy the EXE to the /tftpboot directory. If you find the /tftpboot procedure annoying then edit the rtems-4.0.0/make/custom/sbc5206.cfg config file and change the lines in the make-exe rule. This file also contains other useful configuration parameters for the Board Support Package, gcc options, etc.

This procedure also works for the netdemos package that comes with RTEMS which(when I finish the rewrite of the NE2000 driver) will allow you to play with TCP/IP benchmarks and other network demos applications.

Drop me a line if you have any questions or there are problems with this guide.

Useful Links


[Home]

Copyright (c) 1997-99 David J. Fiddes.