Arm I/O access problems (dcache enabling and MMU not enabling problems)

Source: Internet
Author: User

 

Today, debugging has encountered a particularly strange problem. It is difficult to use serial port sending,CodeIt is like this:

 

If (flag in memory mapped REG ){

Write Char to transmit Reg

}

 

Something sent from the serial port is always wrong. JTAG debugging found that the single step is correct, but an error occurs as long as it runs at full speed.

 

After thinking about it, it seems that it is wrong to read the flag back, but how is it possible ??

 

After careful consideration, I found a problem. How does arm know to read this address to obtain the flag every time?

Although the address of memory-mapped Reg has been defined as volatile, but this only tells GCC not to be optimized into the register,

Arm can also read data from the cache. Arm does not have dedicated Io commands. How can we make it necessary to read the memory address?

 

There are two answers:

1) Disable D-Cache

2) Enable D-Cache and MMU, configure MMU, and set the memory ing Register address to none-cached

 

I opened the D-cache, but did not enable MMU. The result is that I am porting the operating system to the lowest layer,

I want to enable D-cache to increase the speed and enable it, but my operating system does not use MMU, and I am too lazy to configure MMU for direct ing,

I just disabled it. The result is miserable !! You can pay more attention to things in the future.

 

 

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.