Specification of Operating System, No.34, CP, AUTOSAR 22-11 新

Specification of Operating System, AUTOSAR 22-11, CP, No.34

AUTOSARは、ISO、IEC、ITUと情報交換契約を結んでいません。
AUTOSAR文書には、ISO、IEC,ITU記述を全文引用することはできません。
WTO/TBT協定に基づき、国際的な調達は国際規格との差異を記述することにより文化依存しない仕様を目指します。
ISO、IEC、ITU文書を合わせて読むと技術内容は理解できます。　
CAN、OSEK/VDX OS、DIAGは、ISO定義を先に確認しましょう。　　
OSEK COM、OSEK NMなどはISOの規定から基本的な部分で定義を変えています。
変更している部分を仕様等で明記するか、ISOを改定するとよいでしょう。　

AUTOSARの参考文献欄の改定が進んでいません。　
Glossary用語定義の網羅性が低いです。
本文を読む前に確認するとよいかもしれません。
本文を読んでから確認してもよいかもしれません。

AUTOSARが、2022年の版、R22-11公開しました。公開行事の模様は

AUTOSAR R22-11 Release Event 20221208

https://qiita.com/kaizen_nagoya/items/18471d0b340480fdcd42

下記URL順次確認中です。

https://www.autosar.org/fileadmin/standards/classic/22-11/AUTOSAR_SWS_OS.pdf


https://www.autosar.org/

文書は検索してダウンロードすることができます。
クラウドサービスにありがちな、あるのにないかのような検索結果が出ることがあります。

https://www.autosar.org/standards

# 要求仕様対応(Requirement and Specification)
8, Requirements on Operating System, 

https://www.autosar.org/fileadmin/standards/classic/22-11/AUTOSAR_SRS_OS.pdf

https://qiita.com/kaizen_nagoya/items/1961cc2dded6428651ce
# 一覧

AUTOSAR R22-11 Classic Platform 一覧はこちら。

Classic Platform Release Overview, AUTOSAR R22-11, CP, No.0(2)

https://qiita.com/kaizen_nagoya/items/80636f4ca7c16501803b


AUTOSAR R22-11 マラソン

https://qiita.com/kaizen_nagoya/items/988aa405a6fdd794fe53



Qiitaの記事の一覧は作成中です。

AUTOSAR R22-11 一覧（２）

https://qiita.com/kaizen_nagoya/items/6b0615884e954c65fb43

### OSEK/VDX OS

https://www.osek-vdx.org/portal_subdomain/files/pdf/specs/deprecated/os222.pdf
#### Figure 12-1 API service restrictions

|Service|Task|ISR category 1| ISR category 2| ErrorHook|PreTaskHook| PostTaskHook| StartupHook| ShutdownHook| alarm-callback|
|:--|:--|:--|:--|:--|:--|:--|:--|:--|:--|
|ActivateTask|v||v|
|TerminateTask|v|
|ChainTask|v|
|Schedule|v|
|GetTaskID|v||v|v|v|v|
|GetTaskState|v||v|v|v|v|
|DisableAllInterrupts|v|v|v|
|EnableAllInterrupts|v|v|v|
|SuspendAllInterrupts|v|v|v|v|v|v|||v|
|ResumeAllInterrupts|v|v|v|v|v|v|||v|
|SuspendOSInterrupts|v|v|v|
|ResumeOSInterrupts|v|v|v|
|GetResource|v||v|
|ReleaseResource|v||v|
|SetEvent|v||v|
|ClearEvent|v|
|GetEvent|v||v|v|v|v|
|WaitEvent|v|
|GetAlarmBase|v||v|v|v|v|
|GetAlarm|v||v|v|v|v|
|SetRelAlarm|v||v|
|SetAbsAlarm|v||v|
|CancelAlarm|v||v|
|GetActiveApplicationMode|v||v|v|v|v|v|v|
|StartOS||
|Shutdown OS|v||v|v|||v||


OSの基本仕様はISOで決めており、AUTOSARは追加部分。

# Abstract Platformとの関係

ISO 各種規格に基づいた診断、通信の抽象的な定義をする。
必要があれば国際規格を改定する。

<この項は書きかけです。順次追記します。>


## 文書変更(Document Change) 

>• Several minor issues and clarifications (IOC error codes, applicability of multi-core, ARTI updates)
• Additional memory allocation keywords
• Added further uptraces to SRS requirements
• Removal of StartNonAutosarCore API

## 用語(terms)

