Using MCAL of S32K14x & Compiler abstraction for MCAL Fault Injection tests

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Using MCAL of S32K14x & Compiler abstraction for MCAL Fault Injection tests

817 次查看
Zhai
Contributor I

I am using the MCAL of S32K14x, but I found that some macros in the core code are not defined, such as "MCAL_FAULT_INJECTION_POINT(T_WDG_INJ_TG_0)" used in the "Wdg_ChannelTrigger" function in the wdg module. "T_WDG_INJ_TG_0" cannot find its definition. By searching through the entire file, I found that "MCAL_FAULT_INJECTION_POINT(lable)" is defined in the Mcal.h file, Used to perform Compiler abstraction for MCAL Fault Injection tests. Can you tell me what "Compiler abstraction for MCAL Fault Injection tests "means and where" T_WDG_INJ_TG_0 "is defined.

 

The relevant code is as follows:

LOCAL_INLINE FUNC(void, WDG_CODE) Wdg_ChannelTrigger(CONST(Wdg_IPW_InstanceType, WDG_CONST) Wdg_Instance)
{
    VAR(uint32, AUTOMATIC) u32TempTimeout;
#if (WDG_VALIDATE_GLOBAL_CALL == STD_ON)
    VAR(Std_ReturnType, AUTOMATIC) valid;

    valid = Wdg_ChannelValidateGlobalCall(WDG_TRIGGER_ID, Wdg_Instance);
    if ((Std_ReturnType)E_OK == valid)
    {
#endif /* (WDG_VALIDATE_GLOBAL_CALL == STD_ON */
        SchM_Enter_Wdg_WDG_EXCLUSIVE_AREA_00();

        if( Wdg_au32Timeout[Wdg_Instance] < Wdg_au32GptPeriod[Wdg_Instance])
        {
            MCAL_FAULT_INJECTION_POINT(T_WDG_INJ_TG_0);
            SchM_Exit_Wdg_WDG_EXCLUSIVE_AREA_00();
            Gpt_StopTimer(Wdg_apConfigPtr[Wdg_Instance]->Wdg_TimerChannel);
        }
        else
        {
            u32TempTimeout = Wdg_au32Timeout[Wdg_Instance] - Wdg_au32GptPeriod[Wdg_Instance];
            Wdg_au32Timeout[Wdg_Instance] = u32TempTimeout;
            SchM_Exit_Wdg_WDG_EXCLUSIVE_AREA_00();          
            Wdg_IPW_Trigger(Wdg_Instance);
        }
#if (WDG_VALIDATE_GLOBAL_CALL == STD_ON)
    }
    Wdg_ChannelEndValidateGlobalCall(valid, Wdg_Instance);
#endif /* (WDG_VALIDATE_GLOBAL_CALL == STD_ON */
}
 
 
 
 
#ifdef MCAL_ENABLE_FAULT_INJECTION
#define MCAL_PUT_IN_QUOTES(x) #x
#define MCAL_FAULT_INJECTION_POINT(label) ASM_KEYWORD(MCAL_PUT_IN_QUOTES(label:))
#else
#define MCAL_FAULT_INJECTION_POINT(label)
#endif
0 项奖励
回复
5 回复数

748 次查看
Nhi_Nguyen
NXP Employee
NXP Employee

Hi @Zhai ,

Purpose of fault injection tests is to validate requirements coming from driver FMEA, requirements for error handling not testable only with use of driver function calls or increasing code coverage by activating code paths not reachable without fault creation.

Nhi_Nguyen_0-1699411755952.png

So, T_WDG_INJ_TG_0 is defined in the cmm file that created by tester.

MCAL_FAULT_INJECTION_POINT macro expansion needs to be enabled by –d MCAL_ENABLE_FAULT_INJECTION option defined only in makefiles for fault injection tests, i.e. by default preprocessor does not include them in the code.

Best regards,

Nhi

0 项奖励
回复

731 次查看
Zhai
Contributor I
Thank you for your answer, I want to know which document the screenshot in your reply comes from, I want to read it, but I don't seem to find it in the MCAL code package of S32K14x
0 项奖励
回复

693 次查看
Nhi_Nguyen
NXP Employee
NXP Employee

Hi @Zhai ,

I found it in internal link of NXP. So, I don't know how to share with you. But, if you have any question relate to this, please let me know, I'll try to find it.

Best regards,

Nhi

0 项奖励
回复

677 次查看
Zhai
Contributor I
Thank you.I would like to know if fault injection tests are required; Where the test should be performed; If you want to do this test, what is the phenomenon after the T_WDG_INJ_TG_0 command is defined and executed, and how can I see the phenomenon.
0 项奖励
回复

570 次查看
Nhi_Nguyen
NXP Employee
NXP Employee

Hi Zhai,

This is an example about fault injection test:

Nhi_Nguyen_0-1701931637891.png

It changes variable's value that hard to create to set value of that variable.

Best regards,

Nhi

0 项奖励
回复