This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Why reset at end of function after recovery from data abort (tms570LS04x)?

Other Parts Discussed in Thread: HALCOGEN

When checkRAMECC(void) is being called in sys_startup.c (HalCoGen 4.05.02) a data-abort is being generated when testing double bit errors (which is good).

When I try to recover stack in abort handler (code below) the remains of checkRAMECC(void) is being executed but then a reset occurs at end of function.

Why would that be?

I also run in problems when recovering from data-abort in other situations but chose this example as OS is not loaded yet and all code except abort-handler is auto-generated.

Many Thanks - Christian

void vDataAbort( void )
{

	volatile portUInt32Type ulDataFaultStatusReg = 0;
	volatile portUInt32Type ulDataFaultAddressReg = 0;

	ulDataFaultStatusReg = ulGetDataFaultStatusRegister();
	ulDataFaultAddressReg = ulGetDataFaultAddressRegister();

	boolean resume = FALSE;
    
	// determine whether to resume execution
	processAbortError(ulDataFaultStatusReg, ulDataFaultAddressReg, DATA_ABORT, &resume);
	if (resume == FALSE)
	{
		// enter endless loop
		prvAbortLoop();
	}
	else
	{
		// recover callstack
		// from https://e2e.ti.com/support/microcontrollers/hercules/f/312/t/170682
		asm(" ldr r0,[sp,#8]");
		asm(" add r0,r0,#4");
		asm(" str r0,[sp,#8]");
	}
}

  • Hi Christian,

      You said all code is generated by HalCoGen. If that is the case then an example abort handler is created in the dabort.asm. The abort handler checks if the abort is due to diagnostic test or abort due to real ECC error. 

      I'm not too sure what caused the reset. You can check the cause of reset by reading the SYSESR register in the SYS module. What I'm also not clear is why you need to write in-line assembly. How/where is the  vDataAbort() called? Since the vDataAbort() is written in C, the compiler should take care of push/popping the stack and return from where it was called. 

  • The HalCoGen generated abort handler does a fantastic job for me - did not know it existed... (edit: for others having lost track of default handlers: it's called _dabort and resides in dabort.asm)

    Thanks for pointing that out, Charles.

    Also, you are absolutely right, I don't need to manipulate the stack within the c-coded abort function (removing in-line assembler code and adding proper fault register clearing resolves the problem).

  • Glad your problem is resolved.