The Essence of Task Switching in FreeRTOS

The Essence of Task Switching in FreeRTOS

“ In embedded development, multi-task concurrency relies on task switching. This article focuses on FreeRTOS, starting from the concept of task switching, breaking down its “trigger → request → execute” process, analyzing core function source code and functionality, helping developers understand the logic of hardware-software co-design, and mastering practical methods for optimizing task scheduling and … Read more

The Secret Weapon of RTOS Multitasking: A Detailed Explanation of Scheduling Mechanisms

The Secret Weapon of RTOS Multitasking: A Detailed Explanation of Scheduling Mechanisms

Introduction Have you ever wondered how your phone can play music, receive messages, and allow you to browse the web smoothly at the same time? One of the key contributors behind this is the multitasking operating system. In the embedded world, the Real-Time Operating System (RTOS) is the magician that enables this “simultaneous” processing of … Read more

Switching Tasks in ThreadX RTOS

Switching Tasks in ThreadX RTOS

Using the QEMU simulator to outline the ThreadX task scheduling process.0. Build ExampleCreate Task 0 and Task 1 #include "tx_api.h" #include "tx_thread.h" // Task 0 entry void thread_0_entry(ULONG thread_input){ TX_THREAD *current_thread; thread_0_counter++; TX_THREAD_GET_CURRENT(current_thread); tx_thread_terminate(current_thread); } // Task 1 entry void thread_1_entry(ULONG thread_input){ while(1) { /* Increment the thread counter. */ thread_1_counter++; while(1); }} // Create … Read more

Complete Guide to Connecting Bluetooth on Switch!

Complete Guide to Connecting Bluetooth on Switch!

Nintendo officially released the 13.0.0 version system update for the Switch this morning, adding many functional updates. For example, you can set whether the console maintains a network connection during sleep; you can check if the WIFI is 2.4GHz or 5GHz; you can update the software for the OLED model’s dock, etc… However, for many … Read more

Embedded Programming: Fast Context Switching Based on Cpost

Embedded Programming: Fast Context Switching Based on Cpost

The demand for embedded development programming is ever-changing. To achieve system stability and code reusability, one must aim for high cohesion and low coupling. It is generally believed that time-consuming operations cannot be executed during interrupts, as this would affect system stability. For programs with an operating system, interrupt handling can be divided into two … Read more

Introduction to MMU in ARMV8-A – Part 1

Introduction to MMU in ARMV8-A - Part 1

1. Concept of Address Translation The code in ARMV8-A generally uses virtual addresses for addressing access, which are converted into physical addresses in the memory system. This conversion is performed by a component of the processor called the MMU. The MMU uses a translation table to convert virtual addresses to physical addresses; this translation table … Read more

Where Does the RTOS Task Entry Function Go After Execution?

Where Does the RTOS Task Entry Function Go After Execution?

1. Introduction During my work, I found that understanding these concepts only allows one to use RTOS at a basic level. To effectively utilize RTOS, one must understand some detailed mechanisms; otherwise, it is easy to fall into pitfalls and spend a lot of time troubleshooting. This article discusses related content in conjunction with the … Read more

Task Scheduling in FreeRTOS – Context Switching

Task Scheduling in FreeRTOS - Context Switching

The previous article on FreeRTOS task scheduling – startup mentioned that the first task runs in an infinite loop mode. Clearly, having only one task running is not sufficient. So how does the running task yield control of the MCU to allow other tasks to run? One way is for the task to voluntarily yield … Read more

Embedded Programming: Fast Context Switching Based on cpost with Code Link at the End

Embedded Programming: Fast Context Switching Based on cpost with Code Link at the End

The demands of embedded development programming are ever-changing. To achieve system stability and code reusability, high cohesion and low coupling must be maintained.It is generally believed that time-consuming operations cannot be executed within interrupts, as this would affect system stability. For programs with an operating system, interrupt handling can be divided into two parts through … Read more

Understanding the Task Module in FreeRTOS (Part 2)

Understanding the Task Module in FreeRTOS (Part 2)

The source code of the task function contains the following parts: 1. Priority handling 2. Task creation 3. Starting the first task 4. Task switching 5. Task blocking/waking The previous article focused on the first three points, while this article will start from the scheduler to discuss the task switching (scheduling) mechanism. 1. Scheduling Mechanism … Read more