CS Electrical And Electronics
@cselectricalandelectronics
All PostsApp DevelopmentCommunicationsElectronicsEmbedded SystemIoT (Internet of Things)What Is

What Is FreeRTOS, Purpose, Working, Configuration, Applications

Hello guys, welcome back to our blog. Here in this article, we will discuss what is FreeRTOS, its purpose of FreeRTOS, its working, its configuration, its applications, and features of FreeRTOS.

If you have any electrical, electronics, and computer science doubts, then ask questions. You can also catch me on Instagram – CS Electrical & Electronics.

Also, read:

What Is FreeRTOS

FreeRTOS is a real-time operating system Kernel that works with embedded microcontrollers (currently over 35 microcontroller platforms). Free_RTOS is an open-source platform licensed by MIT. They are highly configurable devices and can securely connect small low-power edge devices, program them, and manage and collect data for IoT applications.

FreeRTOS provides open source software libraries highly configurable to work along with various sectors and industrial applications. One edge device can be securely connected to another edge device and collect data through AWS Cloud services, AWS IOT Core, etc. One of the most powerful edge devices includes AWS IoT Greengrass.

Purpose of FreeRTOS

Microcontrollers are low in performance while connected with IoT applications, but with the Free_RTOS kernel, low-edge power devices can be run utilizing software libraries, connect with the cloud and collect data for IoT applications. They can embed various devices with the microcontrollers and program them to securely collect data. 

Working of FreeRTOS

FreeRTOS enables embedded devices to be easily programmable and securely link lower edge devices to collect cloud data.

FreeRTOS working process

  • Step 1: Choosing the device. Select a microcontroller, that is qualified for FreeRTOS from AWS Partner Device Catalog.
  • Step 2: Use AWS Console or Github to download Free_RTOS libraries.
  • Step 3: Use Cloud services like AWS IOT core to securely connect Free_RTOS embedded devices and mobile devices through Bluetooth.
  • Step 4: Update through OTA update.
  • Step 5: Use AWS IoT devices to integrate with FreeRTOS devices.

FreeRTOS COMMANDS and codes

The main functions of Free_RTOS are multi-tasking, prioritizing tasks, scheduling, and running user-defined tasks. 

01. Tasks

User-defined tasks are called functions with a given priority using tasks.c and tasks.h.

02. Communication

FreeRTOS communicate between each edge device through Queue.c and Queue.h to send signals. It can also signal the usage of semaphores and mutexes.

03. Hardware Whispering

FreeRTOS holds nearly 9000 lines of code and can run in both conventional 8051 and ARM CORE. 6% of Free_RTOS core code handles hardware independent codes and the remaining are for hardware dependant codes. The compiler supported by Free_RTOS includes CodeWarrior, GCC, IAR, etc. Some of the supportive architectures include ARM7, ARM Cortex, PICs, SiliconLabs 8051, x86, etc.

04. Configuration options

Free_RTOS can enable various configurations through #define functions. Examples of some configuration call functions are represented here.

  • #define config MAX_PRIORITIES ((Unsigned Port BASE_TYPE)5)
  • #define config CPU_CLOCK_HZ((12000000 UL))
  • #define config TICK_RATE_HZ(portTICKtYPE)1000)

05. Calling Hardware specific functions

Free_RTOS can call a hardware dependant code directory with a #define function.

FreeRTOS/Source/portable/IAR/ARM_CM3/directory.

This code specifies the files in the IAR compiler on an ARM CORTEX_M3 clip.

FreeRTOS/Source/portable/IAR/ARM_CM3/portmarco.h

where portmarco.h is the header file, which defines portEnter.CRITICAL)

#define port ENTER_CRITICAL()

Vport Critical()

The above codes return hardware independence for tasks.c

06. Task Priorities and ReadyList

Free_RTOS works on five priority levels (0,1,2,3,4). The ReadyList codes are as below.

Static xList pxReadyTasksLists[configMax_PRIORITIES].

pxReadyTasksList [0]- specifies all the priority 0 tasks and goes on until pxReadtTasksList[configMax_PRIORITIES-1].

07. System Tick

FreeRTOS is capable of configuring the embedded systems to generate periodic trip interrupts. When tick interrupts are given the vTaskSwitchContext() function is called in order to select High-priority Ready tasks and store them in pxCurrentTCK.

08. Task Control Block (TCB)

Task Control Board is defined in task.c. The following commands are involved in Task Control Block.

pxStack → Address of the Stack Start Value.

pxTopofStack → Current Top of the stack.

pxEndofStack → Pointer to End of Stack checks Stack overflow.

UxPriority → Initial priority of the task.

UxBasePriority → Includes original priority list.

xListItem → Inserts a pointer.

09. Task Setup

To initiate tasks within the queue, FreeRTOS follows the below codes:

xTaskCreate() → Creates a task.

psStack → Remembers priority and other details for a task.

10. Lists

Lists of FreeRTOS keep track of tasks and implements a queue.

xItemValue → Tracking of the task, timer value.

xItemValue → contains the value for highest to lowest priority tasks.

pxNext and pxPrevious → Linked List pointers.

pvOwner → Pointer to the owner of list elements.

pvContainer → Points where the list is contained in.

11. Queue

FreeRTOS communicates with different tasks and synchronizes with each other. Each item in the queue consists of a user-specified length and size that is to be tracked. Generally, the queue internal storage has pcHead and pcTail to specify the start and end of the queue.

xTaskWaitingToSend → Track the tasks and specify whether they are blocked or inserted into a queue. When each element are removed from the queue this function is called.

xTaskWaitingToReceive → When each element are inserted into the queue this function is called.

Applications of FreeRTOS

  1. Mainly FreeRTOS is used for multiple threading.
  2. It includes a self built-software timer.
  3. It can be embedded in various microcontrollers platforms (like microcontroller-STM 32).
  4. FreeRTOS can schedule multi-tasks at a time.
  5. It includes multiple-memory allocation options.
  6. It can perform inter-task functionalities.
  7. It can enable multiple types of semaphores, notify tasks and queue messages, and securely communicate between edge devices.

This was about “What Is FreeRTOS“. We hope this article may help you all a lot. Thank you for reading.

Also, read:

Author Profile

CS Electrical And ElectronicsChetu
Interest's ~ Engineering | Entrepreneurship | Politics | History | Travelling | Content Writing | Technology | Cooking
Share Now

CS Electrical And Electronics

Interest's ~ Engineering | Entrepreneurship | Politics | History | Travelling | Content Writing | Technology | Cooking