Tiny6410 Control Icache Drive

Source: Internet
Author: User
Tags volatile

what is cache:
based on the limitations of program Access, a class of high-speed, small-capacity storage is set up between main memory and CPU general-purpose registers
part of the instruction or data from the main memory of the executing instruction address attachment to this type of memory for the CPU for a period of time
, which has a great effect on improving the running speed of the program. This type of high-speed, small-capacity memory between main memory and CPU
called the high-speed cache. Mainly to solve the problem of the speed mismatch between main memory and CPU.
the more common caches include icache and Dcache. The use of Icache is relatively simple, when the system just power on, Icache
The contents of the Icache are not valid, and the function of the CP15 is turned off and written to the bit[12 of register 1 in the coprocessor.
1 can start Icache, write 0 can stop Icache. When the Icache is off, the CPU reads the main memory each time, the performance is very
Low. Because Icache can be started at any time, the sooner you open icache the better.
similar to Icache, when the system just power on, the contents of Dcache are invalid, and the function of Dcache is closed,
To the CP15 coprocessor in the Register 1 bit[2] Write 1 can start Dcache, write 0 can stop Dcache. Because Dcache
the MMU must be started before it can be started.

First step: Find the Cache control register

Step Two: Write the test procedure for LED lights (see tiny led bare metal driver)

The third step: experiment phenomenon water lantern change faster

Encoding implementation:

1 //start. S boot code2.Global_start3 4 _start:5 6     //tell the CPU the base address of the peripheral7LDR R0, =0x70000000                     8Orr R0, R0, #0x13                    9MCR P15,0, R0,C15,C2,4               Ten      One     //off-Guard dog ALDR R0, =0x7e004000 -mov R1, #0 - str R1, [R0] the      -     //Set Stack -Ldr sp, =0x0c002000 -     //Cache Control Register +Ldr R0,0x72000004 -     //Open Icaches + #ifdef Config_sys_icache_off ABic R0, R0, #0x00001000@ Clear Bit A(I) I-Cache at #else -Orr R0, R0, #0x00001000@SetBit A(I) I-Cache - #endif -MCR P15,0, R0, C1, C0,0 -  -      in     //call C function to light up - BL main to      + Halt: - B Halt the  * /////////////////////////////////////// $ //Tiny6410Addr.hPanax Notoginseng #ifndef _tiny6410addr_h - #define_tiny6410addr_h the //GPK + #defineGpkio_base (0x7f008800) A #defineRGPKCON0 (* (volatile unsigned*) (gpkio_base+0x00)) the #defineRgpkdat (* (volatile unsigned*) (gpkio_base+0x08)) +  - #endif $ ////////////////////////////////////// $ //clock.c -#include"Tiny6410Addr.h" - #defineGpk4_out (1&LT;&LT;4*4) the #defineGpk5_out (1<<4*5) - #defineGpk6_out (1&LT;&LT;4*6)Wuyi #defineGpk7_out (1&LT;&LT;4*7) the //Delay Function - voiddelay () Wu { -    volatile inti =0x10000; About     while(i--); $ } -  - intMain () - { AUnsignedinti =0x10; +     //set gpk4-7 to output therGPKCON0 = Gpk4_out | Gpk5_out | Gpk6_out |gpk7_out; -     //Happy Lantern Style $      while(1) the     { theRgpkdat =i; thei++; the         if(i = =0x100) -I=0x10; in delay (); the     } the      About     return 0; the     } the ////////////////////////////// the //Makefile + LED.BIN:START.O MAIN.O -Arm-linux-ld-ttext0x50000000-O led.elf $^ theArm-linux-objcopy-O binary led.elf led.binBayiarm-linux-objdump-d led.elf >Led_elf.dis the%.O:%. S theArm-linux-gcc-o [email protected] $<-C -%.O:%. C -Arm-linux-gcc-o [email protected] $<-C the Clean : theRM *.o *.elf *.bin *.DIS-RF
View Code

Tiny6410 Control Icache Drive

Related Article

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.