Hi Team,
We are using the NXP S32K588 in an AUTOSAR-based program, with ETAS OS and EB MCAL.
Several MCAL components provide a timeout mechanism where the timeout method can be configured as either:
When the timeout method is configured as OSIF_COUNTER_SYSTEM, the affected drivers attempt to access OSIF counters through OsIf_GetCounter() during their initialization sequence.
Since these driver initialization functions are called from EcuM_Init(), the AUTOSAR OS reports an error via:
ErrorHook => E_OS_CALLEVEL
Our understanding is that this occurs because AUTOSAR OS counter APIs are only permitted to be accessed from valid OS contexts such as Tasks or ISRs, whereas EcuM_Init() executes before the OS scheduler is started.
Could you please advise on the recommended approach to handle this situation? Specifically:
Hi,
thanks, let me ask SW/RTD team if they can provide any additional feedback.
BR, Petr
Hi,
Your analysis seems correct. If a driver configured with OSIF_COUNTER_SYSTEM is initialized from EcuM_Init() before the OS is started, calls to OsIf_GetCounter() may result in E_OS_CALLEVEL, depending on the AUTOSAR OS implementation.
For modules initialized during the pre-OS phase, a common workaround is to avoid using OS-based timing services and use OSIF_COUNTER_DUMMY (or another non-OS timing source) instead.
The exact recommendation may also depend on the ETAS OS implementation and the MCAL/RTD version being used. Could you please share the S32DS and RTD (or MCAL) versions for further verification?
BR, Petr
Hi,
see below feedback from RTD team...
BR, Petr
This timeout configuration (OSIF_COUNTER_SYSTEM / OSIF_COUNTER_DUMMY) is NXP vendor-specific and is not defined by the AUTOSAR standard itself.
The root cause of the E_OS_CALLEVEL error is that OSIF_COUNTER_SYSTEM internally calls OS counter APIs, which are only valid after StartOS() has been called. Since EcuM_Init() executes before StartOS(), calling OS APIs at this stage violates the AUTOSAR OS calling level rules.
Recommended solution:
For all MCAL drivers initialized from EcuM_Init() (pre-OS phase), please configure the timeout method as:
OSIF_COUNTER_DUMMY does not invoke any OS API and is safe to use in pre-OS context