0

I'm about to start my first STM32 project. (I have previously used atmega MCUs, and have decades of experience with C, mostly server-side.)

There seem to be three choices, given that I want to develop on the command-line in Linux, using make.

  1. an STM32CubeMX generated makefile project,
  2. an STM32CubeMX generated makefile project, including FreeRTOS, or
  3. a makefile project using libopencm3.

The application will process and send messages on 4 or more serial ports, using different protocols. Occasionally GPIOs will be set or cleared.

My questions are:

  • Why does libopencm3 exist? Why would someone choose it over an STM32CubeMX-generated makefile project.
  • Is learning FreeRTOS worthwhile for such a project?
fadedbee
  • 42,671
  • 44
  • 178
  • 308

2 Answers2

4

There are no good free project generation tools that I know. I worked mostly with STM32CubeMX and I can tell you that it's surely useful (expecially for novices) but long from being something you can trust on. I found lots of bugs in it in the years, some has been fixed, others are still in there. IMHO, in general, you should use code generator tool with care better as a training instrument maybe taking snippets of code out of them.

I've used FreeRTOS a lot and I can tell you I feel good with it. Maybe it's not good as as a commercial grade product but surely it's well documented and easy to handle. Haven't had any problem with it.

Damiano
  • 698
  • 7
  • 19
  • Thanks that's really useful. – fadedbee Dec 19 '19 at 09:30
  • @Damiano since you have an idea about FreeRTOS. Could HAL functions be used in FreeRTOS as well? if not what are the alternatives? – unkown53 Nov 04 '20 at 17:54
  • You can use HAL function in freertos afaik. There are also some middleware from st (like the shitty usb stack that support freertos directly) and freertos is supporte also in cubemx project configurator. Just remember the rules about calling rtos function within isr callbacks: Quickly: Only _isr postfix function and only if the interrupt priority is lower than `configMAX_SYSCALL_INTERRUPT_PRIORITY` – Damiano Nov 10 '20 at 13:36
1

libopencm3 is an alternative to the STM32 HAL and CMSIS (discontinued). I have no experience with it but the HAL is quite useful.

FreeRTOS is great for creating programs with multiple processes which need to share resources in a time critical manner. It isn't necessary always but could be used in less demanding situations.

STM32CubeMX is, as damiano noted, useful but not something to depend on. It is best in my experience to create a base project in STM32CubeMX and then to disconnect it from the project. You then further add the HAL libraries you need manually and keep most of the real initialization and configuration in your own hands. I will however use it to create examples of how to initialize certain peripherals and libraries to then port it over to my own project.

Tarick Welling
  • 3,119
  • 3
  • 19
  • 44