FreeRTOS on STM32

A high-density line of STM32 microcontrollers has quite a bunch of features that can be used in user programs. The more features you add to source the more complicated program becomes and this way it starts to be difficult to keep up with all things. Using an only main loop and interrupts becomes a time-consuming task to manage. If you don’t want to struggle in tuning things up manually, you can use one of much real-time operating systems (RTOS). They are great when you need lots of separate functions to run in parallel so no task would be missed. RTOS scheduler takes care of giving each task a decent time to perform. There are lots of great RTOS systems around. Many of them are free and opensource. It happens so that I love using FreeRTOS which has a quite long history and is flexible enough to fit multiple types of…

Continue reading

Connecting STM32 USART to standard I/O streams in GCC

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…

Continue reading