您的位置 首页 被动

关于ADS下bootloader之MMU的深入研究

如下是ADS下的boot的MMUc的MMU初始化代码。在2440initS中跳入Main,这个Main函数在U2440momc中实现,这个Main函数包括了对端口,中断服

如下是ADS下的boot的MMU.c的MMU初始化代码。在2440init.S中跳入Main,这个Main函数在U2440mom.c中完成,这个Main函数包含了对端口,中止服务,MMU,VGA等的初始化函数的调用。MMU.c中进行了MMU的初始化,其间调用了许多初始化函数,运用汇编写的,切当的说是用协处理指令写的。这些函数的声明部分在2440slib.h,完成在2440slib.c中。在MMU的初始化程序MMU_Init中,首要制止了Dcache,Icache,清除了Dcache和Icache。制止了MMU,TLB。然后对存储系统进行了虚拟地址到物理地址的映射。然后设置了转化表的基地址,设置了域,敞开了MMU,Icache,Dcache。

void MMU_Init(void)
{
int i,j;
//========================== IMPORTANT NOTE =========================
//The current stack and code area cant be re-mapped in this routine.
//If you want memory map mapped freely, your own sophiscated MMU
//initialization code is needed.
//===================================================================
MMU_DisableDCache();
MMU_DisableICache();
//If write-back is used,the DCache should be cleared.
for(i=0;i<64;i++)
for(j=0;j<8;j++)
MMU_CleanInvalidateDCacheIndex((i<<26)|(j<<5));
MMU_InvalidateICache();

#if 0
//To complete MMU_Init() fast, Icache may be turned on here.
MMU_EnableICache();
#endif

MMU_DisableMMU();
MMU_InvalidateTLB();
//MMU_SetMTT(int vaddrStart,int vaddrEnd,int paddrStart,int attr)
//MMU_SetMTT(0x00000000,0x07f00000,0x00000000,RW_CNB);//bank0
if(rBWSCON&0x6)//nor发动
MMU_SetMTT(0x00000000,0x07f00000,0x00000000,RW_NCNB); //bank0
else//nand 发动
MMU_SetMTT(0x00000000,0x00001000,0/*(int)__ENTRY*/,RW_CB); //bank0
//MMU_SetMTT(0x04000000,0x07f00000,0,RW_NCNB); //bank0
MMU_SetMTT(0x08000000,0x0ff00000,0x08000000,RW_NCNB);//bank1
MMU_SetMTT(0x10000000,0x17f00000,0x10000000,RW_NCNB); //bank2
MMU_SetMTT(0x18000000,0x1ff00000,0x18000000,RW_NCNB); //bank3
//MMU_SetMTT(0x20000000,0x27f00000,0x20000000,RW_CB); //bank4
MMU_SetMTT(0x20000000,0x27f00000,0x20000000,RW_NCNB); //bank4 forSTRATA Flash
MMU_SetMTT(0x28000000,0x2ff00000,0x28000000,RW_NCNB); //bank5
MMU_SetMTT(0x30000000,0x30100000,0x30000000,RW_CB); //bank6-1 1
MMU_SetMTT(0x30200000,0x33e00000,0x30200000,RW_NCNB); //bank6-2 60
//
MMU_SetMTT(0x33f00000,0x33f00000,0x33f00000,RW_CB); //bank6-3
MMU_SetMTT(0x38000000,0x3ff00000,0x38000000,RW_NCNB); //bank7

MMU_SetMTT(0x40000000,0x47f00000,0x40000000,RW_NCNB); //SFR 127
MMU_SetMTT(0x48000000,0x5af00000,0x48000000,RW_NCNB); //SFR 303
MMU_SetMTT(0x5b000000,0x5b000000,0x5b000000,RW_NCNB); //SFR
MMU_SetMTT(0x5b100000,0xfff00000,0x5b100000,RW_FAULT);//not used

MMU_SetTTBase(_MMUTT_STARTADDRESS);
MMU_SetDomain(0x55555550|DOMAIN1_ATTR|DOMAIN0_ATTR);
//DOMAIN1: no_access, DOMAIN0,2″15=client(AP is checked)
MMU_SetProcessId(0x0);
MMU_EnableAlignFault();

MMU_EnableMMU();
MMU_EnableICache();
MMU_EnableDCache(); //DCache should be turned on after MMU is turned on.
}

for(i=0;i<64;i++)
for(j=0;j<8;j++)
MMU_CleanInvalidateDCacheIndex((i<<26)|(j<<5));
MMU_InvalidateICache();

这儿是因为ARM920T有64路,每路有8个组。所以。。。为什么要i<<26,j<<5呢,看下图便知

声明:本文内容来自网络转载或用户投稿,文章版权归原作者和原出处所有。文中观点,不代表本站立场。若有侵权请联系本站删除(kf@86ic.com)https://www.86ic.net/ziliao/beidong/254724.html

为您推荐

联系我们

联系我们

在线咨询: QQ交谈

邮箱: kf@86ic.com

关注微信
微信扫一扫关注我们

微信扫一扫关注我们

返回顶部