MinGW Tools for Windows
Windows users can use MinGW based RTEMS tools. These tools will generate the same application code for RTEMS as the tools on Linux or Cygwin. MinGW tools use the native Windows runtime rather than access Windows via the POSIX interface Cygwin provides. MinGW tools are faster than the Cygwin equivalent and are not confused by Cygwin mount points. Compiler errors will show a Windows path rather than a Cygwin path and so do not confuse native Windows editors.
The RTEMS MinGW Tools are not currently packaged in installers. The installers stopped around RTEMS 4.9 when the MinGW tools started to be built as part of the binary tool package. This means you need to manually step through the process. It is not difficult, how-ever it is not an easy installer.
This page targets a single user with a Windows machine who wishes to play with a real-time OS. This user is independent with no corporate support and she wants to build her desired board support package from a RTEMS release TAR-file or CVS. Only default installation paths are used so if the user wishes to access support on MinGW or MSYS mailing lists she has the standard set up and lay out for those forums. If you wish to contain all the RTEMS installed files in a common location you may find the hints in the Advanced Users section useful.
If you want some excellent tools or wish to build RTEMS on Windows the MinGW project provides just what you need. The RTEMS Tools as installed do not need any extra packages, DLLs or installs to work. You could use any available make program or tools to build any RTEMS application. Please note that the MinGW and MSYS installation is only necessary if you want to build RTEMS as RTEMS uses autoconf and automake. If someone else provides you with your desired RTEMS board support package you do not need them. The RTEMS Tools (compiler, assembler, linker etc.) do not depend on them. The only exception is the RTEMS Autoconf and Automake subpackage, but this package is only needed if you want do build RTEMS from the CVS sources.
The MinGW project has a package management tool that will install and manage your MinGW installation. The MinGW Getting Started Guide will step you through installing MinGW and MSYS. Open the MinGW Getting Started Guide and select the link to download the GUI installer. Save this to disk and run it. Click through the default including the default path of "C:\MinGW". At the "Select Components" page select the C++ compiler and "MSYS Basic System" and "MinGW Developer Toolkit". Once installed you can use to the CLI version of the tool to upgrade and install further packages.
Download the latest GUI installer from:
RTEMS Tools Installation
RTEMS provides built, ready to use tools for Windows. You do not need to build the tools from source. They are built and ready for use. All you need to do is unpack them into a location on your disk and start using them.
The tools for all RTEMS releases can be found here:
Under this directory you will find the version of tools that match the version of RTEMS you are working with. For RTEMS 4.10:
and for RTEMS 4.11:
These directories contain the binary executable files as well as the complete patched source code used to build the tools. You can identify the source code files as they end with "src.tar.bz2". You do not need to download the source files unless you wish to review it, change it or archive the source.
The examples that follow show version 4.11. Change 4.11 to 4.10 as needed to get the 4.10 version of tools.
There are specific files for each target. You need to download the files for the specific architecture are working with. To download the required files for the SPARC architecture you need to enter the follow directories and download all the tar.bz2 files that do not end in "src.tar.bz2" unless you wish to have the source as well:
The exact file name changes as the tools are updated. For example the current binutils file is "rtems-4.11-sparc-rtems4.11-binutils-2.22-1.tar.bz2" where the binutils version is 2.22 and this is our 1st patch release. Download all the files to a single directory on your Windows machine. For example download to "C:\opt\rtems\packages" and opening a MSYS shell we would have:
[chris@weka packages]$ cd /c/opt/rtems/packages/ [chris@weka packages]$ ls rtems-4.11-sparc-rtems4.11-binutils-2.22-1.tar.bz2 rtems-4.11-sparc-rtems4.11-gcc-libstdc++-4.6.2-9.tar.bz2 rtems-4.11-sparc-rtems4.11-gcc-4.6.2-9.tar.bz2 rtems-4.11-sparc-rtems4.11-gdb-7.4-1.tar.bz2 rtems-4.11-sparc-rtems4.11-gcc-c++-4.6.2-9.tar.bz2 rtems-4.11-sparc-rtems4.11-newlib-1.20.0-4.tar.bz2 rtems-4.11-sparc-rtems4.11-gcc-libgcc-4.6.2-9.tar.bz2
To install open a MSYS shell and perform the following commands:
[chris@weka /]$ cd /c [chris@weka c]$ for f in $(ls opt/rtems/packages/*.bz2); do tar xvjf $f; done ./ ./opt/ ./opt/rtems-4.11/ ./opt/rtems-4.11/bin/ ./opt/rtems-4.11/bin/sparc-rtems4.11-as.exe ./opt/rtems-4.11/bin/sparc-rtems4.11-objcopy.exe ./opt/rtems-4.11/bin/sparc-rtems4.11-ld.exe ./opt/rtems-4.11/bin/sparc-rtems4.11-strip.exe ./opt/rtems-4.11/bin/sparc-rtems4.11-c++filt.exe ./opt/rtems-4.11/bin/sparc-rtems4.11-size.exe ./opt/rtems-4.11/bin/sparc-rtems4.11-nm.exe ./opt/rtems-4.11/bin/sparc-rtems4.11-ld.bfd.exe ./opt/rtems-4.11/bin/sparc-rtems4.11-objdump.exe
Not all the files installed are shown in the example above. You will need to enter the autoconf and automake directories to obtain those packages and to install them if you wish to boostrap RTEMS.
Finally update the MSYS file-system table to point to the install RTEMS tools. Again in a MSYS shell perform the following:
[chris@weka etc]$ echo "c:\opt /opt" >> /etc/fstab [chris@weka etc]$ cd /opt/rtems-4.11
To test your installation open a MSYS shell and perform the following:
[chris@weka ~]$ export PATH=/opt/rtems-4.11/bin:$PATH [chris@weka ~]$ type sparc-rtems4.11-gcc sparc-rtems4.11-gcc is /opt/rtems-4.11/bin/sparc-rtems4.11-gcc
If your tools are not available in the path you will see:
[chris@weka ~]$ type sparc-rtems4.11-gcc sh: type: sparc-rtems4.11-gcc: not found
The directories should contain at least the following:
[chris@weka ~]$ ls /opt/rtems-4.11 bin lib libexec share sparc-rtems4.11 [chris@weka ~]$ ls /opt/rtems-4.11/bin sparc-rtems4.11-addr2line.exe sparc-rtems4.11-cpp.exe sparc-rtems4.11-gcov.exe sparc-rtems4.11-nm.exe sparc-rtems4.11-size.exe sparc-rtems4.11-ar.exe sparc-rtems4.11-elfedit.exe sparc-rtems4.11-gdb.exe sparc-rtems4.11-objcopy.exe sparc-rtems4.11-strings.exe sparc-rtems4.11-as.exe sparc-rtems4.11-g++.exe sparc-rtems4.11-gprof.exe sparc-rtems4.11-objdump.exe sparc-rtems4.11-strip.exe sparc-rtems4.11-c++.exe sparc-rtems4.11-gcc-4.6.2.exe sparc-rtems4.11-ld.bfd.exe sparc-rtems4.11-ranlib.exe sparc-rtems4.11-c++filt.exe sparc-rtems4.11-gcc.exe sparc-rtems4.11-ld.exe sparc-rtems4.11-readelf.exe
Finally in the same MSYS shell ask gcc to provide its details:
[chris@weka ~]$ sparc-rtems4.11-gcc -v --version Using built-in specs. COLLECT_GCC=c:\opt\rtems-4.11\bin\sparc-rtems4.11-gcc.exe COLLECT_LTO_WRAPPER=c:/opt/rtems-4.11/bin/../libexec/gcc/sparc-rtems4.11/4.6.2/lto-wrapper.exe sparc-rtems4.11-gcc.exe (GCC) 4.6.2 20111026 (RTEMS gcc-4.6.2-9.mgw/newlib-1.20.0-4.mgw) Copyright (C) 2011 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Target: sparc-rtems4.11 Configured with: ../gcc-4.6.2/configure --prefix=/opt/rtems-4.11 --bindir=/opt/rtems-4.11/bin --exec_prefix=/opt/rtems-4.11 --includedir=/opt/rtems-4. 11/include --libdir=/opt/rtems-4.11/lib --libexecdir=/opt/rtems-4.11/libexec --mandir=/opt/rtems-4.11/share/man --infodir=/opt/rtems-4.11/share/info - -datadir=/opt/rtems-4.11/share --build=i386-pc-linux-gnu --host=i686-pc-mingw32 --target=sparc-rtems4.11 --disable-libstdcxx-pch --with-gnu-as --with- gnu-ld --verbose --with-newlib --with-system-zlib --disable-nls --without-included-gettext --disable-win32-registry --enable-version-specific-runtime- libs --enable-threads --disable-lto --disable-plugin --enable-newlib-io-c99-formats --enable-newlib-iconv --enable-languages=c,c++ Thread model: rtems gcc version 4.6.2 20111026 (RTEMS gcc-4.6.2-9.mgw/newlib-1.20.0-4.mgw) (GCC) COLLECT_GCC_OPTIONS='-v' '--version' '-mcpu=v7' c:/opt/rtems-4.11/bin/../libexec/gcc/sparc-rtems4.11/4.6.2/cc1.exe -quiet -v -iprefix c:\opt\rtems-4.11\bin\../lib/gcc/sparc-rtems4.11/4.6.2/ help-du mmy -quiet -dumpbase help-dummy -mcpu=v7 -auxbase help-dummy -version --version -o C:\DOCUME~1\chris\LOCALS~1\Temp\ccwIdsUh.s GNU C (GCC) version 4.6.2 20111026 (RTEMS gcc-4.6.2-9.mgw/newlib-1.20.0-4.mgw) (sparc-rtems4.11) compiled by GNU C version 4.6.1 20110627 (Fedora MinGW 4.6.1-3.fc16), GMP version 4.3.2, MPFR version 2.4.2, MPC version 0.8.1 GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 COLLECT_GCC_OPTIONS='-v' '--version' '-mcpu=v7' c:/opt/rtems-4.11/bin/../lib/gcc/sparc-rtems4.11/4.6.2/../../../../sparc-rtems4.11/bin/as.exe -v -s --version -o C:\DOCUME~1\chris\LOCALS~1\Temp\ccsV 8Bb4.o C:\DOCUME~1\chris\LOCALS~1\Temp\ccwIdsUh.s GNU assembler version 2.22 (sparc-rtems4.11) using BFD version (GNU Binutils) 2.22 GNU assembler (GNU Binutils) 2.22 Copyright 2011 Free Software Foundation, Inc. This program is free software; you may redistribute it under the terms of the GNU General Public License version 3 or later. This program has absolutely no warranty. This assembler was configured for a target of `sparc-rtems4.11'. COMPILER_PATH=c:/opt/rtems-4.11/bin/../libexec/gcc/sparc-rtems4.11/4.6.2/;c:/opt/rtems-4.11/bin/../libexec/gcc/;c:/opt/rtems-4.11/bin/../lib/gcc/sparc -rtems4.11/4.6.2/../../../../sparc-rtems4.11/bin/ LIBRARY_PATH=c:/opt/rtems-4.11/bin/../lib/gcc/sparc-rtems4.11/4.6.2/;c:/opt/rtems-4.11/bin/../lib/gcc/;c:/opt/rtems-4.11/bin/../lib/gcc/sparc-rtems4.1 1/4.6.2/../../../../sparc-rtems4.11/lib/ COLLECT_GCC_OPTIONS='-v' '--version' '-mcpu=v7' c:/opt/rtems-4.11/bin/../libexec/gcc/sparc-rtems4.11/4.6.2/collect2.exe --version c:/opt/rtems-4.11/bin/../lib/gcc/sparc-rtems4.11/4.6.2/../../../../ sparc-rtems4.11/lib/crt0.o -Lc:/opt/rtems-4.11/bin/../lib/gcc/sparc-rtems4.11/4.6.2 -Lc:/opt/rtems-4.11/bin/../lib/gcc -Lc:/opt/rtems-4.11/bin/../lib/ gcc/sparc-rtems4.11/4.6.2/../../../../sparc-rtems4.11/lib C:\DOCUME~1\chris\LOCALS~1\Temp\ccsV8Bb4.o -lgcc -lc -lgcc collect2 version 4.6.2 20111026 (RTEMS gcc-4.6.2-9.mgw/newlib-1.20.0-4.mgw) (sparc-elf) c:/opt/rtems-4.11/bin/../lib/gcc/sparc-rtems4.11/4.6.2/../../../../sparc-rtems4.11/bin/ld.exe --version c:/opt/rtems-4.11/bin/../lib/gcc/sparc-rtems4. 11/4.6.2/../../../../sparc-rtems4.11/lib/crt0.o -Lc:/opt/rtems-4.11/bin/../lib/gcc/sparc-rtems4.11/4.6.2 -Lc:/opt/rtems-4.11/bin/../lib/gcc -Lc:/opt/r tems-4.11/bin/../lib/gcc/sparc-rtems4.11/4.6.2/../../../../sparc-rtems4.11/lib C:\DOCUME~1\chris\LOCALS~1\Temp\ccsV8Bb4.o -lgcc -lc -lgcc GNU ld (GNU Binutils) 2.22 Copyright 2011 Free Software Foundation, Inc. This program is free software; you may redistribute it under the terms of the GNU General Public License version 3 or (at your option) a later version. This program has absolutely no warranty.
You should now have a working set of RTEMS tools.
If you wish to work the development version of RTEMS, which currently is 4.11, you will also need the the automake and autoconf packages. These are need to bootstrap the RTEMS source you clone from the master GIT repository.
THIS NEEDS UPDATING. Someone please update ? Thanks Chris.
We will use the RTEMS 4.10.2 release here and assume that all tools from above are installed in their correct version (for this release use the RTEMS-4.10 tools). If you use a GIT version make sure that the Unix to DOS line endings conversion was switched off during the checkout and do not forget the bootstrap.
The build will be done in a Windows command shell (cmd.exe). Execute the following commands within a Windows command shell to build for example the PSIM board support package (the '>' prompt indicates the Windows command shell):
> set PATH=C:\opt\rtems-4.10\bin;C:\MinGW\bin;C:\msys\1.0\bin;%PATH% > tar xjf /c/download/rtems-4.10.2.tar.bz2 > mkdir rtems4.10-build > cd rtems4.10-build > sh ../rtems-4.10.2/configure --target=powerpc-rtems4.10 --enable-rtemsbsp=psim --enable-cxx --enable-tests=samples > make install
Alternatively you can use a MSYS shell (Start > All Programs > MinGW > MSYS > msys). Execute the following commands within a MSYS shell to build for example the PSIM board support package (the '$' prompt indicates the MSYS shell):
$ export PATH="/opt/rtems-4.10/bin:$PATH" $ tar xjf /c/download/rtems-4.10.2.tar.bz2 $ mkdir rtems4.10-build $ cd rtems4.10-build $ ../rtems-4.10.2/configure --target=powerpc-rtems4.10 --enable-rtemsbsp=psim --enable-cxx --enable-tests=samples $ make install
It is recommended to use a fresh build directory for each configuration. See also Building RTEMS.
Installation Root Directory
You can use common root directory for all packages and tools like:
This root directory must not contain any space characters in its path. With a common root directory you have everything that is related to RTEMS in one place and the various packages are not scattered over your Windows root device. Ths installation may then look like this:
Your C:\rtems-mingw\MSYS\etc\fstab should contain this:
C:/rtems-mingw/MinGW /mingw C:/rtems-mingw/opt /opt
The MSYS shell can run the RTEMS configure script. After the installation you can start the MSYS shell via the start menu (Start > All Programs > MinGW > MSYS > msys) or a Desktop icon. It is just like a Unix shell so you need to know some basic Unix commands to use. You can also run configure from a Windows command prompt started with the rtems.bat file by placing sh before the configure command.
The MSYS shell provides a Unix like view to the Windows filesystem. The MSYS shell root directory / is mapped to the MSYS installation location C:\msys\1.0. Windows device characters are mapped from /c/directory/file.txt to C:\directory\file.txt. You can add mount points via the mount command or the C:\msys\1.0\etc\fstab file. The fstab file should contain this:
C:/MinGW /mingw C:/opt /opt
It is advised to set up a home directory that the MSYS shell can use. If you do nothing the MSYS shell will use a default one for your login name. The home directory should not contain any space characters in its path. You can use a global HOME environment variable or edit the MSYS profile.
To edit the MSYS profile open the file C:\msys\1.0\etc\profile with a capable editor and set the HOME variable to the fixed location /c/home (or whatever you want).
Advanced users in a Windows networked environment where home directories are resident on the network can use the user's global HOME environment variable. Make sure that this does not interfere with other programs like Cygwin. For Windows 2000 and Windows XP open the System icon on the Control Panel, select the Advanced tab then the Environment Variables button. Add a New environment variable for your login called HOME and point it to the home directory you wish to use. If you use this method to set a home directory you do not need to change MSYS's profile.
Space characters in the install paths or the home directory may cause problems. You should avoid them.
Do not use the Unix to DOS line ending conversion for CVS checkouts.
If you have trouble with MSYS when building RTEMS check what virus or spyware detection software you have. The PC Tools Spyware Doctor has been giving someone problems. The machine loses all resources. Turing off Spyware Doctor does not help, it had to be uninstalled.
If you experience, that the shell crashes sometimes, resulting in a stack dump, you might want to check whether you have a Logitech webcam (or similar) installed on your system. Killing the process lvprcsrv.exe in the Windows Task Manager might help in these situations.
Compiling in Emacs
You can use Emacs on Windows to compile RTEMS or your application and use it to track the error messages. To compile enter M-x compile then type
C:/rtems-mingw/opt/rtems-4.9/sh-run.bat make -C C:/rtems-mingw/home/build-rtems-4.9.1
If you are using RTEMS with these tools on Windows you may find the RealTerm program useful when connecting to the console of your target.