|Term|Description|
|:--|:--|
|API| Application Programming Interface
|AR| AUTOSAR
|ARTI |AUTOSAR Run-time interface
|BSW| Basic Software
|BSWMD |Basic Software Module Description
|CDD| Complex Driver
|COM|Communication
|ECC| Extended Conformance Class
|ECU |Electronic Control Unit
|HW |Hardware
|ID| Identifier
|IOC| Inter OS-Application communicator
|ISR |Interrupt Service Routine
|LE| A locatable entity is a distinct piece of software that has the same effect regardless of which core it is located.
|MC |Multi-Core
|MCU |Microcontroller Unit
|ME| Mutual exclusion
|MPU |Memory Protection Unit
|NMI| Non maskable interrupt
|OIL| OSEK Implementation Language
|OS| Operating System
|OSEK/VDX |Offene Systeme und deren Schnittstellen für die Elektronik im Kraftfahrzeug
|RTE |Run-Time Environment
|RTOS |Real Time Operating System
|SC |Single-Core
|SLA |Software Layered Architecture
|SW |Software
|SWC |Software Component
|SWFRT| Software FreeRunningTimer
|Access Right |An indication that an object (e.g. Task, ISR, hook function) of an OS-Application has the permission of access or manipulation with respect to memory, OS services or (set of) OS objects.
|Cardinality| The number of items in a set.
|Counter |An operating system object that registers a count in ticks. There are two types of counters:
|Hardware Counter|A Counter that is advanced by hardware (e.g. timer). The count value is maintained by the peripheral "in hardware".
|Software Counter|A Counter which is incremented by making the IncrementCounter API call (see [SWS_Os_00399]). The count value is maintained by the operating system "in software".
|Deadline| The time at which a Task/Category 2 ISR must reach a certain point during its execution defined by system design relative to the stimulus that triggered activation. See figure 2.1
|Delay| The number of ticks between two adjacent expiry points on a ScheduleTable. A pair of expiry points X and Y are said to be adjacent when: • There is no expiry point Z such that X.Offset < Z.Offset < Y.Offset. In this case the Delay = Y.Offset-X.Offset • X and Y are the Final Expiry Point and the Initial Expiry Point respectively. In this case Delay = (Duration-X.Offset)+Y.Offset When used in the text, Delay is a relative number of ticks measured from a specified expiry point. For example: X.Delay is the delay from X to the next expiry point.
|Deviation| The minimum number of ticks between the current position on an explicitly synchronized ScheduleTable and the value of the synchronization count modulo the duration of the ScheduleTable.
|Duration |The number of ticks from a notional zero at which a ScheduleTable wraps.
|Execution Time |Tasks: The net time a Task spends in the RUNNING state without entering the SUSPENDED or WAITING state excluding all preemptions due to ISRs which preempt the Task. An extended Task executing the WaitEvent API call to wait on an Event which is already set notionally enters the WAITING state. For multiple activated basic Tasks the net time is per activation of a Task. ISRs: The net time from the first to the last instruction of the user provided Category 2 interrupt handler excluding all preemptions due to higher priority ISRs executing in preference. Execution time includes the time spent in the error, pretask and posttask hooks and the time spent making OS service calls.
|Execution Budget| Maximum permitted execution time for a Task/ISR.
|Expiry Point |The offset on a ScheduleTable, measured from zero, at which the OS activates Tasks and/or sets Events.
|Initial Expiry Point|The expiry point with the smallest offset
|Final Expiry Point|The expiry point with the largest offset
|Hook Function |A Hook function is implemented by the user and invoked by the operating system in the case of certain incidents. In order to react to these on system or application level, there are two kinds of hook functions
|Applicationspecific Hook functions| within the scope of an individual OS-Application.
|System-specific Hook functions |within the scope of the complete system (in general provided by the integrator).
|Initial Offset |The smallest expiry point offset on a ScheduleTable. This can be zero.
|Interarrival Time |Basic Tasks: The time between successively entering the READY state from the SUSPENDED state. Activation of a Task always represents a new arrival. This applies in the case of multiple activations, even if an existing instance of the Task is in the RUNNING or READY state. Extended Tasks: The time between successively entering the READY state from the SUSPENDED or WAITING states. Setting an Event for a Task in the WAITING state represents a new arrival if the Task is waiting on the Event. Waiting for an Event in the RUNNING state which is already set represents a new arrival. ISRs: The time between successive occurrences of an interrupt. See figure 2.1
|Interrupt Lock Time |The time for which a Task/ISR executes with Category 1 interrupts disabled/suspended and/or Category 2 interrupts disabled/suspended .
|Interrupt Source Enable |The switch which enables a specific interrupt source in the hardware.
|Interrupt Vector Table| Conceptually, the interrupt vector table contains the mapping from hardware interrupt requests to (software) interrupt service routines. The real content of the Interrupt Vector Table is very hardware specific, e.g. it can contain the start addresses of the interrupt service routines.
|Final Delay| The difference between the Final Expiry Point offset and the duration on a ScheduleTable in ticks. This value defines the delay from the Final Expiry Point to the logical end of the ScheduleTable for single-shot and "nexted" ScheduleTables.
|Forced OS-Application Termination|The operating system frees all system objects, e.g. forcibly terminates Tasks, disables interrupts, etc., which are associated to the OS-Application. OS-Application and internal variables are potentially left in an undefined state.
|Forced Termination| The OS terminates the Task/Category 2 ISR and does "unlock" it’s held resources. For details see
[SWS_Os_00108] and [SWS_Os_00109].
|Linker File |File containing linking settings for the linker. The syntax of the linker file depends on the specific
linker and, consequently, definitions are stored "linker-specific" in the linker file.
|Lock Budget |Maximum permitted Interrupt Lock Time or Resource Lock Time.
|Master core |A master core is a core from which the AUTOSAR system is bootstrapped.
|Memory Protection Unit| A Memory Protection Unit (MPU) enables memory partitioning with individual protection attributes. This is distinct from a Memory Management Unit (MMU) that provides a mapping between virtual addresses and physical memory locations at runtime. Note that some devices may realize the functionality of an MPU in an MMU.
|Mode |Describes the permissions available on a processor.
|Privileged| In general, in "privileged mode" unrestricted access is available to memory as well as the underlying hardware.
|Non-privileged |In "non-privileged mode" access is restricted.
|Modulus |The number of ticks required to complete a full wrap of an OSEK Counter. This is equal to OsCounterMaxAllowedValue +1 ticks of the Counter.
|OS-Application| A collection of OS objects
|Trusted |An OS-Application that may be executed in privileged mode and may have unrestricted access to the API and hardware resources. Only trusted applications can provide trusted functions.
|Non-trusted |An OS-Application that is executed in non-privileged mode has restricted access to the API and hardware resources.
|OS object |Object that belongs to a single OS-Application: Task, ISR, Alarm, Event, ScheduleTable, Resource, Trustedfunction, Counter, application-specific hook.
|OS Service| OS services are the API of the operating system.
|Protection Error |Systematic error in the software of an OS-Application.
|Memory access violation|A protection error caused by access to an address in a manner for which no access right exists.
|Timing fault| A protection error that violates the timing protection. Illegal service A protection error that violates the service protection, e.g. unauthorized call to OS service.
|Hardware exception|division by zero, illegal instruction etc.
|Resource Lock Time |The time an OSEK Resource is held by a Task/ISR (excluding the preemptions of the Task/ISR by higher prior Tasks/ISRs).
|Response Time| The time between a Task/ISR being made ready to execute and generating a specified response.
The time includes all preemptions. See figure 2.1
|Restart an OS-Application|An OS-Application can be restarted after self-termination or being forcibly terminated because of a protection error. When an OS-Application is restarted, the OS activates the configured OsRestartTask.
|Scalability Class |The features of the OS (e.g. Memory Protection or Timing Protection), described by this document, can be grouped together to customize the operating system to the needs of the application. There are 4 defined groups of features which are named scalability classes. For details see Chapter 7.11
|ScheduleTable| Encapsulation of a statically defined set of expiry points.
|Section| Part of an object file in which instructions or data are combined to form a unit (contiguous address space in memory allocated for data or code). A section in an object file (object file format) has a name and a size. From the linker perspective, two different sides can be distinguished:
|Input section |memory section in an input object file of the linker.
|Output section |memory section in an output object file of the linker.
|Set (of OS objects) |This document uses the term set, indicating a collection of the same type of OS objects, in the strict mathematical sense, i.e.: - a set contains zero or more OS objects (this means a set can be empty) - the OS objects in the set are unique (this means there cannot be duplicate OS objects in the set)
|Spinlock |A spinlock is a locking mechanism where the Task waits in a loop (spins) repeatedly checking for a shared variable to become a certain value. The value indicates whether the lock is free or not. In Multi-Core systems the comparison and changing of the variable typically requires an atomic operation. As the Task remains active but is not doing anything useful, a spinlock is a busy waiting mechanism
|Spinlock variable |A spinlock variable is a shared variable used by a spinlock to indicate whether a spinlock is free or occupied.
|Symbol |Address label that can be imported/used by software modules and resolved by the linker. The precise syntax of the labels is linker-specific. Here, these address labels are used to identify the start and end of memory sections.
|Start symbol| Tags the start of a memory section
|End symbol |Tags the end of a memory section
|Synchronization of ScheduleTables with a synchronization Counter|Synchronization with a synchronization Counter is achieved, if the expiry points of the ScheduleTable are processed within an absolute deviation from the synchronization Counter that is smaller than or equal to a precision threshold.
|Synchronization Counter|The "Synchronization Counter", distinct from an OS Counter object, is an external Counter, external to the OS, against which expiry points of a ScheduleTable are synchronized
|Task |A Task is the object which executes (user) code and which is managed by the OS. E.g. the OS switches between different Tasks (schedules). There are 2 types of Tasks; for more details see [2].
|Basic Task |A Task which cannot block by itself. This means that it cannot wait for (OS) Event(s).
|Extended Task |A Task which can block by itself and wait for (OS) Event(s).
|Time Frame |The minimum inter-arrival time for a Task/ISR.
|Trustedfunction| A service provided by a trusted OS-Application that can be used by other OS-Applications (trusted or non-trusted).
|Worst case execution time (WCET)|The longest possible execution time.
|Write access| Storing a value in a register or memory location. All memory accesses that have the consequence of writing (e.g. reads that have the side effect of writing to a memory location) are treated as write accesses.

