hi,dear:
I was doing the CPU Fetch Protection. testCPUFetchFunc()function is located in ramls6 on page0. ramls6 is set to cpu fectch protection. but it stuck in illegalISR, and will not return to normal program.
the following is the running step by step.
can you check where is wrong?
thanks




#pragma CODE_SECTION(testCPUFetchFunc,"ramls6");
void testCPUFetchFunc(void);
uint32_t generateMasterCPUFetchViolation()
{
uint16_t fail = 0U;
uint16_t timeout = ISR_LOOP_TIMEOUT;
//
// Enable violation interrupt
//
MemCfg_enableViolationInterrupt(MEMCFG_MVIOL_CPUFETCH);
//
// Set fetch protection which generates master CPU fetch violation in
// case of CPU fetch.
//
MemCfg_setProtection(MEMCFG_SECT_LS6, MEMCFG_PROT_BLOCKCPUFETCH);
//
// Clear access violation status variables
//
illegalISRFlag = false;
violationISRFlag = false;
violationAddr = 0U;
violationStatus = 0U;
//
// Calling this function (which has been placed in LS6) will cause a CPU
// fetch access violation.
//
testCPUFetchFunc();
//
// The violation will generate both an ITRAP interrupt and the RAM access
// violation interrupt.
//
while(((illegalISRFlag != true) || (violationISRFlag != true)) &&
(timeout != 0U))
{
timeout--;
}
//
// Disable interrupt.
//
MemCfg_disableViolationInterrupt(MEMCFG_MVIOL_CPUFETCH);
//
// Check if interrupt occurred as expected or if the loop timed out.
//
if(timeout == 0U)
{
fail++;
}
return(fail);
}
void testCPUFetchFunc(void)
{
NOP;
}
__interrupt void illegalISR(void)
{
illegalISRFlag = true;
//
// Need to remove the protection on LS1RAM to allow us to return.
//
MemCfg_setProtection(MEMCFG_SECT_LS6, MEMCFG_PROT_ALLOWCPUFETCH);
MemCfg_setCLAMemType(MEMCFG_SECT_LS6, MEMCFG_CLA_MEM_DATA);
}



