http://portal.osek-vdx.org/
1. OSEK이란?
OSEK(Open Systems and their Interfaces for the Electronics in Motor Vehicles) + VDX(Vehicle Distributed eXecutive)
- Initial Partners of OSEK : BMW, BOSCH, SIEMENS VDO, VOLKSWAGEN AG, DAIMLER CHRYSLER...
- VDX Member : Renault, Psa peugeot, citroen
::Motivation::
-High, recurring expense in the development and variant management of control unit software
-Incompatibility of control units made by different manufactures due to different interfaces and protocols
1-2. Goal
: 어플리케이션 SW를 어떻게 하면 이식성높게 만들수 있을까? SW의 재사용을 어떻게 높일수 있을까?
1-3. System philosophy
1) Standardized interface
: C와 같이 사용가능. System services are specified in an ISO/ANSI-C like syntax
2) Scalability
: Different conformance classes, various scheduling mechanisms, configuration features
3) Error Checking
: 개발단계시 에러체크는 Extended status for development phase로, 양산시 standard status for production phase
4) Portability of application software
: 기본적으로 표준 인터페이스로 개발하기 때문에 어플리케이션의 개발이 매우 쉽다. •A language for a
OIL(OSEK Implementation Language) 라는 OSEK의 표준문법을 사용함 = Portability
5) Support of Portability
: Increase portability of an application between various OSEK implementations
6) Support for automotive requirements(reliability, real-time capability and cost sensitivity)
: Users statically specifies the number of tasks, resources, and alarms
Predictable and documented behavior
1-4. major characters
- Task management (Apps 을 task unit으로 나눠서 스케줄링한다)
- Activation/Termination of tasks
- Management of task states, task switching
Synchronization
- Event control
- Resource management
Interrupt management
Alarms
Intra processor message handling
Error handing, tracing and debugging
- OS provides six hook routines
2. Specification of OSEK OS
" Tree processing levels로 나눠진다. "
- Interrupt level
- Logical level for scheduler
- Task level
2-2. Objectives of Conformance classes
- Provide convenient group of OS features for easier understanding and discussion
: 구분을 통한 높은 가독성과 개발에 편리
- Allow partial implementations
- Create and upgrade path from classes of lesser functionally to classes of higher functionality with no changes
to the application
Task의 분류는 위의 도표와 같이 Basic Task들을 Conformance classes로 나눈다.
구체적인 내용은 아래의 그림참조.
2-3. Task management : Task들을 나누는 이유는 '모듈화'
- Complex control software can be subdivided in parts executed according to their real-time requirements
- A task provide the framework for the execution of functions
- OS provides concurrent and asynchronous execution of tasks
OSEK에서 제공하는 Two different task concepts
: Basic Tasks (left), Extended Tasks (right)
함수같은것.
- Activating a task : System Services, ActivateTask or ChainTask
After activation, the task is ready to execute from the first statement
- Multiple requesting of task activation
: Basic task only, Records parallel activation of a basic task already activated
- Task switching mechanism
Scheduler
- Decides which task shall be started and the triggering of all necessary OSEK OS internal activities
:The scheduler is activated whenever a task switch is possible
2-4 Task Priority
The value 0 is defined as the lowest priority of a task (낮은값이 높은 우선순위를 가진다)
Not support the dynamic priority management (절대적인 우선순위 고정)
:User cannot change it at the time of execution
A preempted task is considered to be the first(oldest) task in the ready list
A task being released from the waiting state is treated like the last(newest) task
**OSEK규격에서 제공하는 스케줄러의 예시
수행중인 Task가 있는데 더 high-priority task가 ready가 되면 기존 Task를 대기로 놓되, 대신 다음번에 가장 높은 순위로 실행시켜준다는 내용..
-Scheduling policy
***Full preemptive scheduling 방식
- Rescheduling points
•Termination of a task : TerminateTask
•Termination of a task witch explicit activating of a successor task : ChainTask (다음실행할 task지정)
•Activating a task at task level : Activate Task
•Explicit wait call : WaitEvent
•Setting an event to a waiting task : SetEvent
•Release of resource : ReleaseResource
•Return from interrupt level to task level
--------------------------------------------------------------------------------------------------------
*** Non preemptive scheduling
-Rescheduling points
•Termination of a task : TerminateTask
•Termination of a task witch explicit activating of a successor task : ChainTask
•Explicit call of scheduler : Schedule
•Explicit wait call : WaitEvent
3. Synchronization
3-1. Event mechanism
- A means of synchronization
- Only provided for extended tasks
- System services
- SetEvent, WaitEvent, GetEvent, ClearEvent
: Task2가 런닝상태있다가 Wait Event() 실행이되면 release 상태나 wait 상태로 간다.
3-2. Event mechanism
1) Synchronization of preemptable extended tasks
2) Synchronization of non preemptable extended tasks
3-3 Resource management
- Co-ordinate concurrent access of several tasks with different priorities to shard resources
- Shared resources
: E.g. scheduler, program sequences, memory or hardware
- System services
: GetResource, ReleaseResource (2가지의 리소스 호출만 존재함/ 동시획득은 못함, 바이너리 세마포어와 동일한원리)
- Ensures that
: * Two tasks cannot occupy the same resource at the same time
* Priority inversion can not occur
-> 우선순위 기반의 스케줄링이라면 위와같은 현상이 일어나지 않지만, 리소스의 공유로 인해 발생한다.
* Deadlocks do not occur by use of these resources
-> 서로의 리소스충돌로 인한 데드락 상태. OSEK에서 Ceiling Protocol 사용을 통하여 위와같은 현상을 예방해준다.
3-4 Priority Ceiling Protocol
- To avoid the problems of priority inversion and deadlocks
- Behavior of priority ceiling protocol
• Each resource has own ceiling priority
• If the task requires a resource, and its current priority is lower that the ceiling priority of the resource, the priority
of the task is raised to the ceiling priority of the resource
• If the task release the resource, the priority of this task is reset to the original priority
-> 우선순위도치나 데드락을 방지한다.
3-5. Interrupt Management
: OSEK에선 2가지로 ISR나누어서 사용한다.
- Two ISR Categories
1) ISR Category 1 : Dose not use an OS System services
2) ISR Category 2 : Can use the OS system service
-Rescheduling
Takes place on termination of the ISR category 2
The number of Interrupt priorities
Depends on the controller and implementation
- Alarms : 반복적으로 발생하는 이벤트를 처리하기 위한 서비스
Services for processing recurring events
- Counters
: Represented by a counter value
•“ticks”, and counter specific constants
- Alarm management
: An alarm will expire when a predefined counter value is reached
Statically assigned at system generation time to
•One counter
•Activates task, sets event or calls alarm-callback routine
Example)
4. Intra Processor Message Handling
-Provided by OSEK COM specification
CCCA, CCCB only
Transmission of data between tasks
-Actions on receiving messages
Generation of an event
Activation of a task
Execution of a callback function
4-2. Hook Routines
: 특정한 상황에서 OS에 의해 호출되는 함수로써, 디버깅이나 모니터링 용도로 사용된다.
OSEK에는 Six hook routines이 존재한다.
- Functions called by OSEK OS
- Have predefined names
- Enable
• Reactions to special situation
: ErrorHook, COMErrorHook
• Monitoring or debugging services
: PreTaskHook, PostTaskHook
• Initialization or finalization by user
: StartupHook, ShutdownHook