Documente Academic
Documente Profesional
Documente Cultură
Overview
Automotive Domain
OSEK/VDX
AUTOSAR
Summary
Infotainment
Cruise control
Navigation
Fuel-injection
Cars Today
Safety critical
• traffic deaths:
• 19.193 in 1970 (16.8 mil. vec.)
• 3.606 in 2012 (51.7 mil. vec.)
In 2000
Infotainment: 32-Bit MCU, 4 Mbyte RAM, 32 Mbyte ROM, MMU
ECUs: 8 or 16-Bit MCU, 64 Kbyte RAM, 2 Mbyte ROM
Today
Infotainment: 32-Bit MCU, 512 Mbyte RAM, Gbytes of Flash,
MMU
ECUs: 8/16/32-Bit MCU, 4 Mbyte RAM, 256 Mbyte Flash/ROM,
MPU
Tomorrow
Multi-Core, Lock-step
Overview
Automotive Domain
OSEK/VDX
AUTOSAR
Summary
Infotainment
Linux (RT Linux, Android)
VxWorks
Windows CE
ECUs
Infinite main loop (past)
OSEK/VDX
AUTOSAR (since 2005)
Infinite Loop
Read sensors
Process data
Control actuators
10
task 1
Usually requires an operating system job 1
job 2
Jobs can be allocated to different tasks
task 2
When an event occurs, the task that is
responsible for processing the event is job 3
activated
11
Tasks
Concepts
Several Tasks are defined, where each task executes one or more
jobs. The operating system scheduler determines which task should
currently be executed.
12
Preemptable
Non-preemptable
13
14
priority
periodic
task
running
ready
sporadic
task
background
task
time
0 1 2 3 4 5 6 7
15
Example:
16
priority
Task 1
running
ready
Task 3
deadline
Task 2
time
0 5 10 15 20 25 30 35
17
Concurrency
18
TASK(B) {
/* ... */
counter++;
/* ... */
}
19
Concurrency
Task A Task B
increase
read counter
increase
20
Mutual Exclusion (Mutex) ensures that two tasks are not in their
critical section at the same time.
Disable interrupts
Lock
Semaphore
Atomic operations
Spin-lock
…
21
Concurrency
Disable/Enable Interrupts
Prevent task switching by disabling interrupts
TASK(A) {
/* ... */
DisableAllInterrupts();
counter++;
EnableAllInterrupts();
/* ... */
}
TASK(B) {
/* ... */
DisableAllInterrupts();
counter++;
EnableAllInterrupts();
/* ... */
}
22
Disable/Enable Interrupts
Strengths:
Low overhead on common MCUs
Limitations:
Error-prone (e.g. missing enable interrupts)
Increased interrupt latency
Not suitable for multi-core systems
23
Concurrency
Synchronization Issues:
24
Priority inversion
task1
running
task2
critical section
wait
task3 ready
time
2 4 6
1 3 5 7
25
Concurrency
pthread_mutexattr_setprotocol(attr, PTHREAD_PRIO_INHERIT);
26
task1 running
critical section
wait
task2
ready
task3
time
2 4 6 8
1 3 5 7
Resources
mutual
Resources are data structures Task exclusion Task
for the protection of critical or or
regions ISR ISR
Example: exclusive access to a
port or a memory location
GetResource(X)
ReleaseResource(X)
Task B
Resource X
Read / Write
Read / Write Memory XY
Task A GetResource(X)
ReleaseResource(X)
TASK(A) TASK(B)
{ {
GetResource(ResX); GetResource(ResX);
/* access memory XY */ /* access memory XY */
ReleaseResource(ResX); ReleaseResource(ResX);
} }
Resources
task1
running
task2
critical section
ready
task3
time
2 4 6 8
1 3 5 7
Events
TASK(A)
{
SetEvent(SimpleServer, My_Ev1);
TerminateTask();
}
Task
A
TASK(SimpleServer)
Event
{
EventMaskType current;
for(;;)
{
WaitEvent(My_Ev1 | My_Ev2);
GetEvent(SimpleServer, ¤t);
ClearEvent(current);
if(current & My_Ev1)
{ /* work */
}
if(current & My_Ev2)
{ /* work */ Task
}
}
SimpleServer
TerminateTask();
}
Interrupts
35
Interrupts
36
37
Cat1 Interrupts
38
39
Combining Approaches
40
Synchronization is necessary
Approaches:
Disabling Interrupts
Using operating system mechanisms
Queues, semaphores, mutexs
Needs to be non-blocking in ISR!
41
Overview
Automotive Domain
OSEK/VDX
AUTOSAR
Summary
42
AUTOSAR Idea
Application Software
Software
standardized
AUTOSAR
HW-specific
Hardware
Hardware
Architecture:
Software architecture including a complete basic software stack
for ECUs – the so called AUTOSAR Basic Software – as an
integration platform for hardware independent software
applications.
Architecture
Methodology:
Exchange formats or description templates to enable a
seamless configuration process and integration of application
Application software. (e.g. SW component description)
Methodology
Interfaces
Application Interfaces:
Specification of interfaces of typical automotive applications
from all domains in terms of syntax and semantics, which should
serve as a standard for application software.
AUTOSAR Advantages
Standard based
„cooperation in standardization and competition in
implementation“
AUTOSAR Members
11 Development
9 Core Partners
Members
88 Associate Members
57 Premium Member 17 Attendees
Introduction
Basic AUTOSAR Approach
Application
Interfaces Virtual Functional Bus
Methodology
ECU I ECU II ECU m
Introduction
Basic AUTOSAR Approach
Software
Component SW-C SW-C SW-C SW-C
Description A B C n
Ports and
Interfaces
Assembly
connectors
Virtual Functional Bus
Introduction
Ports
P-Port1
R-Port1
P-Port2
R-Port2
S/R R-Port1:Interface2
P-Port2:Interface3
R-Port2:Interface4 C/S
Introduction
Sender-Receiver Communication
Introduction
Client-Server Communication
Synchronous call
Rte_Call will not return until result is available (blocking)
Asynchronous call
Rte_Call will initiate operation but will return immediately
(non-blocking)
Rte_Result will provide the result (non-blocking or blocking)
AUTOSAR BENEFITS
Yesterday AUTOSAR
SERVICE LAYER
Hardware
CAN
COM DCM SM
NM
WDG MGR
COMM
ECU MANAGER
NVRAM
DEM
DET
FIM
LIN
MANAGER PDUR SM I/O
FR CAN
IPDUM NM HARDWARE
FR CAN LIN FR NM
TP TP TP SM ABSTRACTION
MEMORY ABSTRACTION IF
BSW SHEDULER
CAN LIN FR
WDG EXT EXT CAN LIN FR
TRCV TRCV TRCV
DRV EEPROM DRV FLASH DRV DRV DRV DRV
FLASH CHECK
EEPROM DRV
FLASH DRV
RAM TEST
MCU DRV
PORT DRV
WDG DRV
GPT DRV
PWM DRV
CAN DRV
DIO DRV
LIN DRV
ADC DRV
SPI DRV
ICU DRV
FR DRV
Hardware
Application
Interfaces Virtual Functional Bus
Methodology
ECU I ECU II ECU m
RTE/BSW CONFIGURATION
Examples: BSW
Number of CAN channels
CAN frames
ECU power states
95% configuration and 5% implementation
Flash memory blocks
OS tick time
SW-C SW-C
Examples: A B
Data Types
Communication signals RTE
Scheduling BSW
Inter task communication
Based on this configuration, the RTE will provide the necessary APIs
OS SCG
OS Configuration .h/.c
CAN SCG
RTE .h/.c
Typically there is one SCG per module in the BSW layer. The RTE
is also generated using an SCG.
The generated configuration files will together with the static BSW module
implementation files form a complete compilable module
BSW Module.o
BSW Module
Configuration .h/.c
Example of GCEs:
EB tresos Studio
Mecel Picea Workbench
Geensoft GCE
Vector DaVinci Configurator Pro
…
Example of AATs:
dSpace SystemDesk
Geensoft AUTOSAR Builder
Vector DaVinci Developer
Mecel Picea Workbench
Memory protection
Timing protection
Service protection
Schedule tables
Inter-OS-Application Communicator (IOC)
73
Schedule Table
Os iterates over the Schedule Table and processes each expiry point in
turn
ActivateTask
ActivateTask
One shot
Periodic
Automotive Domain
Biggest R&D Sector in Europe
Network of ECUs
OSEK/VDX
The most popular OS?
Keep It Small and Simple
AUTOSAR
Software as a Component
The ECU Middleware