User Tools

Site Tools


using_arm_caches

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
using_arm_caches [2014/05/31 21:18]
bain [Enabling the MMU]
using_arm_caches [2014/06/11 12:40] (current)
bain
Line 10: Line 10:
   * ARM Cortex-A9 Technical Reference Manual [[http://​infocenter.arm.com/​help/​topic/​com.arm.doc.ddi0388i/​index.html|Cortex-A9 TRM]]   * ARM Cortex-A9 Technical Reference Manual [[http://​infocenter.arm.com/​help/​topic/​com.arm.doc.ddi0388i/​index.html|Cortex-A9 TRM]]
   * ARM Cortex-A9 MPCore Technical Reference Manual [[http://​infocenter.arm.com/​help/​topic/​com.arm.doc.ddi0407i/​index.html|Cortex-A9 MPCore TRM]]   * ARM Cortex-A9 MPCore Technical Reference Manual [[http://​infocenter.arm.com/​help/​topic/​com.arm.doc.ddi0407i/​index.html|Cortex-A9 MPCore TRM]]
-  * Level 2 Cache Controller (L2C-310) Technical Reference Manual [[http://​infocenter.arm.com/​help/​index.jsp?topic=/​com.arm.doc.ddi0246e/​index.html|L2C-310 TRM]]+  * Level 2 Cache Controller (L2C-310) Technical Reference Manual [[http://​infocenter.arm.com/​help/​topic/​com.arm.doc.ddi0246h/​index.html|L2C-310 TRM]]
  
 The ARM processor in the Cyclone V has both L1 and L2 caches. The ARM processor in the Cyclone V has both L1 and L2 caches.
Line 41: Line 41:
  
 == 3. Set up translation table entries == == 3. Set up translation table entries ==
-  ​- Use 1MB sections +The Cortex-A9 MPCore processor allows for two levels of translation tables. 
-  ​Set TEX[2:0], C, and B bits to use outer and inner write-back for normal memory, and make device memory ​non-shareable +For simplicity only Level 1 translation tables are used. 
-  ​Set AP[1:0] bits to allow read and write access +A flat one-to-one mapping is used where virtual addresses are mapped to the same physical address. 
-  * +This is done using 1MB '​sections'​. 
 +Since the address space is 4GB, this requires 4096 translation table entries. 
 +The L1 translation table must be aligned 16kB aligned in the memory. 
 + 
 +  * Use 1MB sections 
 +  ​Set TEX[2:0], C, and B bits to use outer and inner write-back for normal memory ​(SDRAM) 
 +  * Set TEX[2:0], C, and B bits to use non-shareable ​device memory for memory-mapped peripherals 
 +  ​Set AP[1:0] bits to allow read and write access 
 +  * Set the domain to 0 (or whatever) 
 +  * Set the section base address of each table entry to point to the appropriate 1MB section of physical memory
  
 == 4. Set translation table control registers == == 4. Set translation table control registers ==
 +  * Set Translation Table Base Control Register (TTBCR) to 0 so that TTBR0 is used
 +  * Set TTBR0 to point to the L1 translation table, and to use inner and outer write-back, write-allocate cacheable memory for translation table walks
  
 == 5. Set domain access control register == == 5. Set domain access control register ==
Line 54: Line 65:
   * Set M bit in SCTLR using MCR/MRC instructions.   * Set M bit in SCTLR using MCR/MRC instructions.
  
-Once these steps are complete the L1 caches, and branch predictor can be turned on+Once these steps are complete the L1 caches, and branch predictor can be turned on by setting the I, C, and Z bits in the SCTLR.
-  * Set I, C, and Z bits in SCTLR using MCR/MRC instructions.+
  
  
Line 90: Line 100:
 Several other options area available as well. Several other options area available as well.
 Both the Cortex-A9 TRM and L2C-310 TRM (linked above) outline several optimizations for L2 memory accesses. Both the Cortex-A9 TRM and L2C-310 TRM (linked above) outline several optimizations for L2 memory accesses.
 +[[http://​infocenter.arm.com/​help/​topic/​com.arm.doc.ddi0246h/​CJACBHHB.html|Link]].
  
 The following features are available when using the L2C-310 cache controller with a Cortex-A9 MPCore processor: The following features are available when using the L2C-310 cache controller with a Cortex-A9 MPCore processor:
Line 100: Line 111:
 These features were all tested during benchmarking;​ however, none of them seemed to offer any performance gains. These features were all tested during benchmarking;​ however, none of them seemed to offer any performance gains.
 Further investigation may may be required to make the best use of these options. Further investigation may may be required to make the best use of these options.
- 
  
  
Line 114: Line 124:
  
  
 +====== Source Code ======
 +This investigation resulted in two files: arm_cache.h and arm_cache.s that together provide functions to turn on the MMU and caches on the ARM Cortex-A9 MPCore in the Altera Cyclone V SoC.
 +
 +   * [[https://​www.dropbox.com/​s/​l2mzqzfq3089emj/​arm_cache.h | arm_cache.h]]
 +   * [[https://​www.dropbox.com/​s/​tq6y2yod3p26yui/​arm_cache.s | arm_cache.s]]
  
  
using_arm_caches.1401585519.txt.gz · Last modified: 2014/05/31 21:18 by bain