ESP32 : Introduction to FreeRTOS

Introduction:

In IOT field, there are many reasons to go for constrained OS than full OS.

  • Limited Space – so that small size devices can be made
  • Low Power – so that coincells can be used as power source
  • Optimization of features – to make more value
  • Cost – So that product is market competitive

What is Operating system (OS) : It hides all the difficult computation with the hardware which software do on the backend. We are presented a computer screen that we can work on and all other details that is the communication between software and hardware is hidden form us. So an operating system is a type of software which communicates between application software and hardware.

What is RTOS : A real time operating system is the type of system which uses maximum time and resources to output exact and on the time result. There is no difference between the results when same problem run on different occasion on same machine. There is no late or early execution on that operating system and is done on fixed time as suggested.

RTOS is preferred choice for many embedded device manufactures and embedded programmers. So RTOS is being used in applications like

  1.  Automatic system of the robots machines that are manufacturing cars.
  2. Aircrafts i.e. during launch of aircraft on space and landing of aircraft.
  3. Other tasks and operation done by aircraft on space is controlled by the RTOS.

There are many RTOS flavors available.  FreeRTOS is widely followed by practitioners. We will take more details about freeRTOS in this blog

Features of the freeRTOS (as listed in freertos.org)

  • Free RTOS scheduler
  • The SafeRTOS provides better  code integrity.
  • Includes a tickless mode for low power applications.
  • RTOS objects (tasks, queues, semaphores, software timers, mutexes and event groups) can be created using either dynamically or statically allocated RAM.
  • Tiny footprint — RAM less than 500 bytes, ROM 5-10 kb
  • Official support for >30 embedded system architectures (counting ARM7 and ARM Cortex-M3 as one architecture each).
  • Designed to be small, simple and easy to use. Typically a RTOS kernel binary image will be in the region of 4K to 9K bytes.
  • Very portable source code structure, predominantly written in C.
  • Supports both real time tasks and co-routines.
  • Direct to task notifications, queues, binary semaphores, counting semaphores, recursive semaphores and mutexes for communication and synchronisation between tasks, or between real time tasks and interrupts.
  • Free development tools for many supported architectures.
  • Free embedded software source code.
  • Royalty free.
  • Cross development from a standard Windows host.

 

Why freeRTOS?

  • Provides a single and independent solution for many different architectures and development tools.
  • Is known to be reliable.
  • Is feature rich and still undergoing continuous active development.
  • Has a minimal ROM, RAM and processing overhead. Typically an RTOS kernel binary image will be in the region of 6K to 12K bytes.
  • Is very simple – the core of the RTOS kernel is contained in only 3 C files.
  • Is truly free for use in commercial applications
  • Comes with a porting, platform development, or application development service should it be required.
  • Is well established with a large and ever growing user base.
  • Contains a pre-configured example for each port.
  • Has an excellent, monitored, and active free support forum.
  • Has the assurance that commercial support is available should it be required.
  • Provides ample documentation.
  • Is very scalable, simple and easy to use.
  • FreeRTOS offers a smaller and easier real time processing alternative for applications

ESP32 and freeRTOS:

Many manufacturers produce SoC with freeRTOS support. Expressif included freeRTOS in its latest version ESP – IDF. There are currently two methods to program the ESP32: the ESP-IDF and the ESP32 arduino Core. Espressif IoT Development Framework is a set of open source libraries and tools to facilitate deployment of apps to ESP32s FreeRTOS.

Though there are two options, freeRTOS is better choice as stated by Tomerweller here 

Ring oscillator tests done by Tomerweller  showed that the Arduino program is about 65% slower than the lower level FreeRTOS program (1.63 Mhz vs 1.03 Mhz)

Arduino Core 1.05MHz (tomerweller.com)
FreeRTOS 1.63MHz (tomerweller.com)

Follow us to know more about making free RTOS tasks and freeRTOS programming on ESP32 module, to see how to setup dev environment checkout following posts

 

Setting up ESP – IDF  for ESP 32: Getting Started with ESP32

MicroPython on ESP 32 : ESP32 – Getting started with MicroPython 

You can also use eclipse for development – ESP IDF : Setting up eclipse for ESP 32

Use Arduino IDE for ESP 32 – Setting up arduino to program ESP 32

4 Comments

Add a Comment

Your email address will not be published. Required fields are marked *