IT博客汇
  • 首页
  • 精华
  • 技术
  • 设计
  • 资讯
  • 扯淡
  • 权利声明
  • 登录 注册

    uboot for tiny4412中MMU虚拟地址的设置

    techbulo发表于 2015-10-20 12:40:13
    love 0

    以下为U-Boot中的代码,   从注释中可以看到 真个地址映射关系:

    
    enable_mmu:
    /* enable domain access */
    ldr r5, =0x0000ffff
    mcr p15, 0, r5, c3, c0, 0 @load domain access register
    
    /* Set the TTB register */
    ldr r0, =mmu_table
    ldr r1, =CONFIG_PHY_UBOOT_BASE
    ldr r2, =0xfff00000
    bic r0, r0, r2
    orr r1, r0, r1
    mcr p15, 0, r1, c2, c0, 0
    
    /* Enable the MMU */
    mmu_on:
    mrc p15, 0, r0, c1, c0, 0
    orr r0, r0, #1
    mcr p15, 0, r0, c1, c0, 0
    nop
    nop
    nop
    nop
    mov pc, lr
    
    
    
    /*
    * MMU Table for SMDKC210
    * 0x0000_0000 -- 0x1FFF_FFFF => A:0x0000_0000 -- 0x1FFF_FFFF
    * 0x2000_0000 -- 0x3FFF_FFFF => Not Allowed
    * 0x4000_0000 -- 0x5FFF_FFFF => A:0x4000_0000 -- 0x5FFF_FFFF
    * 0x6000_0000 -- 0xBFFF_FFFF => Not Allowed
    * 0xC000_0000 -- 0xDFFF_FFFF => A:0x4000_0000 -- 0X5FFF_FFFF
    * 0xE000_0000 -- 0xFFFF_FFFF => Not Allowed
    */
    
    /* form a first-level section entry */
    .macro FL_SECTION_ENTRY base,ap,d,c,b
    .word (\base << 20) | (\ap << 10) | \
    (\d << 5) | (1<<4) | (\c << 3) | (\b << 2) | (1<<1)
    .endm
    
    .section .mmudata, "a"
    .align 14
    
    // the following alignment creates the mmu table at address 0x4000.
    .globl mmu_table
    mmu_table:
    
    .set __base,0
    // Access for iRAM
    .rept 0x200
    FL_SECTION_ENTRY __base,3,0,0,0
    .set __base,__base+1
    .endr
    
    // Not Allowed
    .rept 0x400 - 0x200
    .word 0x00000000
    .endr
    
    .set __base,0x400
    // 512MB for SDRAM with cacheable
    .rept 0x800 - 0x400
    FL_SECTION_ENTRY __base,3,0,1,1
    .set __base,__base+1
    .endr
    
    // access is not allowed.
    .rept 0xc00 - 0x800
    .word 0x00000000
    .endr
    
    .set __base,0x400
    // 512MB for SDRAM with cacheable
    .rept 0xE00 - 0xC00
    FL_SECTION_ENTRY __base,3,0,1,1
    .set __base,__base+1
    .endr
    
    // access is not allowed.
    .rept 0x1000 - 0xE00
    .word 0x00000000
    .endr
    
    


沪ICP备19023445号-2号
友情链接