第一次烧写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咯。