Start Eclipse and go to File->New->C Project and select “Hello World ARM Cortex-M C/C++ project. You can choose the project name you want (I chose “ stm32-nucleof4-freertos“). So, let's create a basic project where we’ll put HAL library from ST and FreeRTOS sources. If you are not interested in repeating the whole procedure, you can download the project from my github repository and rearrange it if your tool-chain configuration differs. Then, we'll use CubeMX to generate configuration files we need to setup FreeRTOS and the main.c file. The procedure is almost the same described in this post, but I'll describe it again to clarify some steps. Once created, we'll import inside the project all the FreeRTOS related files. In the first step of this tutorial we'll create a skeleton project. A STM32Nucleo-F401RE board (as I said before, arrange the instructions for your Nucleo if it differs).The latest version of FreeRTOS (it can be download from here - I've successfully tested the 8.2.1 release) extracted inside the ~/STM32Toolchain/FreeRTOSV8 directory.The STM32Cube-F4 framework from ST already downloaded and extracted inside the ~/STM32Toolchain/STM32Cube_FW_F4 directory (if your board is based on another STM32 family, download the corresponding STM32Cube package – I’m almost sure that the instructions are perfectly compatible).I’ll assume that the whole tool-chain in installed in C:\STM32Toolchain or ~/STM32Toolchain if you have a UNIX-like system. A complete Eclipse/GCC ARM tool-chain with required plugins as described in this post.System requirementsĪs for past tutorials, I won't show you all the steps needed to setup the whole GCC/Eclipse tool-chain, but I'll assume: We'll develop a simple blinking led application, the "Hello world" of all hardware projects, and we'll use this project to show how to configure FreeRTOS and how to use tasks and semaphores. As we'll se, once a complete tool-chain is defined, it's not a complex task to start programming with FreeRTOS. Many of you asked me a tutorial on how to use FreeRTOS on the STM32Nucleo developing board using a free GCC/Eclipse tool-chain. Moreover, STCubeMX tool is able to generate all the necessary code to initialize it. ST also provides a complete support to this OS, and it's distributed as middleware component inside the STCubeF4 framework. I think that there are other valid alternatives to FreeRTOS, but there is no doubt that it's the most popular one with a good and official support from several MCU vendors. There are several RTOSes around, both free and commercial, but probably FreeRTOS is the one that reached the maximum diffusion. Moreover, especially when dealing with low-power devices, a busy spin ( while(some condition) ) it's not the best solution if you have to fight with mAh.įreeRTOS is probably the most diffused Real Time Operating System in the embedded world. As long as your firmware starts to grow, you'll need constructs to synchronize firmware activities, like queues or semaphores. interrupt handling) and aspects related to synchronization. Although it's perfectly possible to use some forms of cooperative scheduling to execute firmware activities, basically this not convenient especially when dealing with low level events related to hardware (eg. Using a micro like the STM32F4, able to run up to 160Mhz, with 512Kb of flash and about 100k of RAM, without using an operating system is a nonsense.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |