Miosix Toolchain: Difference between revisions

From Miosix Wiki
Jump to navigation Jump to search
No edit summary
(Added links to 9.2.0 compiler)
Line 2: Line 2:
== Information on the Miosix Toolchain ==
== Information on the Miosix Toolchain ==


The Miosix Toolchain is a patched version of the [https://gcc.gnu.org GCC] compiler, [https://www.sourceware.org/newlib Newlib] C library, and libstdc++ library. The main purpose of the Miosix-specific patches to the compiler and standard libraries is to provide thread safety of the C and C++ language and libraries by teaching GCC the Miosix thread model. Additional goals of these patches are to improve speed of certain library functions and reduce code size.
The Miosix Toolchain is a 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:


The use of the patched compiler is mandatory for compiling Miosix. The compiler patches are updated from time to time, and users are required to upgrade to the latest version of the compiler when necessary. The build system will warn you when it's time to upgrade the compiler.
* Provide thread safety. Cooperation between the compiler and kernel is needed to make certain C/C++ standard library functions and certain C++ language constructs thread safe. For example throwing C++ exception, constructors of static objects, accessing the same FILE * handle from more threads. This cannot be done by the kernel alone and is the primary motivation for the patches.
* Improved speed of the pthread and C++11 thread APIs. For example, by modifying Newlib so that pthread_mutex_t is not a generic opaque pointer but the real struct containing the mutex implementation, a 7x speedup can be achieved for mutexes.
* Code size and RAM requirement reductions, such as reducing the size of large buffers found in the C stdio library.
 
Some of the patches have been contributed upstream, but to date compiling Miosix still requires patches. Patches are updated from time to time, and users are required to upgrade to the latest version of the compiler when necessary. The build system will warn you when it's time to upgrade the compiler.


== Latest version of the Miosix Toolchain ==
== Latest version of the Miosix Toolchain ==


Released '''08/06/2014'''. This version adds ''sys/ioctl.h'' and ''sys/termios.h'' to the C library. It is a mandatory release, newer kernels won't build with previous compiler. There are no bug fixes.
Released '''August 12th, 2020'''. This version:
* upgrades GCC to 9.2.0
* supports the C++11 thread API in Miosix (before only the POSIX one was supported)
* supports C++14
* reduces code size of printf-related functions
* provides many improvements and bug fixes to Miosix userspace processes
* provides more comprehensive atomic operation support through GCC's libatomic


_MIOSIX_GCC_PATCH_VERSION is set to 1 in this release.
_MIOSIX_GCC_PATCH_MAJOR is set to 3, and _MIOSIX_GCC_PATCH_MINOR is set to 1 in this release.


You can download it here
You can download it here
* [https://miosix.org/toolchain/MiosixToolchainInstaller.run Miosix Toolchain Linux] (sha1sum 6952ce2106e5a6f830a250b9b384e8dba0fe4100) This is self-installing shell script, run it with  
* [https://miosix.org/toolchain/MiosixToolchainInstaller9.2.0mp3.1.run Miosix Toolchain Linux] (sha1sum 061ec4bb98a83c5529f9fb1a7aea650838fcf94f) This is self-installing shell script, run it with  
<source lang="bash">sh MiosixToolchainInstaller.run</source>
<source lang="bash">sh MiosixToolchainInstaller.run</source>
* [https://miosix.org/toolchain/MiosixToolchainInstaller.exe Miosix Toolchain Windows] (sha1sum 9750cef4593c5eb5df8fc497cdd888d33f1e006d) This is a self-installing .exe
* [https://miosix.org/toolchain/MiosixToolchainInstaller9.2.0mp3.1.exe Miosix Toolchain Windows] (sha1sum a1277181d1a46c09f012299c5583317bf733c6d1) 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.
Both versions will automatically detect a previous version of the compiler and uninstall it.


== Previous version of the Miosix Toolchain ==
== Previous version of the Miosix Toolchain ==


Released '''06/04/2014.''' This is the first version of the Miosix Toolchain available as a binary self-installing package.
Released '''June 8th, 2014'''. This version adds ''sys/ioctl.h'' and ''sys/termios.h'' to the C library. It is a mandatory release, newer kernels won't build with previous compiler. There are no bug fixes.


_MIOSIX_GCC_PATCH_VERSION is not defined in this release.
_MIOSIX_GCC_PATCH_VERSION is set to 1 in this release.


You can download it here
You can download it here
* [https://miosix.org/toolchain/v0/MiosixToolchainInstaller.run Miosix Toolchain Linux] (sha1sum 359878b78f2c462f0ce1d207b837d2313968b443) This is self-installing shell script.
* [https://miosix.org/toolchain/MiosixToolchainInstaller.run Miosix Toolchain Linux] (sha1sum 6952ce2106e5a6f830a250b9b384e8dba0fe4100) This is self-installing shell script, run it with
* [https://miosix.org/toolchain/v0/MiosixToolchainInstaller.exe Miosix Toolchain Windows] (sha1sum a62cb3fa628f6ca47f1c8e248c0cf24d41bc28aa) This is a self-installing .exe
<source lang="bash">sh MiosixToolchainInstaller.run</source>
 
* [https://miosix.org/toolchain/MiosixToolchainInstaller.exe Miosix Toolchain Windows] (sha1sum 9750cef4593c5eb5df8fc497cdd888d33f1e006d) This is a self-installing .exe
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.
 


[[Category:Installation and Configuration]]
[[Category:Installation and Configuration]]

Revision as of 12:15, 12 August 2020

Information on the Miosix Toolchain

The Miosix Toolchain is a 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. Cooperation between the compiler and kernel is needed to make certain C/C++ standard library functions and certain C++ language constructs thread safe. For example throwing C++ exception, constructors of static objects, accessing the same FILE * handle from more threads. This cannot be done by the kernel alone and is the primary motivation for the patches.
  • Improved speed of the pthread and C++11 thread APIs. For example, by modifying Newlib so that pthread_mutex_t is not a generic opaque pointer but the real struct containing the mutex implementation, a 7x speedup can be achieved for mutexes.
  • Code size and RAM requirement reductions, such as reducing the size of large buffers found in the C stdio library.

Some of the patches have been contributed upstream, but to date compiling Miosix still requires patches. Patches are updated from time to time, and users are required to upgrade to the latest version of the compiler when necessary. The build system will warn you when it's time to upgrade the compiler.

Latest version of the Miosix Toolchain

Released August 12th, 2020. This version:

  • upgrades GCC to 9.2.0
  • supports the C++11 thread API in Miosix (before only the POSIX one was supported)
  • supports C++14
  • reduces code size of printf-related functions
  • provides many improvements and bug fixes to Miosix userspace processes
  • provides more comprehensive atomic operation support through GCC's libatomic

_MIOSIX_GCC_PATCH_MAJOR is set to 3, and _MIOSIX_GCC_PATCH_MINOR is set to 1 in this release.

You can download it here

  • Miosix Toolchain Linux (sha1sum 061ec4bb98a83c5529f9fb1a7aea650838fcf94f) This is self-installing shell script, run it with
sh MiosixToolchainInstaller.run

Both versions will automatically detect a previous version of the compiler and uninstall it.

Previous version of the Miosix Toolchain

Released June 8th, 2014. This version adds sys/ioctl.h and sys/termios.h to the C library. It is a mandatory release, newer kernels won't build with previous compiler. There are no bug fixes.

_MIOSIX_GCC_PATCH_VERSION is set to 1 in this release.

You can download it here

  • Miosix Toolchain Linux (sha1sum 6952ce2106e5a6f830a250b9b384e8dba0fe4100) This is self-installing shell script, run it with
sh MiosixToolchainInstaller.run