Introduction to address space and MMU analysis of S3C2440 storage controller

Publisher:数字冲浪Latest update time:2022-12-26 Source: elecfansKeywords:S3C2440 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

1. S3C2440 storage controller

If you have written ARM bare metal programs for S3C2440, you should know that the starting address of SDRAM is usually 0X30000000, but have you ever thought about why? I will give you a brief introduction below.


Checking the S3C2440 manual shows that the S3C2440 can address an address range of 1G, but the S3C2440 has only 27 address lines. In theory, it can only address an address range of 2 to the power of 27, which is equal to 128M. So S3C2440 solved this problem through something called BANK. S3C2440 leads to 8 BANK lines (corresponding to nGCS0~nGCS7). Through these 8 lines, different memories are turned on and off. In this way, S3C2440 can connect up to eight 128M memories, as long as only one BANK is turned on at a certain time. It is possible to realize a 1G addressing space. Each BANK has an address. The access to the BANK address is actually to strobe the BANK. So the ARM core only needs to send out one address, and then the S3C2440 storage controller only needs to interpret the address into two Part: One part is the BANK address and the other part is connected to the address inside the BANK memory and can be accessed.


As a 32-bit CPU, the address range that can be used can theoretically reach 2 to the 32nd power, which is equal to 4G. In addition to the above-mentioned 1G address space, there is also a part of the address of the CPU's internal register, and the remaining address space is not used.

Let’s take a look at the address space distribution diagram of S3C2440 memory.

Introduction to address space and MMU analysis of S3C2440 storage controller

The left side is the address space diagram when the CPU starts from NOR FLASH, and the right side is the address space diagram when the CPU starts from NAND FLASH. It can be seen from the picture that SDRAM is connected to BANK6 with the address 0X30000000, which explains the original problem. The question comes again why the address space is different when the CPU boots from NAND and NOR? This is because NOR is a linear structure, similar to ordinary memory, and it is connected to BANK0. NAND is another structure. S3C2440 has a dedicated NAND controller and address line to connect it. It cannot be connected to BANK0. When the CPU starts, it must start executing the program from address 0, but when it starts from NAND, there is no memory at address 0, so what should the CPU do? So something called the "stepping stone" appeared, which is a 4K memory inside the S3C2440. When booting from NAND, the 0 address line will be connected to the stepping stone, and the CPU will pass the internal The hardware copies the 4K data starting from NAND FLASH to the starting stone. The program in the starting stone is generally designed to initialize the SDRAM, then copy part of the program in the NAND to the SDARM, and then jump to the SDRAM to start executing the program. Therefore, when transplanting U-BOOT to support booting from NAND, the first 4K program of NAND needs to be processed.


Next, let’s take a look at the access addresses of peripherals generally connected to the S3C440 memory controller and the access addresses of some registers.

Introduction to address space and MMU analysis of S3C2440 storage controller2. S3C2440MMU

1.The role of MMU

All we discussed in the first part are physical addresses. Be careful not to confuse them with the virtual addresses we will discuss in this part.


Memory Management Unit (Memory ManagerUnit) is referred to as MMU. It is responsible for converting virtual addresses into physical addresses and then passing them to the storage manager introduced in the previous section for addressing.


Modern multi-user multi-process operating systems use MMU to allow each user process to have its own independent address space: the address mapping function allows each process to have the same address space, and the check of memory access permissions can protect each process. The memory used by one process will not be destroyed by other processes.


Let me give you a lame example. Classmate A (Process A) went to a librarian to borrow a book called "Memory" and said that he would use it at 7 o'clock. The librarian gave Student A a sign that said which floor and room contained the book. However, this sign could only be picked up at 7 o'clock and could only be borrowed for three hours (authority). Student B also had to The book can only be borrowed at 12 o'clock. The library also gives Student B a sign. However, when the sign is different, the book can only be picked up at 12 o'clock and can only be borrowed for three hours. As a result, both students A and B borrowed the book. They all felt that they owned the book and would not be disturbed by other students while they owned the book. In fact, the classmates here represent the process, the librarian represents the kernel, the brand represents the virtual address, and the book represents the actual memory, and the work completed by MMU is to get the classmate's sign to help the classmate find the book.