## 英日単語帳
日本語は仮訳

T.B.D.

## 参考(reference)

### [1] Requirements on Operating System
AUTOSAR_SRS_OS
### [2] ISO 17356-3: Road vehicles – Open interface for embedded automotive applications – Part 3: OSEK/VDX Operating System (OS)
2005

https://www.iso.org/standard/40079.html

2   Normative references

ISO 17356-1, Road vehicles — Open interface for embedded automotive applications — Part 1: General structure and terms, definitions and abbreviations terms
ISO 17356-2, Road vehicles — Open interface for embedded automotive applications — Part 2: OSEK/VDX specifications for binding OS, COM and NM
ISO 17356-6, Road vehicles — Open interface for embedded electronic equipment — Part 6: OSEK/VDX Implementation Language (OIL)


### [3] Glossary
AUTOSAR_TR_Glossary
https://www.autosar.org/fileadmin/standards/foundation/22-11/AUTOSAR_TR_Glossary.pdf

### [4] General Specification of Basic Software Modules
AUTOSAR_SWS_BSWGeneral
### [5] Virtual Functional Bus
AUTOSAR_EXP_VFB
### [6] General Requirements on Basic Software Modules
AUTOSAR_SRS_BSWGeneral
### [7] Requirements on Free Running Timer
AUTOSAR_SRS_FreeRunningTimer
### [8] ISO 17356-6: Road vehicles – Open interface for embedded automotive applications – Part 6: OSEK/VDX Implementation Language (OIL)
2006

