Steps to Port FreeRTOS on STM32F103C8T6

Steps to Port FreeRTOS on STM32F103C8T6

For other basic configurations, refer to my article: STM32F103C8T6 Microcontroller CUBEIDE Integrated Development Environment Configuration Process.Based on the above, follow these steps:1. First, select sys->Timebase source and choose TIMx. This article selects TIM1 (it is best to choose this; others only have basic functions like TIM2, TIM3, and TIM4. TIM1 is an advanced timer, and … Read more

Microcontroller Time-Slice Polling Program Architecture

Microcontroller Time-Slice Polling Program Architecture

The time-slice polling method is often mentioned alongside operating systems, meaning it is frequently used in operating systems:RTOS in STM32 microcontroller development. The following will reference others’ code to demonstrate how to establish a time-slice polling architecture program.Timer Reuse Executing other functions while one function is delayed makes full use of CPU time, doesn’t it … 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

Detailed Explanation of FreeRTOS Multitasking Execution Principles – Part Two

Detailed Explanation of FreeRTOS Multitasking Execution Principles - Part Two

Detailed Explanation of FreeRTOS Multitasking Switching Underlying Principles 6. Task State Transitions 6.1 State Transition Diagram Create Ready Queue CPU Execution [NEW] —–> [READY] —–> [RUNNING] ↑ ↓ ↓ ↑ ↓ [Time Slice Expired] ↑ ↓ ↓ [Waiting for Event] [BLOCKED] [Delay Waiting] [SUSPENDED] 6.2 State Transition Conditions Transition Trigger Condition Description NEW → READY … Read more

Mastering FreeRTOS from Scratch: Differences Between Bare Metal and RTOS

Mastering FreeRTOS from Scratch: Differences Between Bare Metal and RTOS

RTOS, known in Chinese as 实时操作系统 (Real-Time Operating System), is the main focus of this series, which aims to master FreeRTOS. Next, we will compare it with bare metal systems and understand the advantages of RTOS, allowing us to clearly recognize why we should learn RTOS. Bare Metal System In a bare metal system, the … Read more

How to Start Learning Embedded Systems from Scratch?

How to Start Learning Embedded Systems from Scratch?

The essence of embedded development is to combine software and hardware, running code on chips and devices. It is widely used in fields such as smart hardware, automotive electronics, the Internet of Things, robotics, and medical devices. Many people want to get started but often don’t know where to begin. Below is alearning path from … Read more

In-Depth Explanation of FreeRTOS Multitasking Switching Principles

In-Depth Explanation of FreeRTOS Multitasking Switching Principles

It suddenly dawned on me; I realized that I had a strong feeling for FreeRTOS after seeing a lot of assembly code during Keli’s debugging, running so fast that we didn’t even notice the frequent task switching. 1. The Essence of Multitasking Execution 1.1 Core Concepts On a single-core MCU, multitasking does not truly execute … Read more

Comparison of the 5 Major Pros and Cons of RTOS and Bare-Metal Programming with Practical Guidelines

Comparison of the 5 Major Pros and Cons of RTOS and Bare-Metal Programming with Practical Guidelines

Source: One Linux Embedded systems are ubiquitous in fields such as smart homes, industrial control, and autonomous driving. However, developers often encounter a key question:Should we use a Real-Time Operating System (RTOS) or go for bare-metal programming directly? The former is like a team equipped with a “smart scheduler,” while the latter is a minimalist … Read more

Introduction to FreeRTOS: Basics of Semaphores

Introduction to FreeRTOS: Basics of Semaphores

SemaphoreWe all know about queues, which can be used to transmit different types of data.However, sometimes we only need to convey a state without transmitting specific information.Thus, we introduce semaphores, which do not transmit data but rather convey states, serving as notifications and saving memory. A semaphore cannot transmit data; it only has a count … Read more