= MinGW Tools for Windows = [[TOC(TBR/UserManual/MinGW_Tools_for_Windows, depth=2)]] = Introduction = Windows users can use [http://www.mingw.org 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 [wiki:#Advanced_Users 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 [http://mingw.org/wiki/Getting_Started MinGW Getting Started Guide] will step you through installing MinGW and MSYS. Open the [http://mingw.org/wiki/Getting_Started 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 [http://www.mingw.org/download.shtml MinGW Download Site] which should refer you to the [http://sourceforge.net/project/showfiles.php?group_id=2435 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. 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 }}} You should now have a working set of RTEMS tools. = RTEMS Build = THIS NEEDS UPDATING. Someone please update ? Thanks Chris. We will use the [http://www.rtems.org/ftp/pub/rtems/4.10.2/rtems-4.10.2.tar.bz2 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 [wiki:Building/RTEMS Building RTEMS]. = Advanced Users = = Installation Root Directory = You can use common root directory for all packages and tools like:
C:\rtems-mingw
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: *C:\rtems-mingw\MinGW *C:\rtems-mingw\MSYS *C:\rtems-mingw\opt\rtems-4.9 Your C:\rtems-mingw\MSYS\etc\fstab 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 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. = 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 lvprcsrv.exe in the ''Windows Task Manager'' might help in these situations. = Compiling in Emacs = You can use [http://www.gnu.org/software/emacs/windows/faq2.html 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 = Terminal Software = If you are using RTEMS with these tools on Windows you may find the [http://realterm.sourceforge.net 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 [[BuildingMingwTools|Building MinGW Tools]].