Subject: Issue with Exception Handling in Application Code on MPC5777C(e200z759CRM)
Description:
I am encountering an issue with exception handling in the application code on the MPC5777C.
Initially, I tested the exception handling functionality in a sample workspace by integrating a few exceptions, and everything worked as expected. However, when I attempted to implement the same logic in the application code, the application stopped functioning properly.
Handler Code:
Below is the handler code I used:
mfspr r22, SRR0
addi r22, r22, 4
mtspr SPRG2, r22 /* Save SRR0 in SPRG2 */
Later, the content of SPRG2 is stored in r4
/* Save SPRG2 in pc */
In the workspace, the injected exceptions are directed to the function present in evb5777_bsp.adb for handing.
The function is defined as follows:
function HaltExceptionHandler (vect: integer) return integer is
begin
return 0;
end;
Additionally, there are four exceptions categorized as "handled by Ada runtime":
Machine check
External interrupt
Floating-point unavailable
Decrement
The exceptions are directed to the procedure present in evb5777_bsp.adb for handing.
procedure BSP_InterruptHandle is
vect: integer;
begin
vect := integer ((INTC.IACKR AND 16#7FF#) / 4); -- Read interrupt vector
-- Call interrupt handler if it exists
if (InterruptHandlers(vect).proc /= null) then
InterruptHandlers(vect).proc(InterruptHandlers(vect).arg);
end if;
INTC.EOIR := 0; -- End of Interrupt
end;
Problem:
External Interrupt Exception Issue
The application generates external interrupt exceptions when data arrives from an external source. This external interrupt is one of the exception in the exception vector table, but they need to be ignored in this context.
The external interrupts occur frequently in the application code and it eventually leads to a machine check exception, causing the application to get stuck.
When a machine check exception arises, it does not reach the handler
Instead, it results in most of the registers becoming "unreadable green hills probe error 12 (interrupt)" is coming
