In many situations when working with STM32 microcontrollers, you will want to output text strings. There is no need to write specialized functions that output specially formatted strings as it is hard to keep up with various cases. It is convenient to use standard I/O streams and its library functions that allows sending formatted data streams. Arm GCC toolchain comes with newlib C library from Redhat, and so it isn’t specially designed for embedded toolchain. To use stdio functions we have to take care of several syscals so-called “stub functions.” These functions usually are provided by operating systems like you would write C programs in Windows or Linux. In our case, we aren’t using any OS, os to avoid error messages while compiling we have to provide these function declarations where most of them are dummy implementations. It’s not something new pick one that you find on the internet. I noticed that it was written for STM32 Discovery.
I found some time to play with the STM32F103ZET6 development board and decided to set up a simple project for it. Probably the trickiest part of this is to set up a project environment that would serve as a template for following developments. Many ARM developers chose CodeSourcery Lite edition toolchain. It has full command line functionality – this is what we usually need. If you want some alternative – you can select gnu yagarto ARM toolchain which is also great and free. No matter which tool you select code will work on both. Let’s stick to CodeSourcery. Just download it and install to your PC. As we said Lite version supports only command line tools – we need an interface for it. Eclipse IDE is one of the favorite choices so that we will grab this one too. Yagarto website has an excellent tutorial on how to set up the Eclipse IDE in a step-by-step manner. We won’t go into details with this.