您好,欢迎访问三七文档
当前位置:首页 > 商业/管理/HR > 信息化管理 > C28x FLASH 编程
单元10:C28xFLASH编程32-Bit-DigitalSignalControllerTMS320F2812BIOS从Flash存储器的启动顺序H0SARAM(8K)0x3F7FF60x3D80000x3F80000x3FF0000x3FFFC0BootROM(4K)BROMvector(32)0x3FFC00BootCodeRESET0x3FFC00{SCANGPIO}FLASH(128K)Passwords(8)_c_int00LBC–startroutine“rts2800_ml.lib”“user”codesections_c_int00Boot.asmmain(){……return;}23451TMS320F2812Flash存储器映射Data&ProgramSpaceAddressRange0x3D8000–0x3D9FFF0x3DA000–0x3DBFFF0x3DC000–0x3DFFFF0x3E0000–0x3E3FFF0x3E4000–0x3E7FFF0x3E8000–0x3EBFFF0x3EC000–0x3EFFFF0x3F0000–0x3F3FFF0x3F4000–0x3F5FFF0x3F6000–0x3F7F7F0x3F7F80–0x3F7FF50x3F7FF6–0x3F7FF70x3F7FF8–0x3F7FFFSectorJ;8Kx16SectorI;8Kx16SectorH:16Kx16SectorG;16Kx16SectorF;16Kx16SectorE;16Kx16SectorD;16Kx16SectorC;16Kx16SectorB;8Kx16SectorA;(8K-128)x16Programto0x0000whenusingCodeSecurityMode!FlashEntryPoint;2x16SecurityPassword;8x16基本的Flash操作Flashisarrangedinpagesof128addresses等待状态被指定单页内连续访问和页间随即访问OTP只能随即访问必须指定等待状态的SYSCLKOUT始终数复位后默认为最大值!Flash配置代码不能在FLASH存储器上运行!FBANKWAIT@0x000A86RANDWAITreserved1504387PAGEWAITreserved1211FOTPWAIT@0x000A87OTPWAITreserved15043***详细数字参考F281x数据表***For150MHz,PAGEWAIT=5,RANDWAIT=5,OTPWAIT=8For135MHz,PAGEWAIT=4,RANDWAIT=4,OTPWAIT=816or32dispatched1664Aligned64-bitfetch2-leveldeepfetchbuffer64C28xCoredecoderunit加速Flash上的代码执行:FlashPipelining(forcodefetchonly)Flash流水线模式使能0=disable(default)1=enableENPIPEreserved1501FOPT@0x000A80Flash配置寄存器AddressNameDescription0x000A80FOPTFlashoptionregister0x000A82FPWRFlashpowermodesregisters0x000A83FSTATUSFlashstatusregister0x000A84FSTDBYWAITFlashsleeptostandbywaitregister0x000A85FACTIVEWAITFlashstandbytoactivewaitregister0x000A86FBANKWAITFlashreadaccesswaitstateregister0x000A87FOTPWAITOTPreadaccesswaitstateregisterFPWR:将Flash/OTP设为“休眠”或“待机”模式移节约电能。如果访问Flash/OTP,Flash会自动进入激活模式FSTATUS:各种状态位(e.g.PWRmode)FSTDBYWAIT:指定从休眠到待机唤醒的等待时钟数FACTIVEWAIT:指定从待机到激活唤醒的等待始终数这些寄存器的缺省值已比较完善–更多信息请看“TMS320F28xDSPSystemControlandInterruptsReferenceGuide,”SPRU078F28xDSPFLASHCPURAMFlash编程基础DSPCPU自我执行flash编程CPU在RAM中读取Flash数据并写数据到Flash来执行Flash有效代码TheCPUexecutesFlashutilitycodefromRAMthatreadstheFlashdataandwritesitintotheFlash需要将Flash有效代码和Flash数据从Flash搬移到RAMJTAGEmulatorSPIGPIOSCIRS232ROMBootloaderFlashutilitycodeFlashDataFlash编程基础Flash编程的顺序:最少擦除一个扇区最小可以编程一个位!在擦除的时候要非常注意不能断电:如果代码安全模块CSM变为全零,CSM将永久被锁住!当然,发生的几率很小!(擦除是一个扇区一个扇区进行的)1.Erase擦除-复位所有位,然后置位12.Program编程-用0编程所有位3.Verify检验-检验flahs内容AlgorithmFunctionFlash编程设备CodeComposerStudio插件(使用JTAG)*TI的串行Flash装载器(使用SCI启动)*GangProgrammers(使用GPIO启动)BPMicroprogrammerDataI/Oprogrammer定制自己的编程设备Buildyourowncustomutility使用不同的ROM启动装载方法而不是SCI在您的应用设备中嵌入Flash编程由TI提供的FlashAPI算法*TI网站插件代码安全模块(CSM)从被限制的存储器读或写数据只能从被限制的存储器中的代码运行来允许Datareadsandwritesfromrestrictedmemoryareonlyallowedforcoderunningfromrestrictedmemory所有其它数据读/写访问都被封锁:JTAG仿真器/调试器,ROM启动装载器,外部存储器或非限制内部机=存储器的代码运行coderunninginexternalmemoryorunrestrictedinternalmemory访问以下片上存储器是受限制的:LOSARAM(4K)L1SARAM(4K)OTP(1K)FLASH(128K)reserved0x0080000x0090000x3D78000x3D8000reserved0x00A0000x3D7C00CSM密码128-bit用户定义密码被保存在Flash128-bit密钥寄存器用来锁住或解锁设备映射到存储器空间0x000AE0–0x000AE7寄存器“EALLOW”保护0x3F7FF8-0x3F7FFFCSMPasswordLocations(PWL)LOSARAM(4K)L1SARAM(4K)OTP(1K)FLASH(128K)reserved0x0080000x0090000x3D78000x3D8000reserved128-BitPassword0x00A0000x3D7C00CSM寄存器AddressNameResetValueDescription0x000AE0KEY00xFFFFLowwordof128-bitKeyregister0x000AE1KEY10xFFFF2ndwordof128-bitKeyregister0x000AE2KEY20xFFFF3rdwordof128-bitKeyregister0x000AE3KEY30xFFFF4thwordof128-bitKeyregister0x000AE4KEY40xFFFF5thwordof128-bitKeyregister0x000AE5KEY50xFFFF6thwordof128-bitKeyregister0x000AE6KEY60xFFFF7thwordof128-bitKeyregister0x000AE7KEY70xFFFFHighwordof128-bitKeyregister0x000AEFCSMSCR0xFFFFCSMstatusandcontrolregister密钥寄存器–用户可访问;EALLOW保护AddressNameResetValueDescription0x3F7FF8PWL0userdefinedLowwordof128-bitpassword0x3F7FF9PWL1userdefined2ndwordof128-bitpassword0x3F7FFAPWL2userdefined3rdwordof128-bitpassword0x3F7FFBPWL3userdefined4thwordof128-bitpassword0x3F7FFCPWL4userdefined5thwordof128-bitpassword0x3F7FFDPWL5userdefined6thwordof128-bitpassword0x3F7FFEPWL6userdefined7thwordof128-bitpassword0x3F7FFFPWL7userdefinedHighwordof128-bitpassword存储器中的PWL–只由密码保留锁定和解锁CSMCSM在上电和复位时是锁定的解锁CSM:执行对PWL的哑读向密钥寄存器写入密码新的Flash器件(PWL全部为0xFFFF):单密码为0xFFFF–只需一个PWL读即可将器件带入未锁定模式CSM警告不要将PWL’s编程为0x0000这样会永久行的锁住CSMFlash地址0x3F7F80到0x3F7FF5,必须被便称为0x以安全的锁定CSM记住,运行在非安全的RAM中的代码不能访问安全存储器中的数据如果由任何代码从非安全RAM中运行则不要将堆栈连接到安全不要将密码嵌入到你的代码中!通常情况下,CSM只为调试解锁CodeComposerStudio可以解锁CSM密码匹配流FlashdevicesecureafterresetorruntimeDodummyreadofPWL0x3F7FF8–0x3F7FFFStart设备永久性锁住CPU访问被限制–设备不能被调试或者重新编程设备解锁用户可以访问片上安全存储器WritepasswordtoKEYregisters0x000AE0–0x000AE7(EALLOW)protectedCorrectpassword?IsPWL=allFs?IsPWL=all0s?YesYesYesNoNoNoCSMC-CodeExamplesvolatileint*PWL=&CsmPwl.PSWD0;//PointertoPWLregisterfilevolatileinti,tmp;for(i=0;i8;i++)tmp=*PWL++;//DummyreadsofPWLlocationsasm(”EALLOW”);//KEYregsareEALLOWprotectedCsmRegs.KEY0=PASSWORD0;//WritethepasswordsCsmRegs.KEY1=PASSWORD0;//totheKeyregistersCsmRegs.KEY2=PASSWORD2;CsmRegs.KEY3=PASSWORD3;CsmRegs.KEY4=PASSWORD4;C
本文标题:C28x FLASH 编程
链接地址:https://www.777doc.com/doc-3571968 .html