RTA-OS V6.1.3
User Guide
Status: Released
Copyright
Copyright
The data in this document may not be altered or amended without special notification
from ETAS GmbH. ETAS GmbH undertakes no further obligation in relation to this doc-
ument. The software described in it can only be used if the customer is in possession
of a general license agreement or single license. Using and copying is only allowed in
concurrence with the specifications stipulated in the contract. Under no circumstances
may any part of this document be copied, reproduced, transmitted, stored in a retrieval
system or translated into another language without the express written permission of
ETAS GmbH.
©Copyright 2008-2021 ETAS GmbH, Stuttgart.
The names and designations used in this document are trademarks or brands belonging
to the respective owners.
Document: 10766-UG-6.1.3 EN-05-2021
RTA-OS User Guide V6.1.3 2
Contents
Contents
1 Welcome to RTA-OS 12
1.1 Related Documents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
1.2 About You . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
1.3 Document Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
1.4 Privacy Statement - GDPR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
1.4.1 Data Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
1.4.2 Technical and organizational measures . . . . . . . . . . . . . . 14
2 Introduction 15
2.1 Features of the RTA-OS Kernel . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
2.1.1 OSEK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
2.1.2 AUTOSAR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
2.1.3 Unique RTA-OS Features . . . . . . . . . . . . . . . . . . . . . . . . . 21
2.2 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
3 Development Process 23
3.1 Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
3.1.1 OS Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
3.1.2 RTA-TRACE Configuration . . . . . . . . . . . . . . . . . . . . . . . . 27
3.1.3 Build . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
3.1.4 Project Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
3.1.5 Error Checking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
3.1.6 Generating Reports . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
3.2 Assistants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
3.3 Library Generation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
3.3.1 Preparing the Tool Chain . . . . . . . . . . . . . . . . . . . . . . . . 36
3.3.2 Understanding AUTOSAR Dependencies . . . . . . . . . . . . . 38
3.3.3 Running rtaosgen . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
3.3.4 Building the library . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
3.3.5 Generated Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
3.4 Integration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
3.4.1 Accessing the OS in your Source Code . . . . . . . . . . . . . . 43
3.4.2 Implementing Tasks and ISRs . . . . . . . . . . . . . . . . . . . . . 44
3.4.3 Starting the OS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
3.4.4 Interacting with the RTA-OS . . . . . . . . . . . . . . . . . . . . . . 45
3.4.5 Compiling and Linking . . . . . . . . . . . . . . . . . . . . . . . . . . 45
3.5 Memory Images and Linker Files . . . . . . . . . . . . . . . . . . . . . . . . . . 45
3.5.1 Sections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
3.5.2 The Linker Control File . . . . . . . . . . . . . . . . . . . . . . . . . . 47
3.6 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
RTA-OS User Guide V6.1.3 3
Contents
4 Tasks 49
4.1 Scheduling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
4.2 Basic and Extended Tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
4.2.1 Task States . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
4.2.2 Task Priorities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
4.2.3 Queued Task Activation . . . . . . . . . . . . . . . . . . . . . . . . . 55
4.2.4 Asynchronous Task Activation . . . . . . . . . . . . . . . . . . . . . 55
4.3 Conformance Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
4.4 Maximizing Performance and Minimizing Memory . . . . . . . . . . . . . . 57
4.5 Task Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
4.5.1 Scheduling Policy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
4.5.2 Queued Activation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
4.5.3 Auto-starting Tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
4.6 Stack Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
4.6.1 Working with Extended Tasks . . . . . . . . . . . . . . . . . . . . . 62
4.6.2 Mandatory Stack Information . . . . . . . . . . . . . . . . . . . . . 64
4.6.3 Specifying Task Stack Allocation . . . . . . . . . . . . . . . . . . . 67
4.6.4 Optimizing the Extended Task context save . . . . . . . . . . . 69
4.6.5 Handling Stack Overrun . . . . . . . . . . . . . . . . . . . . . . . . . 70
4.7 Implementing Tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
4.8 Activating Tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
4.8.1 Direct Activation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
4.8.2 Indirect Activation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
4.9 Controlling Task Execution Ordering . . . . . . . . . . . . . . . . . . . . . . . 75
4.9.1 Direct Activation Chains . . . . . . . . . . . . . . . . . . . . . . . . . 75
4.9.2 Using Priority Levels . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
4.10 Co-operative Scheduling in RTA-OS . . . . . . . . . . . . . . . . . . . . . . . . 76
4.10.1 Optimizing out the Schedule() API . . . . . . . . . . . . . . . . . 78
4.11 Terminating Tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
4.11.1 Optimizing Termination in RTA-OS . . . . . . . . . . . . . . . . . . 79
4.12 Delayed Tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
4.13 The Idle Mechanism . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
4.14 Pre and Post Task Hooks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
4.15 Saving Hardware Registers across Preemption . . . . . . . . . . . . . . . . 84
4.16 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
RTA-OS User Guide V6.1.3 4
Contents
5 Interrupts 89
5.1 Single-Level and Multi-Level Platforms . . . . . . . . . . . . . . . . . . . . . . 89
5.2 Interrupt Service Routines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
5.3 Category 1 and Category 2 Interrupts . . . . . . . . . . . . . . . . . . . . . . 89
5.3.1 Category 1 Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . 90
5.3.2 Category 2 Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . 90
5.4 Interrupt Priorities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
5.4.1 User Level . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
5.4.2 OS Level . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
5.5 Interrupt Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
5.5.1 Vector Table Generation . . . . . . . . . . . . . . . . . . . . . . . . . 95
5.6 Implementing Interrupt Handlers . . . . . . . . . . . . . . . . . . . . . . . . . 96
5.6.1 Category 1 Interrupt Handlers . . . . . . . . . . . . . . . . . . . . 96
5.6.2 Category 2 Interrupt Handlers . . . . . . . . . . . . . . . . . . . . 97
5.6.3 Dismissing Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
5.6.4 Writing Efficient Interrupt Handlers . . . . . . . . . . . . . . . . . 98
5.7 Enabling and Disabling Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . 98
5.8 Saving Register Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
5.9 The Default Interrupt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
5.10 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
6 Resources 103
6.1 Resource Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
6.2 Resources on Interrupt Level . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
6.3 Using Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
6.3.1 Nesting Resource Calls . . . . . . . . . . . . . . . . . . . . . . . . . 107
6.4 Linked Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
6.5 Internal Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
6.6 Using Resources to Minimize Stack Usage . . . . . . . . . . . . . . . . . . . 113
6.6.1 Internal Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
6.6.2 Standard Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
6.7 The Scheduler as a Resource . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
6.8 Choosing a Preemption Control Mechanism . . . . . . . . . . . . . . . . . . 115
6.9 Avoiding Race Conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
6.10 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
RTA-OS User Guide V6.1.3 5