ARM Learning Memory Management Unit (MMU)

Publisher:老王古玩店Latest update time:2018-07-21 Source: eefocusKeywords:ARM Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

I learned a lot of knowledge today while studying MMU. I have summarized it as follows, firstly to deepen my impression and secondly to write it down in the hope that I can exchange and learn with you.

1. What is MMU? 
Answer: MMU is a memory management unit. If MMU is turned on, it will convert the virtual address sent by the CPU into a physical address, and then perform corresponding read and write operations on the actual physical address. Of course, it also has other functions, including memory permission checking, cache, etc.

2. What is a virtual address? Why does a virtual address appear? 
Answer: A virtual address is the address that the CPU "sees". All of its address-related operations use virtual addresses. So why does a virtual address appear? I think it may be for this reason: In the past, when there was no operating system, there was only one program running on the CPU, which occupied all the memory space (similar to the current bare board program). As long as the memory space required by the program is smaller than the actual physical memory, the CPU can directly manipulate the physical memory with the physical address. But later, with the emergence of multi-user and multi-program mechanisms, the memory space required by all programs is larger than the actual physical memory, so virtual memory appeared. In theory, it allows each program to have the same size of memory space (in theory, the maximum can be the actual physical memory space, and the specific principle will not be repeated here). Virtual memory corresponds to virtual addresses. The virtual address space of each process can be the same (you can apply for a variable in a C language and print out its address, and run the program twice at the same time, and you will find that the addresses of the two variables are the same), and then the virtual address of each process is converted to the actual physical address space through the function of MMU.

3. How is the address mapping (virtual address -> physical address) function of MMU implemented? 
Answer: In fact, it is very simple in general. Generally speaking, it adopts a mechanism similar to a mapping table (professionally called a page table). The mapping of virtual address to physical address. In simple terms, the virtual address issued by the CPU is converted into a physical address by the MMU by querying this mapping table. In the ARM system, there are page table types such as segment (first-level page table), large page, small page, and tiny page (second-level page table).

4. What do the running address and loading address mean, and what is the difference? 
Answer: In ARM, when the program is burned into FLASH, the loading address is used. It is burned to a certain address in FLASH. When the program is running, the address where the program is located is the running address, also called the link address. When burning the ARM bare board program, if the link address is not specified when linking, the loading address of the program is the link address. When the link address of a certain segment is specified, when running to this segment, this segment must be at the specified link address, otherwise the program may crash (in fact, if the specified segment does not involve position-related instructions, it should not matter, because position-related instructions use absolute addresses, while position-independent instructions use relative addresses. The absolute address is related to the link address, and the relative address has nothing to do with the link).


Keywords:ARM Reference address:ARM Learning Memory Management Unit (MMU)

Previous article:ARM learning GPIO to realize water light
Next article:ARM learning interrupt architecture

Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号