"Free-ish" Toolchain for STM32 Discovery Board

Thursday, January 26, 2012

STM32 Discovery boards are great value for us hobbyists. As far as I know the VL variant of the board is by far the least expensive ARM Cortex-Mx development boards. On top of that, the board comes with fully functional ST-Link that can be used to program other boards. In essence, for under $20 shipped we get a capable programmer/debugger that is not locked into any one toolchain in addition to a killer microcontroller (a single Atmega2560 will cost about as much). The catch is that ST doesn't provide a completely free toolchain, and professional tools cost many thousands of dollars, therefore we have two options: either spend hours trying to set up Eclipse to work with GNU ARM etc. and use ST-Link software for uploading, or use one of the limited commercial versions.

I was able to get the Eclipse/Sourcery G++ approach working fairly well for development, but since ST-Link is not OpenOCD compatible. I've seen people using proprietary debug servers, such as one that ships with Atollic TrueSTUDIO etc. I'm not entirely sure this is even legal, but it definitely violates the spirit of the EULA of those packages, so I'm not going there.

The other option is to use a "lite" version of one of the commercial packages. There are a few to choose from, depending on your preference:

  • KEIL MDK-ARM is a "development kit" that includes a code size limited compiler, KEIL's uVision IDE and other goodies. The Lite version comes with a full featured C/C++ compiler limited to 32KB code size and some libraries removed. KEIL has a detailed product comparison here. Overall, this is a nice, but a bit archaic, toolchain used all over the industry. 
  • IAR Embedded Workbench for ARM - another industry heavy-weight that offers a 32KB code Limited Version. I've used IAR KickStart edition with MSP430, and it works very well. It's actually very similar in features to KEIL, but in my experience KEIL seems to have better/more code examples etc.
  • Atollic TrueSTUDIO Lite is an Eclipse-based toolchain. Even though there is no code size limit, the Lite version doesn't offer a C++ compiler, has one breakpoint limit, has some usage requirements and an annoying "Buy now" nag box that pops at random times. More details can be read in their Feature Comparison Guide
  • Rowley CrossWorks isn't free, but at $150 for a "personal use" license it's at least very cost effective. I've used the trial version and was overal very please with it. The compiler produces very nice code and overall things work very well. The only negative thing I can say about it is the lack of auto-complete feature. 


Ideally, I'd like to have working GNU toolchain, but the setups I've seen are far from prefect when it comes to STM32 Discovery boards. The selection between "Lite" version depends on your preferences etc. KEIL and AIR are mature toolchains with very capable compilers, and 32KB of code is generally enough. On the flip side, even inexpensive MCUs offer Flash sizes many times larger than 32KB, and when the time comes, you will be converting your project to some other toolchain or racing the clock against 30 day trial period expiration of a commercial version. Atollic TrueSTUDIO doesn't have the code size limit. The requirement to promote Atollic in the code and end-suer manuals when you use the Lite versin, the "Buy Me" nag box and single breakpoint limit are definitely annoyances. If you preffer C++, the lack of a C++ compiler is definitely a show stopper. Finally, Rowley CrossWorks personal license is a good choice if you intend to do only hobby projects and can afford to spend $150.

For the tutorials I intend to use Atollic TrueSTUDIO. Even though the lite version has some serious drawbacks, the ease of installation and no code size limit make it the most appealing "free" C compiler for the hobby usage. Additionally, the fact that it's based on Eclipse makes the learning a bit easier for those of use familiar with Eclipse. My second choice would definitely be the CrossWorks. The main reason I'm not using it is the lack of auto-complete (yes, I know, I'm spoiled by Eclipse and Visual Studio, but come on... it's 2012...).

Side Note

KEIL, IAR provide steep discounts for educations licenses for students. KEIL quoted $500 for a academic license of their full-blown ARM-KDE version and AIR's quote was between $360 and $500, depending on the version. Rowley offers their CrossWorks for academic use for $300 (the license is more permissive than the personal one).
Finally, I simply have to mention that Rowley has absolutely phenomenal customer service. I received response to my emails within hours, and the responses were very helpful.


  1. Atollic is now code size limitted :(

  2. Atollic is GNU toolcahin so how can it be limited code? At least not on compiling and linking

  3. Atollic uses their own version of the GNU toolchain. Since it is open source they can modify it or they can make their own linker (ld) which is the process that checks the final applicationsize.