Other Parts Discussed in Thread: CONTROLSUITE, C2000WARE
Tool/software: Code Composer Studio
Hi, I am trying to apply the flash api into my software. But one strange issue shows up. As long as I call the FLASH_initAPI() function shows below, then the software will be trapped in memcpy in function FLASH_init(). Can anyone help me with that?
void FLASH_init(void)
{
memcpy(&apiRamRunStart,&apiFlashLoadStart, (size_t)(&apiFlashLoadSize));
memcpy(&RamfuncsRunStart,&RamfuncsLoadStart, (size_t)(&RamfuncsLoadSize));
InitFlash_Bank0();
InitFlash_Bank1();
}
#pragma CODE_SECTION(FLASH_initAPI, "libFuncs");
void FLASH_initAPI(void)
{
Fapi_StatusType oReturnCheck;
EALLOW;
Flash0EccRegs.ECC_ENABLE.bit.ENABLE = 0x0;
//
// Give pump ownership to FMC0(Bank0)
//
PUMPREQUEST = 0x5A5A0002;
//
// This function is required to initialize the Flash API based on
// System frequency before any other Flash API operation can be performed
// Note that the FMC0 register base address is passed as the parameter
//
oReturnCheck = Fapi_initializeAPI(F021_CPU0_W0_BASE_ADDRESS, 200);
if(oReturnCheck != Fapi_Status_Success)
{
/*TODO*/
}
//
// Fapi_setActiveFlashBank function sets the Flash bank0 and FMC0 for
// further Flash operations to be performed on the bank0.
// Note that the parameter passed is Fapi_FlashBank0 since FMC0 register
// base address is passed to Fapi_initializeAPI()
//
oReturnCheck = Fapi_setActiveFlashBank(Fapi_FlashBank0);
if(oReturnCheck != Fapi_Status_Success)
{
/*TODO*/
}
Flash0EccRegs.ECC_ENABLE.bit.ENABLE = 0xA;
EDIS;
}
Below is the cmd file definition:
/*Ram function specific sections*/
.TI.ramfunc: {} LOAD = BOOTF,
RUN = FASTRAM,
LOAD_START(_RamfuncsLoadStart),
LOAD_SIZE(_RamfuncsLoadSize),
LOAD_END(_RamfuncsLoadEnd),
RUN_START(_RamfuncsRunStart),
RUN_SIZE(_RamfuncsRunSize),
RUN_END(_RamfuncsRunEnd),
PAGE = 0, ALIGN(4)
libFuncs: LOAD = FLASHAPI,
RUN = FLASHAPIRAM,
LOAD_START(_apiFlashLoadStart),
LOAD_SIZE(_apiFlashLoadSize),
LOAD_END(_apiFlashLoadEnd),
RUN_START(_apiRamRunStart),
RUN_SIZE(_apiRamRunSize),
RUN_END(_apiRamRunEnd),
PAGE = 0, ALIGN(4)
{
-l F021_API_F2837xS_FPU32.lib <*> (.text)
}