网站公告列表

  没有公告

加入收藏
设为首页
联系站长
您现在的位置: 61IC中国电子在线 >> 服务导航 >> 帮助中心 >> C2000 >> 文章正文
  Flash程序如何下载到RAM中           ★★★ 【字体:
Flash程序如何下载到RAM中
作者:61IC    文章来源:本站原创    点击数:    更新时间:2006-12-31    

 

问题如下:

程序烧到flash中后可以运行但是速度慢,我想问问如何将程序从flash中下载到RAM中运行?给点相关资料,或者ti上查,应该查什么关键字?

答案如下:

以F2812举例,
.cmd中
secureRamFuncs    :   LOAD = FLASH_E,   PAGE = 0                /* Used by InitFlash() in SysCtrl.c */
                         RUN =  PRAMH0,    PAGE = 0
                         LOAD_START(_secureRamFuncs_loadstart),
                         LOAD_END(_secureRamFuncs_loadend),
                         RUN_START(_secureRamFuncs_runstart)

实现函数处:
/**********************************************************************
* Function: InitFlash()
* Description: Initializes the F281x flash timing registers.
* Notes:
*  1) This function MUST be executed out of RAM.  Executing it out of
*     OTP/FLASH will produce unpredictable results.
*  2) The flash registers are code security module protected.  Therefore,
*     you must either run this function from L0/L1 RAM, or you must
*     first unlock the CSM.  Note that unlocking the CSM as part of
*     the program flow can compromise the code security.
*  3) Final flash characterization needs to be performed by TI.  The
*     below settings may not meet final specifications, and are for
*     example purposes only.  Check the latest device datasheet for
*     TMS qualified specifications.
**********************************************************************/
#pragma CODE_SECTION(InitFlash, "secureRamFuncs"
void InitFlash(void)
{
        asm(" EALLOW";                                                                        // Enable EALLOW protected register access
        FlashRegs.FPWR.bit.PWR = 3;                                                // Pump and bank set to active mode
        FlashRegs.FSTATUS.bit.V3STAT = 1;                                // Clear the 3VSTAT bit
        FlashRegs.FSTDBYWAIT.bit.STDBYWAIT = 0x01FF;        // Sleep to standby transition cycles
        FlashRegs.FACTIVEWAIT.bit.ACTIVEWAIT = 0x01FF;        // Standby to active transition cycles
        FlashRegs.FBANKWAIT.bit.RANDWAIT = 5;                        // Random access waitstates
        FlashRegs.FBANKWAIT.bit.PAGEWAIT = 5;                        // Paged access waitstates
        FlashRegs.FOTPWAIT.bit.OPTWAIT = 5;                                // Random access waitstates
        FlashRegs.FOPT.bit.ENPIPE = 1;                                        // Enable the flash pipeline
        asm(" EDIS";                                                                        // Disable EALLOW protected register access

/*** Force a complete pipeline flush to ensure that the write to the last register
     configured occurs before returning.  Safest thing is to wait 8 full cycles. ***/

    asm(" RPT #7 || NOP";
}

主程序开始调用函数之前:

        memcpy(        &secureRamFuncs_runstart,
                        &secureRamFuncs_loadstart,
                        &secureRamFuncs_loadend - &secureRamFuncs_loadstart);
        
        InitFlash();

烧到内部flash中速度慢是不是没有设置flash的配置寄存器?可参考如上设置

               欢迎点击进入:TI德州中文网   (国内唯一针对TI应用的中文技术网站)    文章录入:admin    责任编辑:admin 
  • 上一篇文章:

  • 下一篇文章:
  • 发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
    最新热点 最新推荐 相关文章
    通用FLASH烧写工具
    请问如何分片烧写flash
    关于FLASH.CMD的一些问题
    关于FLASH烧写的问题
    烧到Flash的程序,断电再上电…
    Flash烧写
    关于Flash
    TMS320C6205外部flash启动方…
    DM642的FLASH大小的问题
    TI DM642板 flash烧写分享及…
      网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)
    站长:61IC 湘ICP备05002478号