STM32FreeRTOS STM32duino won't build

I am getting hundreds of errors trying to build the ‘frBlink.ino’ example. I installed the ‘STM32FreeRTOS’ library and created a new project then cut and pasted the example code to ‘main.cpp’. I get so many errors trying to build it that I can’t scroll back to the beginning of the log. Lots of ‘template’ errors.

I’ve reduced ‘main.cpp’ so that it essentially only contains this ‘SemaphoreHandle_t sem;’ and it blows up.

One of the error msgs.:

with C linkage
   template<typename _Tp>
c:\users\jhe\.platformio\packages\toolchain-gccarmnoneeabi\arm-none-eabi\include\c++\7.2.1\bits\refwrap.h:353:3: error: template
with C linkage

----------------------------- platformio.ini ----------

platform = ststm32
board = bluepill_f103c8_128k
framework = Arduino

.ino files are not .cpp files. See FAQ for converting.

After pasting the code to a .cpp file and writing #include <Arduino.h> at the top as the FAQ says, I can compile without any problems

Compiling .pio\build\bluepill_f103c8_128k\src\main.cpp.o
Linking .pio\build\bluepill_f103c8_128k\firmware.elf
Building .pio\build\bluepill_f103c8_128k\firmware.bin
Checking size .pio\build\bluepill_f103c8_128k\firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [=         ]   6.3% (used 1288 bytes from 20480 bytes)
Flash: [==        ]  15.6% (used 20488 bytes from 131072 bytes)
========================= [SUCCESS] Took 5.32 seconds =========================

Can you confirm that for you too?

1 Like

OMG! Thanks so much.

I needed to ‘#include <Arduino.h>’ before ‘#include <STM32FreeRTOS.h>’.

Somewhere, probably not in the ‘STM32duino’ context I had read ‘#include <STM32FreeRTOS.h>’ had to be the first include.

Thanks so much for your support maxgerhardt.

1 Like

I’m still having a problem with the frBlink code. ‘vTaskDelay()’ does not execute and return. I added print statements before and after to verify. I tried the same code in the Arduino 1.8.12 IDE and it works as expected. Tried a couple things on this site, but no solution. Any help is appreciated.

BTW I’m using the BluePill board.

I’m going to open this as a new issue. I should not have added it to this thread.

When I initiate a new st stm32 Arduino (arduinostm32) project I see CMSIS/ RTOS library in the includes folder; is it not possible to use this CMSIS/RTOS library and hopefully CMSIS/DSP NN … libraries as well instead of installing the STM32FeeRTOS? (perhaps this is required to use the CMSIS/RTOS !?)

If you want the Arudino STM32 core to change its RTOS implementation / make it selectable, an issue at GitHub - stm32duino/Arduino_Core_STM32: STM32 core support for Arduino / GitHub - rogerclarkmelbourne/Arduino_STM32: Arduino STM32. Hardware files to support STM32 boards, on Arduino IDE 1.8.x including LeafLabs Maple and other generic STM32F103 boards should be opened (which-ever core you meant).

If you just want to use CMSIS libraries… why not use the PlatformIO provided cmsis framework? Has all you need.

See blinky example at platform-ststm32/examples/cmsis-blink at master · platformio/platform-ststm32 · GitHub, you can work from there.

Hi @maxgerhardt

Thank you for your kind answer. Yes I can chose CMSIS framework if I work with arm-cortex however I want to stay with Arduino core as long as it is possible (because I work with other platforms as well such as esp32 esp8266 and Arduino framework is more common and has strong support, examples, libraries etc…)

I just wanted to learn is it possible to use the existing CMSIS libraries staying in front of me in the project tree of my stm32 project with Arduino framework, and to learn how, if it is possible.

Kind regards,
EDIT: I found this

  1. ARM CMSIS module for Arduino IDE
  2. stm32duino CMSIS/DSP API reference
    but didn’t try yet