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

<この項は2023この項は2023年4月21日、AUTOSARの文書のURLが変更になった。
/classic/22-11/
が
/R22-11/CP/
過去記事で、URLでエラーが出たら書き換えてみてください。

2023年11月にもAUTOSAR文書のURLが変更になっている。
/user_upload/standards/classic/21-11/
を
/standards/R21-11/CP/
などに書き換えてください。
お手数をおかけします。
１年に２度URLを変更するなんて、新しい記事が書ける。とても嬉しい。

AUTOSAR R22-11 Qiita記事一覧 20230421 。
https://qiita.com/kaizen_nagoya/items/81a35774f1aa3d64d3f6

この記事の表題の最後に「20230421」を加えます。

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

AUTOSARが、2022年の版、R22-11を公開しました。
https://www.autosar.org/fileadmin/standards/R22-11/CP/AUTOSAR_SWS_OS.pdf

R21-11
https://www.autosar.org/fileadmin/standards/R21-11/CP/AUTOSAR_SWS_OS.pdf

R20-11
https://www.autosar.org/fileadmin/standards/R20-11/CP/AUTOSAR_SWS_OS.pdf

R19-11
https://www.autosar.org/fileadmin/standards/R19-11/CP/AUTOSAR_SWS_OS.pdf
https://www.autosar.org/
文書は検索してダウンロードできます。

R20-11,R21-11, R22-11の３年分だけになりました。

公開行事の模様は

AUTOSAR R22-11 Release Event 20221208
https://qiita.com/kaizen_nagoya/items/18471d0b340480fdcd42

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

Classic Platform Release Overview, AUTOSAR No.0 ,R22-11, CP, 20230421
https://qiita.com/kaizen_nagoya/items/9d22c8722cbc0f42b137

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

# 要求仕様対応(Requirement and Specification)
8, Requirements on Operating System, 
https://www.autosar.org/fileadmin/standards/R22-11/CP/AUTOSAR_SRS_OS.pdf

### OSEK/VDX OS
osek
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/R22-11/FO/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

# 参考資料　
@kazuo_reve 私が効果を確認した「小川メソッド」
https://qiita.com/kazuo_reve/items/a3ea1d9171deeccc04da

@kazuo_reve 新人の方によく展開している有益な情報
https://qiita.com/kazuo_reve/items/d1a3f0ee48e24bba38f1

@kanetugu2018　Mac＋Unity＋Pythonで箱庭ロボットを強化学習できるようにするための手順書
https://qiita.com/kanetugu2018/items/2268403549832966f26d

@kanetugu2018　ARM版マイコンシミュレータを Mac/Linux/Windows 環境で自作した話
https://qiita.com/kanetugu2018/items/14b42fbfcc690ca36580

## 自己参照　
AUTOSAR Abstract Platformへの道（詳細編）
https://qiita.com/kaizen_nagoya/items/cb217133884fa0a2c704

AUTOSAR Abstract Platform User Group Weekly Report(1) 2022.1.8
https://qiita.com/kaizen_nagoya/items/fece4f7719ef55d612bf

祝休日・謹賀新年：2023年の目標
https://qiita.com/kaizen_nagoya/items/24584ac215517a4621ee

AUTOSAR 　R22-11で　リンク切れ、表示しない文書
https://qiita.com/kaizen_nagoya/items/13edb17f6ffd45cdc690

ボッシュ自動車handbook(英語)11版(0-1) 課題と記事一覧new
https://qiita.com/kaizen_nagoya/items/a9d2887bf2a7598dc8e5

「ぼくの好きな先生」「人がやらないことをやれ」プログラマになるまで。仮説（37）
https://qiita.com/kaizen_nagoya/items/53e4bded9fe5f724b3c4

小川メソッド　覚え（書きかけ）
https://qiita.com/kaizen_nagoya/items/3593d72eca551742df68

DoCAP（ドゥーキャップ）って何ですか？
https://qiita.com/kaizen_nagoya/items/47e0e6509ab792c43327

「@kazuo_reve 新人の方によく展開している有益な情報」確認一覧
https://qiita.com/kaizen_nagoya/items/b9380888d1e5a042646b

全世界の不登校の子供たち「博士論文」を書こう。世界子供博士論文遠隔実践中心
https://qiita.com/kaizen_nagoya/items/912d69032c012bcc84f2

Views１万越え、もうすぐ１万記事一覧
https://qiita.com/kaizen_nagoya/items/d2b805717a92459ce853

「想定外」3.11 東日本大震災をIT技術者が振り返る
https://qiita.com/kaizen_nagoya/items/80433f4bf7fe116bddd1

「はじめての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


# Reference
Ethernet 記事一覧　Ethernet(0)
https://qiita.com/kaizen_nagoya/items/88d35e99f74aefc98794

Wireshark 一覧 wireshark(0)、Ethernet(48) 
https://qiita.com/kaizen_nagoya/items/fbed841f61875c4731d0

線網（Wi-Fi）空中線(antenna)(0) 記事一覧(118/300目標)
https://qiita.com/kaizen_nagoya/items/5e5464ac2b24bd4cd001

C++ Support(0)　
https://qiita.com/kaizen_nagoya/items/8720d26f762369a80514

Coding Rules(0) C Secure , MISRA and so on
https://qiita.com/kaizen_nagoya/items/400725644a8a0e90fbb0

Autosar Guidelines C++14 example code compile list(1-169)
https://qiita.com/kaizen_nagoya/items/8ccbf6675c3494d57a76

Error一覧(C/C++, python, bash...) Error(0)
https://qiita.com/kaizen_nagoya/items/48b6cbc8d68eae2c42b8

なぜdockerで機械学習するか 書籍・ソース一覧作成中 (目標100)
https://qiita.com/kaizen_nagoya/items/ddd12477544bf5ba85e2

言語処理100本ノックをdockerで。python覚えるのに最適。:10+12
https://qiita.com/kaizen_nagoya/items/7e7eb7c543e0c18438c4

プログラムちょい替え（0）一覧:4件
https://qiita.com/kaizen_nagoya/items/296d87ef4bfd516bc394

一覧の一覧( The directory of directories of mine.) Qiita(100)
https://qiita.com/kaizen_nagoya/items/7eb0e006543886138f39

プログラマが知っていると良い「公序良俗」
https://qiita.com/kaizen_nagoya/items/9fe7c0dfac2fbd77a945

小川清最終講義、小川清最終講義（再）計画, Ethernet(100) 英語(100) 安全(100)
https://qiita.com/kaizen_nagoya/items/e2df642e3951e35e6a53
＜この記事は個人の過去の経験に基づく個人の感想です。現在所属する組織、業務とは関係がありません。＞
### 文書履歴(document history)
ver. 0.01 初稿 　20230505
## 最後までおよみいただきありがとうございました。
いいね　💚、フォローをお願いします。
####  Thank you very much for reading to the last sentence.
Please press the like icon 💚　and follow me for your happy life.