您好,欢迎访问三七文档
当前位置:首页 > 办公文档 > 其它办公文档 > 10.系统启动与Boot Loader
1系统启动与BootLoader史先强南京博芯电子技术有限公司2Copyright2007ProchipElectronicsCo,ltd.AllRightsReserved.Nottobereproducedbyanymeanswithoutpriorwrittenconsent.SEP4020地址空间分配CSFCSE(SDRAM)CSB、CSC、CSDCSA(NorFlash)IOESRAM0x040000000x100000000x200000000x30000000MACLCDCDMAEMIGPIO……PMCINTCNand_Data(0x11000200)04G3Copyright2007ProchipElectronicsCo,ltd.AllRightsReserved.Nottobereproducedbyanymeanswithoutpriorwrittenconsent.关于系统启动什么是启动?从CPU内核行为看,启动就是从零地址取第一条指令并执行系统零地址映射硬件设定EMI配置4Copyright2007ProchipElectronicsCo,ltd.AllRightsReserved.Nottobereproducedbyanymeanswithoutpriorwrittenconsent.SEP4020启动方式介绍SEP4020启动方式SystemSetup[2:0]000:NOR启动001:NAND启动3级地址,512byte010:NAND4级地址512byte011:NAND4级地址2Kbyte100:NAND5级地址2KbyteUB4020MB_Lite(V1.1)SystemSetup[0]=0SystemSetup[1]=J501(ON:NorFlash启动,OFF:NandFlash启动)SystemSetup[2]=05Copyright2007ProchipElectronicsCo,ltd.AllRightsReserved.Nottobereproducedbyanymeanswithoutpriorwrittenconsent.NorFlash启动NorFlash读写特性读:可以实现字节寻址写:不能字节寻址,须按页或块写入UB4020EVB上NorFlash地址起始地址:CSA,0x20000000开始结束地址:2MB,0x202000006Copyright2007ProchipElectronicsCo,ltd.AllRightsReserved.Nottobereproducedbyanymeanswithoutpriorwrittenconsent.解决存储与速度的矛盾:BootLoaderNorFlash0x0,0x200000000x30000000SDRAMPCBootLoaderProjectImage7Copyright2007ProchipElectronicsCo,ltd.AllRightsReserved.Nottobereproducedbyanymeanswithoutpriorwrittenconsent.NorFlash启动NorFlash启动一:配置系统环境配置PMUPMU_PCSR、PMU_PMDRPMU_PLTR、PMU_PMCR配置EMIEMI_CSACONF、EMI_CSECONFEMI_SDCONF1、EMI_SDCONF28Copyright2007ProchipElectronicsCo,ltd.AllRightsReserved.Nottobereproducedbyanymeanswithoutpriorwrittenconsent.NorFlash启动NorFlash启动二:将代码拷贝到SDRAMNorFlash启动三:将SDRAM映射到零地址NorFlash启动四:程序跳转9Copyright2007ProchipElectronicsCo,ltd.AllRightsReserved.Nottobereproducedbyanymeanswithoutpriorwrittenconsent.NorFlash启动关于地址重映射--Remap0x00000080/0x20000080:ldrpc,=0x200000880x00000084/0x20000084:movr0,r00x00000088/0x20000088:movr0,r00x0000008C/0x2000008C:movr0,r00x00000090/0x20000090:movr0,r0REMAP0x00000094/0x20000094:ldrr1,=0x110000200x00000098/0x20000098:ldrr2,=0x0000000b0x0000009C/0x2000009C:strr2,[r1]0x200000A0:ldrpc,=0x0Whereis0x000000A0?NorFlash0x00000000/0x30000000:movr1,#0x110000000x00000004/0x30000004:movr0,#0x10000x00000008/0x30000008:addr0,r1,r00x0000000C/0x3000000C:movr2,#0x2000x00000010/0x30000010:addr1,r2,r10x00000014/0x30000014:strr1,[r0]0x00000018/0x30000018:movr1,#0x300000000x0000001C/0x3000001C:movr2,#0x10000x00000020/0x30000020:nop。。。。。。0x00000094/0x30000094:movr1,#0x2100000x00000098/0x30000098:movr2,#0x24000x0000009C/0x3000009C:nop0x000000A0/0x300000A0:addr1,r1,r20x000000A4/0x300000A4:addr1,r1,#0x9b0x000000A8/0x300000A8:strr1,[r0,#0xc]SDRAMIt’shere!10Copyright2007ProchipElectronicsCo,ltd.AllRightsReserved.Nottobereproducedbyanymeanswithoutpriorwrittenconsent.NandFlash启动NandFlash读写特性读:不能字节寻址,须通过命令按页读写:不能字节寻址,须按页或块写入SEP4020的NandFlash控制器FIFO地址:0x11000200FIFO结构:32bit宽,4级深度11Copyright2007ProchipElectronicsCo,ltd.AllRightsReserved.Nottobereproducedbyanymeanswithoutpriorwrittenconsent.NandFlash启动NandFlash启动时的硬件设置SystemSetup[2:0]000:NOR启动001:NAND启动3级地址,512byte010:NAND4级地址512byte011:NAND4级地址2Kbyte100:NAND5级地址2Kbyte系统零地址映射NandFlash控制器FIFO:0x1100020012Copyright2007ProchipElectronicsCo,ltd.AllRightsReserved.Nottobereproducedbyanymeanswithoutpriorwrittenconsent.NandFlash启动NandFlash启动过程上电后,NandFlash控制器向NandFlash发出读命令,读取第一页数据内核从NandFlash控制器的FIFO取指,由于是高位地址选通,低位地址变化不会影响取指FIFO读空后,NandFlash控制控制器再从NandFlash中读取4个字的数据(16BYTE)第一页数据读取并执行完毕,程序控制PC跳转13Copyright2007ProchipElectronicsCo,ltd.AllRightsReserved.Nottobereproducedbyanymeanswithoutpriorwrittenconsent.NandFlash启动NandFlash启动方式的制约不可以使用类似LDRR0,=12345678的伪指令,须用mov指令代替例如:MOVR0,#0x12000000ADDR0,R0,#0x00340000ADDR0,R0,#0x00005600ADDR0,R0,#0x0000007814Copyright2007ProchipElectronicsCo,ltd.AllRightsReserved.Nottobereproducedbyanymeanswithoutpriorwrittenconsent.NandFlash启动NandFlash启动方式的制约不可以在启动代码中使用类似B的跳转指令不可以在启动代码中执行Remap操作启动代码长度必须达到512+16BYTE(以512B/页为例)PC跳转必须放在启动代码的最后一条15Copyright2007ProchipElectronicsCo,ltd.AllRightsReserved.Nottobereproducedbyanymeanswithoutpriorwrittenconsent.NandFlash启动NandFlash启动一:配置EMI:EMI_CSECONF:0x8CFFFFF1EMI_SDCONF1:0x1D004177EMI_SDCONF2:0x8000186016Copyright2007ProchipElectronicsCo,ltd.AllRightsReserved.Nottobereproducedbyanymeanswithoutpriorwrittenconsent.NandFlash启动NandFlash启动二:配置NAND控制器NAND_ADDR1:0x00000200NAND_CONF1:0x06302857NAND_CONF2:0x0011435317Copyright2007ProchipElectronicsCo,ltd.AllRightsReserved.Nottobereproducedbyanymeanswithoutpriorwrittenconsent.NandFlash启动NandFlash启动三:配置DMACDMAC_C0SRCADDR:0x11000200DMAC_C0DSTADDR:0x30001000DMAC_C0CONTROL:0x0021249BDMAC_C0CONFIGRATION:0x31D18Copyright2007ProchipElectronicsCo,ltd.AllRightsReserved.Nottobereproducedbyanymeanswithoutpriorwrittenconsent.NandFlash启动NandFlash启动四:配置必要的寄存器R10:0x11000104R11:0x80000000R9:0x100R8:0x3000100019Copyright2007ProchipElectronicsCo,ltd.AllRightsReserved.Nottobereproducedbyanymeanswithoutpriorwrittenconsent.NandFlash启动NandFlash启动五:写入4条指令到0x300000000x30000000:movr11,[r10]0x30000004:Asubsr9,r9,#0x10x30000008:bneA0x3000000c:movpc,r820Copyright2007Pro
本文标题:10.系统启动与Boot Loader
链接地址:https://www.777doc.com/doc-3252083 .html