wiki:TBR/UserManual/MinGW_Tools_for_Windows

Version 69 (modified by ChrisJohns, on Feb 22, 2012 at 12:46:34 PM) (diff)

Show tar.bz2 installing.

MinGW Tools for Windows



<center>RTEMS Tools Installer (Current Release: 4.9 Build 5)</center> <center>Previous and Test Releases</center>



Introduction

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.

Target User

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.

Base Installation

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:

*http://sourceforge.net/projects/mingw/files/Installer/mingw-get-inst/

If there are problems with the above links or to check for other MinGW packages, visit the MinGW Download Site which should refer you to the MinGW Sourceforge Files page.

RTEMS Tools Installation

The built tools for RTEMS 4.11 can be found here:

*http://www.rtems.org/ftp/pub/rtems/mingw32/4.11/

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:

*http://www.rtems.org/ftp/pub/rtems/mingw32/4.11/rtems-4.11-sparc-rtems4.11-binutils/ *http://www.rtems.org/ftp/pub/rtems/mingw32/4.11/rtems-4.11-sparc-rtems4.11-gcc/ *http://www.rtems.org/ftp/pub/rtems/mingw32/4.11/rtems-4.11-sparc-rtems4.11-gdb/

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.

Installation

Follow the instructions of the installer to download and install the RTEMS Tools. You may deselect the subpackages that you do not need. For all settings the default values from the installer are suitable. If you have problems with the Autoconf and Automake subpackage installation see above to the MSYS - M4 section. After the installation check the file <tt>C:\msys\1.0\etc\fstab</tt> if it is suitable for you, see also MSYS Shell. In case of trouble you may have a look at the RTEMS Tools Installation Guide.

Update

Remove all currently installed builds of the corresponding RTEMS release with the uninstaller and install the new build afterwards.

RTEMS Build

We will use the RTEMS 4.9.1 release here and assume that all tools from above are installed. If you use a CVS 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.9\bin;C:\MinGW\bin;C:\msys\1.0\bin;%PATH% tar xjf /c/download/rtems-4.9.1.tar.bz2 mkdir rtems-4.9.1-psim cd rtems-4.9.1-psim sh ../rtems-4.9.1/configure --target=powerpc-rtems4.9 --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.9/bin:$PATH" $ tar xjf /c/download/rtems-4.9.1.tar.bz2 $ mkdir rtems-4.9.1-psim $ cd rtems-4.9.1-psim $ ../rtems-4.9.1/configure --target=powerpc-rtems4.9 --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.

Advanced Users

Installation Root Directory

You can use common root directory for all packages and tools like:

<center><tt>C:\rtems-mingw</tt></center>

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:

*<tt>C:\rtems-mingw\MinGW</tt> *<tt>C:\rtems-mingw\MSYS</tt> *<tt>C:\rtems-mingw\opt\rtems-4.9</tt>

Your <tt>C:\rtems-mingw\MSYS\etc\fstab</tt> should contain this:

C:/rtems-mingw/MinGW /mingw C:/rtems-mingw/opt /opt

MSYS Shell

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 <tt>configure</tt> from a Windows command prompt started with the <tt>rtems.bat</tt> file by placing <tt>sh</tt> before the <tt>configure</tt> command.

The MSYS shell provides a Unix like view to the Windows filesystem. The MSYS shell root directory <tt>/</tt> is mapped to the MSYS installation location <tt>C:\msys\1.0</tt>. Windows device characters are mapped from <tt>/c/directory/file.txt</tt> to <tt>C:\directory\file.txt</tt>. You can add mount points via the <tt>mount</tt> command or the <tt>C:\msys\1.0\etc\fstab</tt> file. The <tt>fstab</tt> 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 <tt>HOME</tt> environment variable or edit the MSYS profile.

To edit the MSYS profile open the file <tt>C:\msys\1.0\etc\profile</tt> with a capable editor and set the <tt>HOME</tt> variable to the fixed location <tt>/c/home</tt> (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 <tt>HOME</tt> 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 <tt>HOME</tt> 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.

Miscellaneous

Trouble Shooting

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 <tt>lvprcsrv.exe</tt> in the Windows Task Manager might help in these situations.

If you encounter an error like this

Couldn't reserve space for cygwin's heap, Win32 error 6

try to use a 1.0.11 version of the MSYS DLL and base files.

An outdated version of M4 causes a problem during the RTEMS Autotools installation. You notices this if a window like this pops up: <center>No image "msys-m4.jpg" attached to TBR/UserManual/MinGW_Tools_for_Windows</center> Pressing any key will continue but the installation of the Autotools will not be correct. You should exit the installer and install the required M4 program, see also MSYS - M4.

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 <tt>M-x compile</tt> then type

C:/rtems-mingw/opt/rtems-4.9/sh-run.bat make -C C:/rtems-mingw/home/build-rtems-4.9.1

Terminal Software

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.

RTEMS Tools License and Sources

The source code for the tools is licensed under the GNU GPL and can be found in a source directory under each of the installer builds. The installers and tools are built and packaged on a current Linux Fedora computer and the scripts are all provided in the RTEMS source code. Instructions on using the scripts can be found in Building MinGW Tools?.