FLASH烧写(简单概括)

第一次烧写flash,烧写成功还是有些兴奋。

昨天给今天定的任务就是弄会如何烧写flash,今天算是完成任务了。

程序在ram里仿真成功后,就要烧到flash里。

首先要修改cmd文件。

MEMORY
{
PAGE 0:   
          
   RAML0       : origin = 0x008000, length = 0x001000    
   OTP         : origin = 0x3D7800, length = 0x000400    
   FLASHH      : origin = 0x3D8000, length = 0x004000    
   FLASHG      : origin = 0x3DC000, length = 0x004000    
   FLASHF      : origin = 0x3E0000, length = 0x004000    
   FLASHE      : origin = 0x3E4000, length = 0x004000    
   FLASHD      : origin = 0x3E8000, length = 0x004000    
   FLASHC      : origin = 0x3EC000, length = 0x004000    
   FLASHA      : origin = 0x3F4000, length = 0x003F80    
   CSM_RSVD    : origin = 0x3F7F80, length = 0x000076    
   BEGIN       : origin = 0x3F7FF6, length = 0x000002    
   CSM_PWL     : origin = 0x3F7FF8, length = 0x000008    
  
   ROM         : origin = 0x3FF000, length = 0x000FC0    
   RESET       : origin = 0x3FFFC0, length = 0x000002    
   VECTORS     : origin = 0x3FFFC2, length = 0x00003E    

PAGE 1 :  
              
   RAMM0       : origin = 0x000000, length = 0x000400    
   BOOT_RSVD   : origin = 0x000400, length = 0x000080    
   RAMM1       : origin = 0x000480, length = 0x000380    
   RAML1       : origin = 0x009000, length = 0x001000    
   FLASHB      : origin = 0x3F0000, length = 0x004000    
   RAMH0       : origin = 0x3FA000, length = 0x002000    
}


 
SECTIONS
{ 
   .cinit              : > FLASHA      PAGE = 0
   .pinit              : > FLASHA,     PAGE = 0
   .text               : > FLASHA      PAGE = 0
   codestart           : > BEGIN       PAGE = 0
   ramfuncs            : LOAD = FLASHD,
                         RUN = RAML0,
                         LOAD_START(_RamfuncsLoadStart),
                         LOAD_END(_RamfuncsLoadEnd),
                         RUN_START(_RamfuncsRunStart),
                         PAGE = 0

   csmpasswds          : > CSM_PWL     PAGE = 0
   csm_rsvd            : > CSM_RSVD    PAGE = 0
  
   .stack              : > RAMM0       PAGE = 1
   .ebss               : > RAML1       PAGE = 1
   .esysmem            : > RAMH0       PAGE = 1
  
   .econst             : > FLASHA      PAGE = 0
   .switch             : > FLASHA      PAGE = 0     
 
   IQmath              : > FLASHC      PAGE = 0                 
   IQmathTables        : > ROM         PAGE = 0, TYPE = NOLOAD  
  
   .reset              : > RESET,      PAGE = 0, TYPE = DSECT
   vectors             : > VECTORS     PAGE = 0, TYPE = DSECT

}

然后在主函数中

// These are defined by the linker
extern Uint16 RamfuncsLoadStart;
extern Uint16 RamfuncsLoadEnd;
extern Uint16 RamfuncsRunStart;

int main()
{
 InitSysCtrl();
 InitEPwm1Gpio();
 DINT;
 InitPieCtrl();
 IER = 0x0000;
 IFR = 0x0000;
 InitPieVectTable();

 MemCopy(&RamfuncsLoadStart, &RamfuncsLoadEnd, &RamfuncsRunStart);
 InitFlash();

这样子,再重新编译工程,生成.out文件。

然后再用flash烧写插件将.out文件烧到flash里就ok了。

然后还要拔掉仿真器,重启电源,OK咯。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值