The SEGGER Compiler

At SEGGER, we use our own tools to establish an internal feedback loop. This is extremely helpful in creating and fine-tuning our products. A significant amount of engineering time and effort is put into making our IDE Embedded Studio better and better, every day. Embedded Studio is easy to download and install, cross-platform, very fast, and is available under SEGGER’s Friendly Licensing. Its growing popularity is well deserved.

It is much more than just another GCC toolchain.
There is a lot in the box:

  • Ready-to-run GCC and LLVM/Clang cross-compiler
  • The SEGGER Runtime Library and Floating-Point Library, replacing GLibC or Newlib
  • The SEGGER Linker which lifts the limitations of the GNU Linker
  • The SEGGER Assembler in addition to the GNU and Clang Assemblers
  • Versatile project management with version control integration
  • Support packages and flash programming algorithms for most popular microcontrollers
  • Our dedicated and tightly integrated debugger
  • Direct support for J-Link, J-Trace and DAP-Links, as well other probes using the GDB Protocol

and much more.

Having everything in an easily downloadable package, fully integrated, and ready-to-use, makes things easy.

The Missing Piece

We felt there was one thing we should add: Our own compiler.

Although the included compilers, GCC and Clang, are well proven and widely used, it would be nice to have full control over the compiler, to maintain, tailor, and optimize it.

There were basically three options available to get there:

  • Build from scratch
  • Build based on GCC
  • Build based on Clang/LLVM

We do have the expertise to design a compiler from scratch. Paul has written multiple compilers in his career. But he did not want to do it again .
To write a compiler from scratch and make it is as good as GCC or Clang is a lot of work. Both Clang and GCC have very advanced front ends, translating the source code into an intermediate representation (IR), and both generate excellent code.

Clang has the more modern design and is in general considered to be more advanced than GCC. In addition to that, Clang is under a more permissive license which permits making a commercially-available derivative. ARM / Keil derived a compiler from Clang, discontinuing development of their previous proprietary compiler. Considering all of this, we decided to look closer at Clang, with a goal of using it to create our own compiler.
We started to work on this last year. As we expected, it was challenging, but once familiar with Clang, we found this to be a good plan.

First, we focused on improving the size and the performance of the generated code. The results of the benchmarks we are running are promising. Our compiler clearly beats the “plain vanilla Clang” not only in speed, but most of all also in code size, as well as GCC by most measures. It is up to par with commercial compilers we compare to.

Coming soon!

For now, we have been focusing on changes in the code generator for ARM’s Thumb-2 code, targeting Cortex-M based microcontrollers.
Next steps will include improved compatibility with other compilers, not just GCC & Clang, (for pragmas and other specialties) to make it easy to switch.

A beta version is already included in the latest version of Embedded Studio for ARM. The official release is planned for some time in Q1 of this year.

Being a part of Embedded Studio, the SEGGER Compiler can be used under the terms of SEGGER’s Friendly Licensing, which allows anybody to use it free-of-charge for non-commercial use and evaluation.

With our new compiler, we are proud to make one more top-notch tool available to everyone!

More to come, stay tuned, and please feel free to download Embedded Studio and test the compiler yourself. Feedback is always welcome.