https://www.iso.org/standard/40080.html

2   Normative references

ISO 9899, Programming languages — C
ISO 17356-1, Road vehicles — Open interface for embedded automotive applications — Part 1: General structure and terms, definitions and abbreviated terms
ISO 17356-2, Road vehicles — Open interface for embedded automotive applications — Part 2: OSEK/VDX specifications for binding OS, COM and NM
ISO 17356-3, Road vehicles — Open interface for embedded automotive applications — Part 3: OSEK/VDX Operating System (OS)
ISO 17356-4, Road vehicles — Open interface for embedded automotive applications — Part 4: OSEK/VDX Communication (COM)
ISO 17356-5, Road vehicles — Open interface for embedded automotive applications — Part 5: OSEK/VDX Network Management (NM)

Bibliography

[1]	Naur, Peter (ed.), “Revised Report on the Algorithmic Language ALGOL 60”, Communications of the ACM, Vol. 3, No. 5, pp. 299-314, May 1960
[2]	Marcotty, M. & Ledgard, H. The World of Programming Languages, Springer-Verlag, Berlin 1986, pages 41 and following

### [9] Specification of AUTOSAR Run-Time Interface
AUTOSAR_SWS_ClassicPlatformARTI
### [10] Specification of RTE Software
AUTOSAR_SWS_RTE
### [11] Software Component Template
AUTOSAR_TPS_SoftwareComponentTemplate
### [12] Specification of Memory Mapping
AUTOSAR_SWS_MemoryMapping



