Configuration and use of 3.MMU

Source: Internet
Author: User

Configuration and use of 3.MMU

The basic knowledge of the previous use of the physical address to light the LED lights, now, learning the relevant knowledge of the MMU, the following is the use of MMU knowledge, with virtual address to light LED lights. And the MMU is closed, so the MMU will have to open the MMU next.

In the previous study, there are three ways to map from a virtual address to a physical address:

    1. section of the Way
    2. How to Page Rough
    3. The way of a fine page

The next step is to use the mapping of the segment to transform the virtual address to the physical address.

Steps to implement the method of paragraph:

1. Create a translation table:

You can see the information about the way the segment is in the table.

2, after the establishment of this table, but also to the table of the base address TTB (translation table base) written to CP15 C2 Register, so that the MMU can find this table.

3, is open the MMU.

The process is to use the virtual address to access the physical address to enable the LED lights to be lit, rather than the same as the previous physical address lit.

Code Operation Flow:

Brochure Information:

Sketch of the function of C and B above:

Next, look at the AP bit and domain bit:

You can see that the arm structure divides the storage space into 16 domains, each with its access rights. We can specify which domain the area to access is placed in.

The choice here is that the domain 0,domain is in position 5, so (0<<5) can.

Access to APS:

As you can see, when the AP is set to 11, both the S bit and the R bit are readable and writable. Set the AP to 11 now. 0B11=0X3, so the implementation code (3<<10) can.

Finally, the code for the page table is created:

2. Write the base address of the established table to the CP15 C2 Register (write TTB):

Based on the information in the chip manual, the embedded assembly in the C program implements the write TTB operation:

This writes the base address of the segment to the CP15 C2 Register, completing the work of setting up the TTB.

3. Then the Enable MMU:

Chip data arm Architecture Reference manual.pdf:

Backplane Manual Information:

You can see that the last position of the C1 register to enable the MMU needs to be CP15 is 1.

Realize:

Note: In fact, we are not set up here, this is because we learned in the previous study: The segment is access, and its access rights are determined by the AP two bits. Then, because the segment belongs to a domain, the access rights for each domain are determined by the CP15 C3 register.

It can be seen that if we set the value of CP15 's C3 register to 11, Access does not require permission, so set the C3 to full 1.

This is not actually done, because we just completed the GPIO to physical memory mapping, no memory virtual address to the physical address mapping. The next step is to implement a mapping of virtual addresses to physical addresses. There are also virtual addresses used in C programs, not physical addresses.

The next step is to map the virtual address with the same value as the physical address:

Implementation code:

Next MAIN.C Code implementation:

Compile make to burn to the Development Board:

Configuration and use of 3.MMU

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.