I have had some progress with development on the ARM Cortex-M3 STM32F103R8T6 MINI STM32 Development Board, aka “Cortex Study Board” by LC STUDIO. The simple blinking LED project was a breakthrough for my self education but I want a much more capable platform than a simplistic loop. Although I tested Nuttx, it is really to large for the STM32F103R8T6’s somewhat limited memory (128 Kbytes of Flash memory and 20 Kbytes of SRAM). I turned to FreeRTOS, which has a much smaller footprint. This unstripped demo, for example, occupies 39,896 of code space and 2,296 of data (not counting stack).
Finding an existing project that would compile turned out to be challenging. Virtually every web-available STM32 FreeRTOS project is (1) written for STMicroelectronics STM32VLDISCOVERY board; (2) written for Microsoft Windows; (3) is designed for use within Eclipse. I use only Linux, have an LC STUDIO board instead of the STM32VLDISCOVERY and, while I do have eclipse installed, I want to use a traditional Makefile for my ARM development.
After much searching and trial and error with other posted projects I came across a FreeRTOS demo project by ‘Yus of the Philippines that was configured specifically for the STM32F103R8 cpu and the I/O configuration even matched that of the LC STUDIO board. Alas, it too would not compile. However, this time the error was obvious and fixable. The FreeRTOS code was trying to link to a standard library call “getpid()” that simply does not exist in the STM Standard Peripherial Library. Some additional web searching found a cure. Geoffrey Brown a Professor of Computer Science at Indiana University authored an excellent manual titled “Discovering the STM32 Microcontroller” that appears to be the origin or, at least the inspiration, for the solution that is on a Google site by “nano-age.co.uk”. He posts a file named “newlib_stubs.c” that, when placed in my FreeRTOS demo project folder, linked 100% and produced a usable demo of FreeRTOS running on the LC STUDIO board. Professor Geoffrey Brown also hosts a useful gtihub at https://github.com/geoffreymbrown.
I made a little YouTube that explains the FreeRTOS demo. You can view it at THIS-LINK. While very simple, the demo has four independent processes running. If you would like the code for this project, click the ‘Yus and nano-age links above.