# Countdown Calendar 2022

今年企画した6つのCountdown Calendarと、それぞれの記事一つをご紹介します。

AUTOSAR Countdown Calendar 2022

https://qiita.com/advent-calendar/2022/autosar

AUTOSAR References to ISO, IEC, ITU, IEEE, RFC and SEA etc.

https://qiita.com/kaizen_nagoya/items/d7d252211e10a79516df

Automotive Handbook Countdown Calendar 2022

https://qiita.com/advent-calendar/2022/automotivehandbook

Basic principles, ボッシュ自動車handbook(英語)11版まとめ<2>

https://qiita.com/kaizen_nagoya/items/24a1ba5da3d09b2a95d1


2022 いいねをいただいた記事ランキング(O.K.版) Countdown Calendar 2022

https://qiita.com/advent-calendar/2022/goods

2022年１月下旬　いいねをいただいた記事　16

https://qiita.com/kaizen_nagoya/items/0ee589a8edaeab24fd2a

CDCale(O.K.) Countdown Calendar 2022

https://qiita.com/advent-calendar/2022/adventcalendar2022

「会議は15分未満」に。小耳にはさんだ話。

https://qiita.com/kaizen_nagoya/items/510c47c5d1e8d03145db

ABC language (O.K.版） Advent Calendar 2022

https://qiita.com/advent-calendar/2022/abc_ok

LLVMソースコードのコンパイルをしようと思ってハマった罠とそこから脱出するための努力

https://qiita.com/kaizen_nagoya/items/16f270e42b947756ced3

ABC maker(O.K版） Advent Calendar 2022

https://qiita.com/advent-calendar/2022/abcmaker

JAXA/IPA クリティカルソフトウェアワークショップ WOCS言語関連発表(改定版)

https://qiita.com/kaizen_nagoya/items/4789832baf494cb74626


CountdownCalendar2022 報告

https://qiita.com/kaizen_nagoya/items/5b4b99cb9ad571f4094b


# 関連文書(Related document)

2023年1月　記事数一覧

https://qiita.com/kaizen_nagoya/items/78153968c5de76a7fd83

年末100記事を30点に仕上げる。

https://qiita.com/kaizen_nagoya/items/3ffdc82caee3a325d1d7

2023 書き初め

https://qiita.com/kaizen_nagoya/items/d494737e2627127b530d

「はじめてのCAN/CANFD 」 ベクタージャパン ＜エンジニア夏休み企画>【読書感想文】

https://qiita.com/kaizen_nagoya/items/1fee270be00ef90ca4ec


三方良し　Udemy 車載LAN入門講座 CAN通信編

https://qiita.com/kaizen_nagoya/items/bed038c52510fea72c0a


詳解 車載ネットワーク CAN, CAN FD, LIN, CXPI, Ethernetの仕組みと設計のために(1) 著者　 ＜エンジニア夏休み企画 読書感想文＞

https://qiita.com/kaizen_nagoya/items/e9971698a108c3dba794

詳解 車載ネットワーク CAN, CAN FD, LIN, CXPI, Ethernetの仕組みと設計のために(2)参考文献 ＜エンジニア夏休み企画>【読書感想文】

https://qiita.com/kaizen_nagoya/items/e156cbdd5fce9263776e

詳解 車載ネットワーク CAN、CAN FD、LIN、CXPI、Ethernetの仕組みと設計のために

https://qiita.com/kaizen_nagoya/items/44a9e6b0f5363b4a5b35


# 更新資料　Abstract Platform, Vehicle Modelへの対応版

Specification of Operating System, AUTOSAR 34, R22-11, CP 20230421

https://qiita.com/kaizen_nagoya/items/6d32816eedfff0d87df4


 ＜この記事は個人の過去の経験に基づく個人の感想です。現在所属する組織、業務とは関係がありません。＞

# 文書履歴(document history)
ver. 0.01 初稿 　20221204
ver. 0.02 URL修正 20221221
ver. 0.03 Countdown Calendar 変更　20230107
ver. 0.04 ありがとう追記　20230505

## 最後までおよみいただきありがとうございました。

いいね　💚、フォローをお願いします。

####  Thank you very much for reading to the last sentence.

Please press the like icon 💚　and follow me for your happy life.