▼For more exciting recommendations, please follow us▼
1. What are the differences between microcontrollers, Cortex-M, and Linux in embedded systems?
2. What processors are needed to run Linux? ARM9, ARM11?
3. Cortex-M is newer than ARM9, why can’t it run Linux?
Many people may have similar questions, so let’s discuss Cortex-M, ARM, and Linux.
The architecture of ARM processors defines the Instruction Set Architecture (ISA) and the models of processors based on this architecture. The ARM instruction set has evolved from ARMv1 to the current ARMv9, with each modification adding practical technologies.

Before ARMv6, the core instruction set architecture was single-style, but starting from ARMv7, the instruction set architecture became three styles, namely the well-known Cortex-M, Cortex-R, and Cortex-A, or ARMv7-A, ARMv7-R, and ARMv7-M.
-
Cortex-M: primarily refers to microcontrollers;
-
Cortex-R: primarily refers to real-time processors;
-
Cortex-A: primarily refers to application processors;
It is important to note that processors under Cortex-M do not have a Memory Management Unit (MMU).
Memory Management Unit (MMU)
MMU: Memory Management Unit.
The Memory Management Unit is mainly responsible for mapping virtual addresses to physical addresses and checking memory access permissions at the hardware level.
In multi-user and multi-process operating systems like Linux, the MMU ensures that each user process has an independent address space to prevent memory overflow.

Figure 2: The Role of MMU
MCUs have an address set, known as the virtual address range. Taking Cortex-M 32 as an example, the virtual address range is 0 ~ 0xFFFFFFFF (4G address space).
When this controller addresses a 256M memory, its usable address range is limited to 0 ~ 0x0FFFFFFF (256M).
1. In processors without memory management, virtual addresses are sent directly to the memory bus to read and write the physical memory at that address.
Further Reading:How Preemptive Operating Systems without MMU Work
2. In controllers with memory management, virtual addresses are first sent to the MMU, mapped to physical addresses, and then sent to the memory bus.

Figure 3: Memory Management Mechanism
Note: The above figure only briefly reflects the mapping mechanism of memory management, and other discussions are not included.
The main role of MMU virtual memory management is to provide each process with an independent address space.
The same virtual address in different processes is mapped by the MMU to different physical addresses, and accessing any address in one process cannot access the data of another process. This prevents any illegal memory access caused by executing erroneous instructions or malicious code from inadvertently rewriting other processes’ data, ensuring the stability of the entire system.
On the other hand, each process believes it exclusively occupies the entire virtual address space, making the implementation of linkers and loaders easier without having to consider whether the address ranges of each process conflict.
Operating systems are generally divided into real-time operating systems and non-real-time operating systems.
1. Real-time operating systems are mostly single-process, multi-threaded (multi-tasking), thus they do not involve address space allocation between threads, and do not require the use of MMU, such as ucos, FreeRTOS, RT-Thread, etc.
2. Linux systems belong to non-real-time operating systems, with multi-process being its main feature. You can refer to the article:Is Linux a Real-Time System or a Time-Sharing Operating System?
Taking Ubuntu as an example, open a shell and check the address range of the bash process as shown in Figure 4, with an address range of 0x0000000000400000~0xffffffffff600000.

Figure 4: Bash Address in Shell 1
We open another shell to check the address range of the bash process in that shell, as shown in Figure 5. It is not difficult to find that the address ranges of two different bash processes are exactly the same. In fact, the operating system or user does not need to consider the physical memory address allocation when forking processes; this work is done by the microcontroller’s MMU.

Figure 5: Bash Address in Shell 2
Since multi-process relies on the memory management unit, can we run embedded Linux with only one process? Definitely not! Even if the user does nothing after booting, there are already dozens to hundreds of visible system processes running, as shown in Figure 6.

Figure 6: Process Tree
From the above description, we can understand that the Linux operating system has a strong dependence on the MMU (Memory Management Unit). If Linux were to run on a CPU without a memory management unit, the entire system would likely remain at the Uboot stage.
Since ARM’s Cortex-M processors do not have a memory management unit, it is generally not recommended to run the Linux operating system.
Of course, nothing is absolute. If you rewrite the Linux kernel and pair it with a sufficiently large memory chip, theoretically, it is possible to do without an MMU.
However, is such a workload really worth it? In practice, the MMU was created to address the increasingly complex memory management of operating systems.

👉 The Startup Process of STM32 Code
👉What is an Algorithm, After All?
👉How to Use SPI? Understand Timing and Use Freely
👉How to Layer Multi-layer Boards? How to Design PCBs for Optimal EMC Performance?

Click “Read the Original” for more shares, welcome to share, save, like, and watch