Introduction to RTOS Part 12 - Multicore Systems | Digi-Key Electronics
YouTube Viewers YouTube Viewers
151K subscribers
42,426 views
0

 Published On Apr 5, 2021

Running tasks in an RTOS on a multicore system can seem daunting at first. Many processors have unique architectures that you must keep in mind when writing programs that use more than one core. We examine the FreeRTOS port for the ESP32 (known as ESP-IDF) and how to synchronize tasks on both cores.

The solution to the challenge can be found here: https://www.digikey.com/en/maker/proj...

Code for this video series (including demonstrations, challenges, and solutions) can be found here: https://github.com/ShawnHymel/introdu...

Programming a multicore system can be separated into two paradigms: asymmetric multiprocessing (AMP) and symmetric multiprocessing (SMP). AMP requires a primary core running an operating system to schedule tasks in other (secondary) cores. In SMP, the OS runs on all cores, and the scheduler is free to pull tasks from a shared list.

ESP-IDF is the port of FreeRTOS for the ESP32, and it supports SMP. The ESP32 is a dual-core system (although, single-core variants exist). We look at how the ESP32 architecture is configured and how each core can access memory, resources, and interrupts.

In ESP-IDF, we have the option of pinning tasks to a core (so that only that core may run a particular task) or setting a task to “no affinity” (so that the task can run in either core). Using “no affinity” is easier to implement and optimizes CPU utilization and load balancing without much effort. However, it becomes difficult to determine when certain tasks will run, which makes predicting deadlines tougher. As a result, many embedded developers prefer to pin tasks to cores, as it allows for a higher level of determinism.

We show how to run tasks on either core in the ESP32 as well as set them to “no affinity.” Kernel objects (e.g. queues, mutexes, and semaphores) work across cores without any modification, as the ESP32’s cores share memory.

Product Links:
https://www.digikey.com/en/products/d...

Related Videos:
Introduction to RTOS Part 1 - What is a Real-Time Operating System (RTOS)? -    • Introduction to RTOS Part 1 - What is...  ​

Introduction to RTOS Part 2 - Getting Started with FreeRTOS -    • Introduction to RTOS Part 2 - Getting...  ​

Introduction to RTOS Part 3 - Task Scheduling -    • Introduction to RTOS Part 3 - Task Sc...  ​

Introduction to RTOS Part 4 - Memory Management -    • Introduction to RTOS Part 4 - Memory ...  ​

Introduction to RTOS Part 5 - Queue -    • Introduction to RTOS Part 5 - Queue |...  ​

Introduction to RTOS Part 6 - Mutex -    • Introduction to RTOS Part 6 - Mutex |...  ​

Introduction to RTOS Part 7 -    • Introduction to RTOS Part 7 - Semapho...  ​

Introduction to RTOS Part 8 -    • Introduction to RTOS Part 8 - Softwar...  

Introduction to RTOS Part 9 -    • Introduction to RTOS Part 9 - Hardwar...  

Introduction to RTOS Part 10 -    • Introduction to RTOS Part 10 - Deadlo...  

Introduction to RTOS Part 11 -    • Introduction to RTOS Part 11 - Priori...  

Introduction to RTOS Part 12 -    • Introduction to RTOS Part 12 - Multic...  

Related Project Links:
https://www.digikey.com/en/maker/proj...

Related Articles:
https://www.digikey.com/en/maker/proj...

Learn more:
Maker.io - https://www.digikey.com/en/maker
Digi-Key’s Blog – TheCircuit https://www.digikey.com/en/blog
Connect with Digi-Key on Facebook   / digikey.electronics  
And follow us on Twitter   / digikey  

show more

Share/Embed