CCSV8通过JTAG烧写程序到FLASH的方法

在初始化过后,添加一行代码如下,即可通过JTAG口烧写程序到flash内,断电再次恢复上电也可运行。 如果没有这段代码,烧写后,原本程序会被擦除,新程序也没有保存,断电上电后,DSP内应该没有程序运行

#ifdef FLASH
	MemCopy(&RamfuncsLoadStart, &RamfuncsLoadEnd, &RamfuncsRunStart);
    InitFlash();
    #endif

这段代码可以添加在中断初始化之后,比如下面:

InitPieCtrl();
	// Disable CPU interrupts and clear all CPU interrupt flags:
    IER = 0x0000;
    IFR = 0x0000;
    
	// Initialize the PIE vector table with pointers to the shell Interrupt Service Routines (ISR).
	InitPieVectTable();



	#ifdef FLASH
	MemCopy(&RamfuncsLoadStart, &RamfuncsLoadEnd, &RamfuncsRunStart);
    InitFlash();
    #endif



 /**************step5:interrupts******************************
 * All interrupts entry address:
 *************************************************************/
EALLOW;
   PieVectTable.TINT0 = &ISRTimer0;
   PieVectTable.XINT3 = &ISRExint3;
经验分享 程序员 微信小程序 职场和发展