Tool/software: Code Composer Studio
Hi,
Compiler:Code Composer Studio 9.0.1.
When debugging FLASH erase, enter illegal interrupt problem.
-
The erase FLASH program is performed as follows:
void vErase()
{
//.....omit
NOP;
NOP;
Boot_FlashErase();
//....omit
}
#pragma CODE_SECTION(Boot_FlashErase, ".TI.ramfunc");
void Boot_FlashErase(void)
{
uint32 u32Index = 0;
uint16 i = 0;
Fapi_StatusType oReturnCheck;
Fapi_FlashStatusType oFlashStatus;
Fapi_FlashStatusWordType oFlashStatusWord;
//EALLOW;
oReturnCheck = Fapi_initializeAPI(F021_CPU0_BASE_ADDRESS, 100);
if(oReturnCheck != Fapi_Status_Success)
{
// Check Flash API documentation for possible errors
Example_Error(oReturnCheck);
}
oReturnCheck = Fapi_setActiveFlashBank(Fapi_FlashBank0);
// Check Flash API documentation for possible errors
if(oReturnCheck == Fapi_Status_Success)
{
for(i = 0; i < EraseSectorNum; i++)
{
// Erase Flash Bank0 sector6
oReturnCheck = Fapi_issueAsyncCommandWithAddress(Fapi_EraseSector,
(uint32 *)(Bzero_Sector5_start + 0x1000 * i));
// Wait until FSM is done with erase sector operation
while (Fapi_checkFsmForReady() != Fapi_Status_FsmReady){}
/* if(oReturnCheck != Fapi_Status_Success)
{
// Check Flash API documentation for possible errors
Example_Error(oReturnCheck);
}*/
}
}
// Read FMSTAT register contents to know the status of FSM after
// erase command to see if there are any erase operation related errors
oFlashStatus = Fapi_getFsmStatus();
if(oFlashStatus != 0)
{
FMSTAT_Fail();
}
// Do blank check
// Verify that Bank0 sector6 is erased. The Erase command itself does a verify as
// it goes. Hence erase verify by CPU reads (Fapi_doBlankCheck()) is optional.
/* oReturnCheck = Fapi_doBlankCheck((uint32 *)Bzero_Sector15_start,
Sector8KB_u32length,
&oFlashStatusWord);
if(oReturnCheck != Fapi_Status_Success)
{
// Check Flash API documentation for error info
Example_Error(oReturnCheck);
}*/
}
- When I add one more NOP function to the vErase function, the program execution wipes FLASH with no problem.as follows:
void vErase()
{
//.....omit
NOP;
NOP;
NOP;
Boot_FlashErase();
//....omit
}
- Question:
- Why does initializing the API function to perform erasing FLASH enter an illegal interrupt?
- Why is it ok to add one more NOP statement to the program?
- Adding empty statements only increases storage space. Why does it affect API function execution?
