Problems encountered when burning Flash to DSP28335
[Copy link]
I did a SPWM inverter closed-loop test and found that the program ran fine in RAM, but it could not run normally when burned into Flash. I searched a lot of information about this problem (I feel sorry for the newbie...), and finally the problem was solved. I would like to share the solution with you, hoping to help colleagues who have the same experience as me.
First, in TI's official routines, there is a function called DELAY_US(); which is defined in RAM. If you load the program in Flash without copying it to RAM to run it, it may cause the above problems and the program may run away...
This function is used in the ADC initialization program, so pay special attention to it~
My solution is as follows: Pay attention to the configuration in ramfuncs
在F28335.cmd文件中配置如下
SECTIONS
{
/* Allocate program areas: */
.cinit : > FLASHC PAGE = 0
.pinit : > FLASHC, PAGE = 0
.text : > FLASHC 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
/* Allocate uninitalized data sections: */
.stack : > RAMM1 PAGE = 1
.ebss : > RAML4 PAGE = 1
.esysmem : > RAMM1 PAGE = 1
/* Initalized sections go in Flash */
/* For SDFlash to program these, they must be allocated to page 0 */
.econst : > FLASHA PAGE = 0
.switch : > FLASHA PAGE = 0
/* Allocate IQ math areas: */
IQmath : > FLASHC PAGE = 0 /* Math Code */
IQmathTables : > IQTABLES, PAGE = 0, TYPE = NOLOAD
/* Uncomment the section below if calling the IQNexp() or IQexp()
functions from the IQMath.lib library in order to utilize the
relevant IQ Math table in Boot ROM (This saves space and Boot ROM
is 1 wait-state). If this section is not uncommented, IQmathTables2
will be loaded into other memory (SARAM, Flash, etc.) and will take
up space, but 0 wait-state is possible.
*/
/*
IQmathTables2 : > IQTABLES2, PAGE = 0, TYPE = NOLOAD
{
IQmath.lib<IQNexpTable.obj> (IQmathTablesRam)
}
*/
FPUmathTables : > FPUTABLES, PAGE = 0, TYPE = NOLOAD
/* Allocate DMA-accessible RAM sections: */
DMARAML4 : > RAML4, PAGE = 1
DMARAML5 : > RAML5, PAGE = 1
DMARAML6 : > RAML6, PAGE = 1
DMARAML7 : > RAML7, PAGE = 1
/* Allocate 0x400 of XINTF Zone 7 to storing data */
ZONE7DATA : > ZONE7B, PAGE = 1
/* .reset is a standard section used by the compiler. It contains the */
/* the address of the start of _c_int00 for C Code. /*
/* When using the boot ROM this section and the CPU vector */
/* table is not needed. Thus the default type is set here to */
/* DSECT */
.reset : > RESET, PAGE = 0, TYPE = DSECT
vectors : > VECTORS PAGE = 0, TYPE = DSECT
/* Allocate ADC_cal function (pre-programmed by factory into TI reserved memory) */
.adc_cal : load = ADC_CAL, PAGE = 0, TYPE = NOLOAD
/****** *************************************************** ******************/
// RAM
/**************************** ***********************************************/
}
exist Add DSP2833x_CodeStartBranch.asm and DSP2833x_MemCopy.c files to the project.
In the main function, add MemCopy(&RamfuncsLoadStart, after InitSysCtrl(); &RamfuncsLoadEnd, &RamfuncsRunStart);
InitFlash(); function
, please note that the variables in Memcopy should be declared as external variables before the main function.
The above solved my problem, and I hope it can help you too~
|