The virtual address must eventually be converted into a physical address before actual data can be read and written. By dividing the virtual address space and the physical address space into small spaces of the same size, and then establishing mapping spaces for the two types of small spaces, it is possible to Block virtual addresses are mapped to the same physical address space, or some virtual address spaces are mapped to specific physical address spaces. After starting the MMU, the CPU sends out a virtual address, and then the MMU converts the virtual address into a physical address before accessing it.


2. The conversion process from virtual address space to physical space

In ARM CPU, page table is used for conversion. The Linux kernel generally uses a two-level page table. What is a page table? It is like the table of contents in our books, with a main directory and a subdirectory. When we want to find a knowledge point, we first find the main directory, then find the secondary directory and then find the corresponding knowledge point. Each process will create a directory in the memory, and the storage address of the directory is saved. When we need to access a directory, the directory will be placed in a special register of the CPU, and then the MMU will read the value in this register and help us find the physical address we want to access.


How is the page table created?

In fact, it stores the memory address of the first-level directory in an address in the memory, and then stores the actual physical address in the memory of the first-level directory.


Keywords:S3C2440 Reference address:Introduction to address space and MMU analysis of S3C2440 storage controller

Previous article:Research on the application of ECOS operating system on S3C2510 development board
Next article:Minimum system of serial network server based on S3C4510B

Recommended ReadingLatest update time:2024-11-16 13:41

The first step of burning s3c2440
The development board is jz2440. The video was by Wei Dongshan. It took me so long to watch it. The explanation was very comprehensive, including openJtag, parallel port, serial port connection and driver installation, but it didn't explain how to install the jlink driver, which was very strange. After all, I was a
[Microcontroller]
The first step of burning s3c2440
Qt2.2.0 ported to ARM9 (IV) (JZ2440----S3c2440)
Linux:Ubuntu9.10 Compiler version: arm-linux-gcc-4.3.2 Qt:qtopia-free-src-2.2.0.tar.gz Dependent libraries: libjpeg library (refer to Transplantation (I)); uuid library. For operation, refer to "Complete Manual for Embedded Linux Application Development" 1. Install qtopia2.2.0 (1) Decompression qtopia-fr
[Microcontroller]
Qt2.2.0 ported to ARM9 (IV) (JZ2440----S3c2440)
Clock architecture of S3C2440 chip
The following figure is the overall architecture of the S3C2440 chip: in, AHB BUS is a bus for high-speed devices, and H means high. APB BUS is a bus for low-speed devices, and P stands for the English word peripheral. Different buses have different running frequencies for devices mounted on them. In our S3C24
[Microcontroller]
Clock architecture of S3C2440 chip
《Linux driver: s3c2440 lcd driver analysis》
I. Introduction The content of s3c2440 lcd driver analysis includes the principle of LCD image display, the operation of s3c2440 LCD controller, the example of LCD driver using platform bus-device-driver model, the setting of LCD related parameters, fb character device driver example, framebuffer registration a
[Microcontroller]
The relationship between the virtual address and physical address of the s3c2440 register based on linux2.6.30.4
1  If you want to modify the permissions of all files in a directory at once, including the permissions of files in subdirectories, you need to use the parameter -R to start recursive processing. When I first started learning character device drivers, I felt that the most difficult part was the connection between the
[Microcontroller]
S3C2440_LCD Controller
1. The LCD controller has two main functions: 1) Get the data of a certain pixel from the framebuffer; 2) Combined with other signals, this data is sent to the LCD Whether it is 2440 or other types of ARM chips, the functions of their LCD controllers are the same, but the operation of the memory is sl
[Microcontroller]
S3C2440_LCD Controller
S3C2440 serial port code_function_initialization_send Byte_send string_Printf
Usually the serial port initialization statement is written into an initialization function Uart_Init():  1 void Uart_Init(int baud)  2 {  3     int i;  4     rUFCON0 = 0x0;   //UART FIFO disable  5 rULCON0 = 0x3; //Turn off infrared transmission mode and use Normal mode, No parity, 1 stop, 8 bits of data per frame
[Microcontroller]
Detailed explanation of S3C2440 external interrupt
    To correctly execute the external interrupt of 2440, generally two parts need to be completed: interrupt initialization and interrupt handling function.     Before executing the interrupt, you need to initialize the interrupt to be used. The external interrupt pin EINT of 2440 is multiplexed with the general IO pi
[Microcontroller]
Detailed explanation of S3C2440 external interrupt
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
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号