EB tresos Classic AUTOSAR:
OS Introduction and Application
In-depth analysis of AUTOSAR OS, covering task management, interrupt handling, scheduling mechanisms, and system protection, ensuring the real-time performance and safety of vehicle systems.
This article is based on the video content of 'AUTOSAR OS Introduction and Application' provided by Elektrobit. The Operating System (OS) is an important module of real-time systems. For automotive real-time control systems, the function and performance of the operating system directly determine the real-time performance and safety of the entire system. In the AUTOSAR architecture, the OS has always been a focus. From OSEK OS to AUTOSAR OS, there are both inherited parts and newly added parts.
In the video, the Elektrobit instructor explains the main content of AUTOSAR OS in an easy-to-understand way. The training is divided into four main parts: OS Overview, Detailed Overview of OS, Main Features of OS, and Feature Application of OS.
1. Origins and Characteristics of AUTOSAR OS
AUTOSAR OS did not come out of nowhere; it is based on the successful OSEK/VDX specification and adds more extended features to meet modern automotive electronics needs:
-
memory
Static Configuration: Unlike general-purpose operating systems (such as Windows/Linux), the number of tasks, priorities, and resource allocation in AUTOSAR OS are completely determined before compilation, and tasks cannot be created dynamically during runtime, ensuring high system reliability.
-
timer
Real-time: Adopts a priority-based scheduling algorithm to ensure critical tasks can be completed within strict time limits.
2. Task Management: Basic Task and Extended Task
The core of the OS is managing 'Tasks'. The video highlights the key differences between the two:
Basic Task
- Simple States:Only Suspended, Ready, and Running.
- Features:Single execution path. Once it starts running, it will not stop unless preempted by a higher priority task or finishes itself.
Extended Task
- State Added:Adds a 'Waiting' state.
- Features:Can pause execution to wait for a certain Event, suitable for scenarios with complex logic that need to synchronize external signals.
3. Interrupt Handling: ISR1 and ISR2
The OS's handling of hardware interrupts is divided into two categories, which directly affect the system's response speed and stability:
flash_on Category 1 (ISR1)
Management Method:Not managed by the OS, jumps and executes directly.
Advantages:Minimal overhead, lowest latency.
Limitations:Cannot call any OS API, suitable for extremely high-frequency and simple hardware triggers.
sync Category 2 (ISR2)
Management Method:Managed by the OS framework.
Advantages:Can safely trigger tasks or set events, achieving synchronization between interrupts and tasks.
4. Time and Scheduling Mechanisms
To achieve periodic operations, the OS provides a complete set of tools:
Counters
The basis of system time, usually driven by a hardware timer.
Alarms
Trigger a specific action (such as starting a task) when the counter reaches a set value.
Schedule Tables
Encapsulates multiple actions in a time sequence, precisely controlling the phase difference of multiple tasks.
5. System Protection Mechanisms (Protection)
Under high ASIL level requirements, the OS provides strong protection features to prevent failure propagation:
-
shield
Memory Protection: Prevents tasks from illegally accessing memory areas that do not belong to them.
-
hourglass_disabled
Timing Protection: Monitors whether a task exceeds execution time, preventing a single task from crashing and paralyzing the entire system.
-
layers
Stack Monitoring: Detect stack overflow to ensure data integrity.
6. Actual Application Workflow
In tools like EB tresos, developers will take the application layer's defined Runnables mapped to the OS Tasks , and configure Alarms to drive these Tasks to execute periodically. Ultimately, the code generated by the OS will be tightly integrated with the underlying Microcontroller Abstraction Layer (MCAL) to drive the operation of the entire ECU.
This article summarizes the core technical framework of the OS in the video. From static configuration to multi-level protection mechanisms, AUTOSAR OS provides the lowest-level guarantee for the safety and precise control of vehicles.