Hello,
i'am trying to implement an STC Runtime check into an AUTOSAR Stack using your SafeTI Diagnostic Library.
This is my function which calls the API:
void stlDrv_STC_RuntimeTest(void) { SL_STC_Config stcSelfTestConfig; SL_STC_FailInfo failInfoSTC; /* STC Failure inforamtion */ __disable_irq(); /* execute the test */ stcSelfTestConfig.stcClockDiv = 1; /* STC Clock divider = 1 */ stcSelfTestConfig.intervalCount = 1; stcSelfTestConfig.restartInterval0 = TRUE; /* Start from interval 0 */ stcSelfTestConfig.timeoutCounter = 32760; /* Timeout counter */ /* do lock step test and mark it*/ myFaultInjected = 0x12345678; /* save the core register set */ _CoreRegisterSetSave_(&myCoreRegisterSet[0]); /* save the stacks of the banked registers */ _CoreBankRegisterSetSave_(&myCoreRegisterSet[16]); SL_SelfTest_STC(STC_RUN, TRUE, &stcSelfTestConfig); /* Reentry after CPU Reset */ myFaultInjected = 0x00000000; /* switch back to System Mode */ __asm( " cps #0x1F" ); /* restore stack pointers */ _CoreBankRegisterSetRestore_(&myCoreRegisterSet[16]); SL_SelfTest_Status_STC (&failInfoSTC); if (ST_FAIL == failInfoSTC.stResult) { stlDrvErrorCounter++; } else stlDrvPassCounter++; /* enable the interrupts again, because they have been disabled by the test */ __enable_irq(); }
During my startup code at the very beginning I mask the myFaultInjected variable and jump back into that function. But it seems that there is something wrong because when I connect an debugger after executing I am standing at the Undefined Instruction Exception. Here is the part of the startupcode:
ldr r0, =myFaultInjected ldr r1, [r0] ldr r2, =0x12345678 cmp r1, r2 bne no_stc ldr r0, =myCoreRegisterSet bl _CoreRegisterSetRestore_ no_stc: // Standard init
I attached the executable for you. Maybe it helps. 7612.exe.zip
The API call is @ 0xBE5C
Thanks and Regards,
Christopher