AutoSAR Operating System Specification
Table of Content
1 Introduction and functional overview ................................................................. 10
2 Acronyms and abbreviations ............................................................................. 11
2.1 Glossary of Terms ...................................................................................... 11
3 Related documentation...................................................................................... 16
3.1 Input documents ......................................................................................... 16
3.2 Related standards and norms .................................................................... 17
3.2.1 OSEK/VDX .......................................................................................... 17
3.2.2 HIS ...................................................................................................... 17
3.3 Company Reports, Academic Work, etc. .................................................... 18
3.4 Related specification .................................................................................. 18
4 Constraints and assumptions ............................................................................ 19
4.1 Existing Standards ..................................................................................... 19
4.2 Terminology ............................................................................................... 19
4.3 Interaction with the RTE ............................................................................. 19
4.4 Operating System Abstraction Layer (OSAL) ............................................. 20
4.5 Multi-Core Hardware assumptions ............................................................. 20
4.5.1 CPU Core features .............................................................................. 20
4.5.2 Memory features ................................................................................. 21
4.5.3 Multi-Core Limitations ......................................................................... 21
4.6 Limitations .................................................................................................. 22
4.6.1 Hardware............................................................................................. 22
4.6.2 Programming Language ...................................................................... 22
4.6.3 Miscellaneous ..................................................................................... 23
4.7 Applicability to car domains ........................................................................ 23
5 Dependencies to other modules ........................................................................ 24
5.1 File structure .............................................................................................. 24
5.1.1 Code file structure ............................................................................... 24
5.1.2 Header file structure ............................................................................ 24
6 Requirements Traceability ................................................................................. 26
7 Functional specification ..................................................................................... 43
7.1 Core OS ..................................................................................................... 43
7.1.1 Background & Rationale ..................................................................... 43
7.1.2 Requirements ...................................................................................... 43
7.2 Software Free Running Timer .................................................................... 46
7.3 Schedule Tables......................................................................................... 47
7.3.1 Background & Rationale ..................................................................... 47
7.3.2 Requirements ...................................................................................... 47
7.4 Schedule Table Synchronization ................................................................ 54
7.4.1 Background & Rationale ..................................................................... 54
7.4.2 Requirements ...................................................................................... 56
7.5 Stack Monitoring Facilities .......................................................................... 63
7.5.1 Background & Rationale ..................................................................... 63
Specification of Operating System
AUTOSAR Release 4.2.2
5 of 247 Document ID 034: AUTOSAR_SWS_OS
- AUTOSAR confidential -
7.5.2 Requirements ...................................................................................... 64
7.6 OS-Application ........................................................................................... 64
7.6.1 Background & Rationale ..................................................................... 64
7.6.2 Requirements ...................................................................................... 66
7.7 Protection Facilities .................................................................................... 68
7.7.1 Memory Protection .............................................................................. 68
7.7.2 Timing Protection ................................................................................ 71
7.7.3 Service Protection ............................................................................... 77
7.7.4 Protecting the Hardware used by the OS ............................................ 83
7.7.5 Providing »Trusted Functions« ............................................................ 84
7.8 Protection Error Handling ........................................................................... 85
7.8.1 Background & Rationale ..................................................................... 85
7.8.2 Requirements ...................................................................................... 86
7.9 Operating System for Multi-Core ................................................................ 88
7.9.1 Background & Rationale ..................................................................... 88
7.9.2 Scheduling .......................................................................................... 89
7.9.3 Locatable entities (LE) ........................................................................ 90
7.9.4 Multi-Core start-up concept ................................................................. 91
7.9.5 Cores under control of the AUTOSAR OS .......................................... 93
7.9.6 Cores which are not controlled by the AUTOSAR OS ......................... 94
7.9.7 Multi-Core shutdown concept .............................................................. 95
7.9.8 OS service functionality (overview) ..................................................... 96
7.9.9 GetTaskID ........................................................................................... 98
7.9.10 Interrupt disabling ................................................................................ 98
7.9.11 TASK activation ................................................................................... 99
7.9.12 TASK Chaining .................................................................................. 100
7.9.13 EVENT setting ................................................................................... 100
7.9.14 Activating additional cores ................................................................ 101
7.9.15 Start of the OS .................................................................................. 101
7.9.16 TASK termination .............................................................................. 102
7.9.17 Termination of OS-Applications ......................................................... 102
7.9.18 Shutdown of the OS .......................................................................... 103
7.9.19 Waiting for EVENTs .......................................................................... 103
7.9.20 Calling trusted functions .................................................................... 104
7.9.21 Invoking reschedule .......................................................................... 104
7.9.22 RESOURCE occupation ................................................................... 104
7.9.23 The CoreID........................................................................................ 105
7.9.24 COUNTERs, background & rationale ................................................ 106
7.9.25 Multi-Core restrictions on COUNTERs .............................................. 106
7.9.26 Synchronization of COUNTERs ........................................................ 107
7.9.27 ALARMs ............................................................................................ 108
7.9.28 Schedule tables ................................................................................. 109
7.9.29 The spinlock mechanism ................................................................... 109
7.9.30 Offline checks .................................................................................... 113
7.9.31 Auto start Objects .............................................................................. 114
7.10 Inter-OS-Application Communicator (IOC) ............................................... 114
7.10.1 Background & Rationale ................................................................... 114
7.10.2 IOC - General purpose ...................................................................... 115
7.10.3 IOC functionality ................................................................................ 116
Specification of Operating System
AUTOSAR Release 4.2.2
6 of 247 Document ID 034: AUTOSAR_SWS_OS
- AUTOSAR confidential -
7.10.4 IOC interface ..................................................................................... 117
7.10.5 IOC internal structure ........................................................................ 118
7.10.6 IOC configuration and generation ..................................................... 118
7.10.7 IOC integration examples .................................................................. 119
7.10.8 Future extensions .............................................................................. 122
7.11 System Scalability .................................................................................... 123
7.11.1 Background & Rationale ................................................................... 123
7.11.2 Requirements .................................................................................... 124
7.12 Hook Functions ........................................................................................ 125
7.12.1 Background & Rationale ................................................................... 125
7.12.2 Requirements .................................................................................... 125
7.13 Error classification .................................................................................... 126
8 API specification .............................................................................................. 128
8.1 Constants ................................................................................................. 128
8.1.1 Error codes of type StatusType ......................................................... 128
8.2 Macros ..................................................................................................... 128
8.3 Type definitions ........................................................................................ 128
8.3.1 ApplicationType (for OS-Applications) .............................................. 128
8.3.2 ApplicationStateType ........................................................................ 129
8.3.3 ApplicationStateRefType ................................................................... 129
8.3.4 TrustedFunctionIndexType................................................................ 129
8.3.5 TrustedFunctionParameterRefType .................................................. 129
8.3.6 AccessType....................................................................................... 129
8.3.7 ObjectAccessType ............................................................................ 130
8.3.8 ObjectTypeType ................................................................................ 130
8.3.9 MemoryStartAddressType................................................................. 130
8.3.10 MemorySizeType .............................................................................. 130
8.3.11 ISRType ............................................................................................ 130
8.3.12 ScheduleTableType .......................................................................... 131
8.3.13 ScheduleTableStatusType ................................................................ 131
8.3.14 ScheduleTableStatusRefType........................................................... 131
8.3.15 CounterType ..................................................................................... 131
8.3.16 ProtectionReturnType ....................................................................... 132
8.3.17 RestartType....................................................................................... 132
8.3.18 PhysicalTimeType ............................................................................. 132
8.3.19 CoreIdType ....................................................................................... 132
8.3.20 SpinlockIdType .................................................................................. 132
8.3.21 TryToGetSpinlockType ..................................................................... 133
8.3.22 IdleModeType ................................................................................... 133
8.4 Function definitions .................................................................................. 133
8.4.1 GetApplicationID ............................................................................... 133
8.4.2 GetCurrentApplicationID ................................................................... 134
8.4.3 GetISRID ........................................................................................... 135
8.4.4 CallTrustedFunction .......................................................................... 135
8.4.5 CheckISRMemoryAccess ................................................................. 137
8.4.6 CheckTaskMemoryAccess ................................................................ 138
8.4.7 CheckObjectAccess .......................................................................... 139
8.4.8 CheckObjectOwnership .................................................................... 140
Specification of Operating System
AUTOSAR Release 4.2.2
7 of 247 Document ID 034: AUTOSAR_SWS_OS
- AUTOSAR confidential -
8.4.9 StartScheduleTableRel ..................................................................... 140
8.4.10 StartScheduleTableAbs .................................................................... 142
8.4.11 StopScheduleTable ........................................................................... 143
8.4.12 NextScheduleTable ........................................................................... 144
8.4.13 StartScheduleTableSynchron............................................................ 145
8.4.14 SyncScheduleTable .......................................................................... 146
8.4.15 SetScheduleTableAsync ................................................................... 147
8.4.16 GetScheduleTableStatus .................................................................. 148
8.4.17 IncrementCounter ............................................................................. 150
8.4.18 GetCounterValue .............................................................................. 150
8.4.19 GetElapsedValue .............................................................................. 151
8.4.20 TerminateApplication ........................................................................ 152
8.4.21 AllowAccess ...................................................................................... 154
8.4.22 GetApplicationState .......................................................................... 155
8.4.23 GetNumberOfActivatedCores ............................................................ 155
8.4.24 GetCoreID ......................................................................................... 156
8.4.25 StartCore ........................................................................................... 156
8.4.26 StartNonAutosarCore ........................................................................ 157
8.4.27 GetSpinlock ....................................................................................... 158
8.4.28 ReleaseSpinlock ............................................................................... 159
8.4.29 TryToGetSpinlock ............................................................................. 160
8.4.30 ShutdownAllCores ............................................................................. 162
8.4.31 ControlIdle ......................................................................................... 162
8.5 IOC ........................................................................................................... 163
8.5.1 Imported types .................................................................................. 163
8.5.2 Type definitions ................................................................................. 164
8.5.3 Constants .......................................................................................... 164
8.5.4 Function definitions ........................................................................... 165
8.6 Expected Interfaces .................................................................................. 175
8.6.1 Mandatory Interfaces ........................................................................ 175
8.6.2 Optional Interfaces ............................................................................ 175
8.7 Hook functions.......................................................................................... 177
8.7.1 Protection Hook ................................................................................. 177
8.7.2 Application specific StartupHook ....................................................... 178
8.7.3 Application specific ErrorHook .......................................................... 178
8.7.4 Application specific ShutdownHook .................................................. 179
8.8 Service Interfaces ..................................................................................... 179
8.8.1 Client-Server-Interfaces .................................................................... 179
9 Sequence diagrams......................................................................................... 182
9.1 Sequence chart for calling trusted functions ............................................. 182
9.2 Sequence chart for usage of ErrorHook ................................................... 183
9.3 Sequence chart for ProtectionHook.......................................................... 184
9.4 Sequence chart for StartupHook .............................................................. 185
9.5 Sequence chart for ShutdownHook .......................................................... 186
9.6 Sequence diagrams of Sender Receiver communication over the IOC .... 186
9.6.1 LastIsBest communication ................................................................ 186
9.6.2 Queued communication without pull callback.................................... 187
9.6.3 Queued communication with pull callback ........................................ 189
Specification of Operating System
AUTOSAR Release 4.2.2
8 of 247 Document ID 034: AUTOSAR_SWS_OS
- AUTOSAR confidential -
10 Configuration Specification .......................................................................... 190
10.1 How to read this chapter .......................................................................... 190
10.1.1 Rules for paramters ........................................................................... 190
10.2 Containers and configuration parameters ................................................ 190
10.2.1 Variants ............................................................................................. 190
10.2.2 Os ..................................................................................................... 190
10.2.3 OsAlarmSetEvent .............................................................................. 191
10.2.4 OsAlarm ............................................................................................ 192
10.2.5 OsAlarmAction .................................................................................. 193
10.2.6 OsAlarmActivateTask ........................................................................ 193
10.2.7 OsAlarmAutostart .............................................................................. 193
10.2.8 OsAlarmCallback .............................................................................. 195
10.2.9 OsAlarmIncrementCounter................................................................ 195
10.2.10 OsApplication ................................................................................ 196
10.2.11 OsApplicationHooks ...................................................................... 199
10.2.12 OsApplicationTrustedFunction ....................................................... 200
10.2.13 OsAppMode ................................................................................... 201
10.2.14 OsCounter ..................................................................................... 201
10.2.15 OsEvent ......................................................................................... 203
10.2.16 OsHooks ........................................................................................ 204
10.2.17 OsIsr .............................................................................................. 205
10.2.18 OsIsrResourceLock ....................................................................... 206
10.2.19 OsIsrTimingProtection ................................................................... 207
10.2.20 OsOS ............................................................................................. 209
10.2.21 OsResource ................................................................................... 211
10.2.22 OsScheduleTable .......................................................................... 212
10.2.23 OsScheduleTableAutostart ............................................................ 213
10.2.24 OsScheduleTableEventSetting ...................................................... 215
10.2.25 OsScheduleTableExpiryPoint ........................................................ 215
10.2.26 OsScheduleTableTaskActivation ................................................... 216
10.2.27 OsScheduleTblAdjustableExpPoint ............................................... 216
10.2.28 OsScheduleTableSync .................................................................. 217
10.2.29 OsSpinlock .................................................................................... 218
10.2.30 OsTask .......................................................................................... 219
10.2.31 OsTaskAutostart ............................................................................ 221
10.2.32 OsTaskResourceLock ................................................................... 222
10.2.33 OsTaskTimingProtection ............................................................... 223
10.2.34 OsTimeConstant ............................................................................ 224
10.3 Containers and configuration parameter extensions of the IOC ............... 225
10.3.1 OsIoc ................................................................................................. 225
10.3.2 OsIocCommunication ........................................................................ 226
10.3.3 OsIocSenderProperties ..................................................................... 227
10.3.4 OsIocReceiverProperties .................................................................. 228
10.3.5 OsIocDataProperties ......................................................................... 230
10.4 Published Information ............................................................................... 231
11 Generation of the OS ................................................................................... 232
11.1 Read in configuration ............................................................................... 232
11.2 Consistency check ................................................................................... 232
Specification of Operating System
AUTOSAR Release 4.2.2
9 of 247 Document ID 034: AUTOSAR_SWS_OS
- AUTOSAR confidential -
11.3 Generating operating system ................................................................... 234
12 Application Notes ......................................................................................... 235
12.1 Hooks ....................................................................................................... 235
12.2 Providing Trusted Functions ..................................................................... 235
12.3 Migration hints for OSEKtime OS users ................................................... 237
12.4 Software Components and OS-Applications ............................................ 239
12.5 Global Time Synchronization ................................................................... 240
12.6 Working with FlexRay ............................................................................... 240
12.7 Migration from OIL to XML ....................................................................... 241
12.8 Migrating RES_SCHEDULER in AUTOSAR OS ...................................... 241
12.9 Debug support .......................................................................................... 242
12.10 Integration hints for peripheral protection ............................................. 242
12.11 Termination of OSApplications ............................................................. 243
13 AUTOSAR Service implemented by the OS ................................................ 245
13.1 Scope of this Chapter ............................................................................... 245
13.1.1 Package ............................................................................................ 245
13.2 Overview .................................................................................................. 245
13.3 Specification of the Ports and Port Interfaces .......................................... 245
14 Outlook on Memory Protection Configuration .............................................. 246
14.1 Configuration Approach ............................................................................ 246
15 Not applicable requirements ........................................................................ 247
评论