OSEK-targeted applications have special requirements:
1. For each Counter, an overflow Task named<counter_name>_OVERFLOW
is generated. This includes the task declaration (found inos_decl.h
) and body code (found inglob_func.c
).
2. In each Task there is overflow management provided only for the Timeouts variables that are referring to the specific counter.
3. For each Counter, an Alarm named<counter_name>_ALARM
is generated. This includes the alarm declaration (found inos_decl.h
) and installation (found inmacro_def.h
). In themacro_def.h
file, a new macro is generated:#define SET_ADDITIONAL_OVERFLOW_ALARMS() {\
SetAbsAlarm(<counte_name>_ALARM, 0,
This macro installs all the overflow alarms that activates the overflow tasks. A call to this macro is in the file
<profile>.c
after the installation of theSYS_TIMER_ALARM
(formerly known asSYS_TIME_OVERFLOW
).Compare that to non-OSEK implementations:
1. For each counter, an overflow function named on<counter_name>_OVERFLOW
is generated. In each Task, overflow management is provided only for the Timeouts variables that refer to that specific counter.
2. IMPORTANT - there is no call to these functions in the generated code. Therefore, in order to use them, additional code should be added by the developer that decides when to call these functions (on overflow), possibly inusercode.c
.Note: Set from within the Code Generation Profile Editor. Use Options->Settings->General->Timeout Variable Type.The goal is to have a variable that is bigger then the counter, thus avoiding the “value overflow” problem.
Note: (OSEK only) When a TASK/ISR has related timeouts, MicroC calls GetResource(RES_SCHEDULER)/ ReleaseResource(RES_SCHEDULER) around the code section that swaps the TASK/ISR event buffer, and both before and after the call to genTmEvent(...) in on<TIMER>OVERFLOW Tasks (in the fileglob_func.c)
. This resource usage can be avoided. Within the Code Generation Profile Editor, select Options > OS TAB > Allow "GetResource(RES_SCHEDULER) Usage. Uncheck this option.