PranabNandy / FreeRTOS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

FreeRTOS On STM32F4xx With Debugging

FreeRTOS APIs

Screenshot from 2024-06-01 17-32-40

Some Background

  • Real-time deals with guarantees, not with raw speed. (Soft realtime and Hard Realtime)
  • In Real-Time Computing timeliness is more important than performance.
  • Time Deterministic – Response time to events is always almost constant. Screenshot from 2024-04-27 12-44-06 Screenshot from 2024-04-27 12-49-44
  • To deal with Priority Inversion problem, either it reschedules the tasks or change the LP Task to HP. Priority inversion avoidance
  • Priority based preemptive scheduling mechanism
  • No or very short Critical sections which disables the preemption Screenshot from 2024-04-27 12-51-19

1. Introduce

  • FreeRTOS is a real-time operating system kernel for embedded devices that has been ported to 35 MCU platforms
  • It is designed to be small and simple. To make the code readable, easy to port, and maintainable, it is written mostly in C, but there are a few assembly functions included where needed (mostly in architecture-specific scheduler routines).
  • It provides methods for multiple threads. A tick-less mode is provided for low power applications.
  • FreeRTOS kernel features:
    • Pre-emptive or co-operative operation
    • Very flexible task priority assignment
    • Software timers
    • Queues
    • Binary semaphores
    • Counting semaphores
    • Recursive semaphores
    • Mutexes
    • Tick hook functions
    • Idle hook functions
    • Stack overflow checking
    • Trace hook macros

2. FreeRTOS Structure & Hierarchy

  • Download sources:
 https://sourceforge.net/projects/freertos/files/FreeRTOS/
FreeRTOS
  ├── Demo             (Contains demo application for every official FreeRTOS port)
  ├── Test             (contains the tests performed on common code and the portable layer code)
  └── Source           //------  (Core FreeRTOS kernel file)   ------//
      ├── include      (Consists of The core FreeRTOS kernel header files)
      └── portable     {==== (Consists of Processor specific code)  ====}
          ├── Compiler (Contains all the ports created by compiler)
          ├── MemMang  (Contains The sample heap implementations)
          └── ...
  • Structure & Hierarchy:
FreeRTOS.h
   ├── FreeRTOSConfig.h        (Application specific configuration options)
   ├── projdefs.h              (Basic FreeRTOS definitions)
   └── portable.h              (Definitions specific to the port being used)
         ├── portmacro.h
         └── mpu_wrappers.h

FreeRTOS.h
   ├── list.c
   ├── croutine.c
   ├── timers.c
   ├── heap_?.c
   ├── queue.c
   └── tasks.c

3. Goal

  • Understanding various RTOS concepts with FreeRTOS Programming and Debugging
  • Using STM32 Standard Peripheral Driver APIs to configure peripherals
  • FreeRTOS Debugging using SEGGER SystemView Software
  • Using FreeRTOS API with code examples
  • Learn Complete Step by step method to run FreeRTOS on STM32 MCUs using OpenSTM32 System Workbench

4. Prepare

Software Hardware
OpenSTM32 System Workbench Board NUCLEO-F446RE
SEGGER SystemView Cable
FreeRTOS v10.1.1 Led
STM32F4 standard peripherals library Button
minicom

STM32 Boards

  • 32F429 { LCD based}
  • 32F407G { standard one}
  • NUCLEO F446RE {Nucleo board } Screenshot from 2024-04-27 15-18-36

About


Languages

Language:C 99.1%Language:Makefile 0.5%Language:Assembly 0.4%