Running jobs in an RTOS on a multicore system can appear intimidating at. When writing programs that use even more than one core, many cpus have special architectures that you must keep in mind. We analyze the FreeRTOS port for the ESP32 (referred to as ESP-IDF) and just how to synchronize tasks on both cores.
The option to the challenge can be located right here: https://www.digikey.com/en/maker/projects/introduction-to-rtos-solution-to-part-12-multicore-systems/369936f5671d4207a2c954c0637e7d50
Code for this video clip collection (consisting of demos, services, and difficulties) can be discovered below: https://github.com/ShawnHymel/introduction-to-rtos
Configuring a multicore system can be divided right into 2 standards: crooked multiprocessing (AMP) and also symmetric multiprocessing (SMP). AMP needs a main core running an os to arrange jobs in other (second) cores. In SMP, the OS works on all cores, and also the scheduler is cost-free to draw jobs from a common listing.
ESP-IDF is the port of FreeRTOS for the ESP32, and also it sustains SMP. The ESP32 is a dual-core system (although, single-core variants exist). We look at exactly how the ESP32 design is set up and exactly how each core can access memory, resources, and also disturbs.
In ESP-IDF, we have the choice of pinning jobs to a core (to make sure that only that core may run a certain job) or setting a job to “no fondness” (to make sure that the job can run in either core). Using “no fondness” is easier to execute and also enhances CPU usage and also tons balancing without much initiative. It becomes hard to establish when specific jobs will certainly run, which makes forecasting target dates tougher. Because of this, lots of embedded developers like to pin tasks to cores, as it permits a higher degree of determinism.
We show exactly how to run tasks on either core in the ESP32 as well as established them to “no affinity.” Kernel things (e.g. semaphores, mutexes, and lines) work throughout cores with no modification, as the ESP32’s cores share memory.
Intro to RTOS Part 1 – What is a Real-Time Operating System (RTOS)? – https://youtu.be/F321087yYy4
Intro to RTOS Part 2 – Getting Started with FreeRTOS – https://youtu.be/JIr7Xm_riRs
Intro to RTOS Part 3 – Task Scheduling – https://youtu.be/95yUbClyf3E
Introduction to RTOS Part 4 – Memory Management – https://youtu.be/Qske3yZRW5I
Introduction to RTOS Part 5 – Queue – https://youtu.be/pHJ3lxOoWeI
Introduction to RTOS Part 6 – Mutex – https://youtu.be/I55auRpbiTs
Intro to RTOS Part 7 – https://youtu.be/5JcMtbA9QEE
Intro to RTOS Part 8 – https://youtu.be/b1f1Iex0Tso
Introduction to RTOS Part 9 – https://youtu.be/qsflCf6ahXU
Introduction to RTOS Part 10 – https://youtu.be/hRsWi4HIENc
Introduction to RTOS Part 11 – https://youtu.be/C2xKhxROmhA
Introduction to RTOS Part 12 – https://youtu.be/LPSHUcH5aQc
Related Project Links:
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 https://www.facebook.com/digikey.electronics/
As well as follow us on Twitter https://twitter.com/digikey