Miosix Toolchain: Difference between revisions

From Miosix Wiki
Jump to navigation Jump to search
(Created page with "The Miosix Toolchain is a specially patched version of the [https://gcc.gnu.org GCC] compiler, [https://www.sourceware.org/newlib Newlib] C library, and libstdc++ library. Th...")
 
No edit summary
Line 1: Line 1:
The Miosix Toolchain is a specially patched version of the [https://gcc.gnu.org GCC] compiler, [https://www.sourceware.org/newlib Newlib] C library, and libstdc++ library.


The patches to the compiler and standard libraries are required to:
== Latest version of the Miosix Toolchain ==
 
You can download the latest version of the Miosix Toolchain here
* [http://miosix.org/toolchain/MiosixToolchainInstaller.run Miosix Toolchain Linux] This is self-installing shell script, run ii with
<source lang="bash">sh MiosixToolchainInstaller.run</source>
* [http://miosix.org/toolchain/MiosixToolchainInstaller.exe Miosix Toolchain Windows] This is a self-installing .exe
Both versions will automatically detect a previous version of the compiler and uninstall it, unless you are on Linux and you have installed the toolchain from sources. In such a case you should uninstall it manually using the ''uninstall.sh'' file in the ''miosix/_tools/compiler'' directory of the kernel git repository.
 
== Information on the Miosix Toolchain ==
 
The Miosix Toolchain is a specially patched version of the [https://gcc.gnu.org GCC] compiler, [https://www.sourceware.org/newlib Newlib] C library, and libstdc++ library. The patches to the compiler and standard libraries are required to:


* Provide thread safety of the C and C++ libraries. A lot of potential race conditions that occur when GCC is built for an embedded platform (i.e: not to produce binaries for a mainstream OS such as Linux or Windows where thread safety issues are already dealt with) have been fixed, for exemple throwing C++ exception from more threads at the same time is now thread safe, constructors of static objects are now thread safe, accessing the same FILE * handle from more threads is now thread safe... This cannot be done by the compiler alone, nor by the kernel alone, cooperation of the two is required, and this is the number one reason for having patches.
* Provide thread safety of the C and C++ libraries. A lot of potential race conditions that occur when GCC is built for an embedded platform (i.e: not to produce binaries for a mainstream OS such as Linux or Windows where thread safety issues are already dealt with) have been fixed, for exemple throwing C++ exception from more threads at the same time is now thread safe, constructors of static objects are now thread safe, accessing the same FILE * handle from more threads is now thread safe... This cannot be done by the compiler alone, nor by the kernel alone, cooperation of the two is required, and this is the number one reason for having patches.
Line 12: Line 21:


Also, due to the effort to achieve more POSIX compliance in Miosix 2.0, the compiler patches are updated from time to time, and users are required to upgrade to the latest version of the compiler when necessary.
Also, due to the effort to achieve more POSIX compliance in Miosix 2.0, the compiler patches are updated from time to time, and users are required to upgrade to the latest version of the compiler when necessary.
== Latest compiler ==

Revision as of 08:52, 8 June 2014

Latest version of the Miosix Toolchain

You can download the latest version of the Miosix Toolchain here

sh MiosixToolchainInstaller.run

Both versions will automatically detect a previous version of the compiler and uninstall it, unless you are on Linux and you have installed the toolchain from sources. In such a case you should uninstall it manually using the uninstall.sh file in the miosix/_tools/compiler directory of the kernel git repository.

Information on the Miosix Toolchain

The Miosix Toolchain is a specially patched version of the GCC compiler, Newlib C library, and libstdc++ library. The patches to the compiler and standard libraries are required to:

  • Provide thread safety of the C and C++ libraries. A lot of potential race conditions that occur when GCC is built for an embedded platform (i.e: not to produce binaries for a mainstream OS such as Linux or Windows where thread safety issues are already dealt with) have been fixed, for exemple throwing C++ exception from more threads at the same time is now thread safe, constructors of static objects are now thread safe, accessing the same FILE * handle from more threads is now thread safe... This cannot be done by the compiler alone, nor by the kernel alone, cooperation of the two is required, and this is the number one reason for having patches.
  • Improved speed of the pthread API. For example, pthread_mutex_t is no longer an opaque pointer type but the real struct containing the mutex implementation. This results in a 7x speed increase with respect to the previous pthread_mutex code.
  • Some more code size and RAM requirement reductions, such as the redefinition of BUFSIZ from 1024 to 256 bytes which reduces the RAM used by the C stdio library.

Some of the patches, mainly those that increase performance and reduce code size in Newlib have also been contributed upstream, but to date compiling Miosix still requires patches.

In previous versions of the kernel, the user was required to download the compiler sources, patch it and compile it. Even though this was automated through a simple script, it took a long time to build the compiler, especially for older machines, and it was cumbersome to say the least to do it on Windows. Starting from Miosix 2.0, the compiler is also distributed as a self-installing precompiled package, for both Linux and Windows.

Also, due to the effort to achieve more POSIX compliance in Miosix 2.0, the compiler patches are updated from time to time, and users are required to upgrade to the latest version of the compiler when necessary.