Assembly write startup code open Icache

Source: Internet
Author: User
Tags access properties

"Teacher Zhu's IoT lecture" study notes

Study Address: www.zhulaoshi.org


The first two sections of the teacher said a word, I forgot to write up, today to fill.

SoCs are basically read-write control of peripherals through similar gpio, memory controllers, and so on.

There are also special, like the watchdog, there is no peripherals corresponding to it.


Okay, let's start with our theme for today, Icache.


So, what is Icache?


It is a kind of memory, although it currently touches several kinds of memory, registers, DDR, and so on, they work in the physical principle although different, but the access properties are very similar.


On the speed

CPU > Register > Cache > DDR

On the capacity

CPU < Register < Cache < DDR


In the whole system, the CPU supply chain consists of: Register +cache+ddr+ HDD/flash four order.


210 internal 32KB Icache and 32KB Dcache (see CPU core 32KB/32KB i/d cache 800mhz/1ghz)


Icache is used to cache instructions,

Dcache is used to cache data, the bare metal part is not available, the operating system MMU.


CPU design has a rationale: When the old code executes, the next sentence is much more likely to execute the code next to the current line of code.

If not, you need to clean up the old cache and reload the new cache.


At present, everything in Icache is automatic and does not require us to do anything.

We just need to open or close icache.


The BL0 in Irom has opened the Icache. (Step two: Initialize the instruction Cache)



So how do we set it up? Have you ever thought about the coprocessor that was mentioned before the assembly instruction ~

Here we are using the CP15 coprocessor to control the Icache.


Assembly code Read-write CP15 with switch Icache

	MRC p15,0,r0,c1,c0,0//			read out CP15 C1 to r0
	Bic r0, R0, # (1<<12)			//bit12 0  off Icache
	Orr R0, R0, # (1 <<12)			//bit12 1  open Icache
	mcr p15,0,r0,c1,c0,0;

With the switch Icache, you can see that the speed of the light flashes will change in the LED experiment.

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.