ISO/IEC TR 18037:2008 プログラミング言語— C —組み込みプロセッサをサポートするための拡張機能 | ページ 2

※一部、英文及び仏文を自動翻訳した日本語訳を使用しています。

序文

ISO (国際標準化機構) と IEC (国際電気標準会議) は、世界標準化のための専門システムを形成しています。 ISO または IEC のメンバーである国家機関は、技術活動の特定の分野を扱うために、それぞれの組織によって設立された技術委員会を通じて、国際規格の開発に参加しています。 ISO と IEC の技術委員会は、相互に関心のある分野で協力しています。 ISO および IEC と連携して、政府および非政府の他の国際機関もこの作業に参加しています。情報技術の分野では、ISO と IEC が合同技術委員会 ISO/IEC JTC 1 を設立しました。

国際規格は、ISO/IEC 指令で指定された規則に従って起草されます。 2.

合同技術委員会の主な任務は、国際規格を作成することです。合同技術委員会によって採択された国際規格草案は、投票のために各国の機関に回覧されます。国際規格として発行するには、投票を行う国の機関の少なくとも 75% による承認が必要です。

例外的な状況では、合同技術委員会は、次のいずれかのタイプのテクニカル レポートの発行を提案することができます。

  • タイプ 1: 国際規格の発行に必要なサポートが得られない場合、何度も努力したにもかかわらず、
  • タイプ 2, 主題がまだ技術開発中である場合、またはその他の理由により、国際規格に関する合意の可能性はあるが、すぐには実現できない場合。
  • タイプ 3 は、合同技術委員会が、国際規格として通常公開されているものとは異なる種類のデータを収集した場合 (たとえば、「最新技術」)

タイプ 1 およびタイプ 2 のテクニカル レポートは、発行から 3 年以内に審査され、国際規格に変換できるかどうかが決定されます。タイプ 3 のテクニカル レポートは、それらが提供するデータがもはや有効または有用でないと見なされるまで、必ずしもレビューする必要はありません。

このドキュメントの要素の一部が特許権の対象となる可能性があることに注意してください。 ISO および IEC は、そのような特許権の一部またはすべてを特定する責任を負わないものとします。

タイプ 2 のテクニカル レポートである ISO/IEC TR 18037 は、合同技術委員会 ISO/IEC JTC 1, 情報技術、小委員会 SC 22, プログラミング言語、その環境、およびシステム ソフトウェア インターフェイスによって作成されました。

この第 2 版は、第 1 版 (ISO/IEC TR 18037:2004) を取り消して置き換えるものであり、そのマイナー リビジョンを構成します。これには、実装経験に基づいた多数の修正と更新が含まれています。

序章

急速に成長する組み込みシステムの市場では、C などの高級言語でアプリケーション プログラムを作成する必要性が高まっています。基本的に、この傾向には 2 つの理由があります。組み込みシステムのプロセッサ モデルの寿命は短くなります (これは、アプリケーションを新しい命令セットに頻繁に再適応させることを意味します) C レベルのプログラミングによって達成されるコードの再利用性は、これらの問題に対処するための大きな前進であると考えられています。

組み込みシステムで使用されるプロセッサ (DSP など) によって提供される機能を、C で記述されたアプリケーションで簡単に利用できないさまざまな技術分野が特定されています。例としては、固定小数点演算、さまざまなメモリ空間の使用、低レベル I/O などがあります。操作など。現在の提案は、これらの技術分野のほんの一部にしか対応していません。

組み込みプロセッサは、アナログ信号を分析し、受信したデータにフィルタリング アルゴリズムを適用してこれらの信号を処理するためによく使用されます。典型的なアプリケーションは、すべてのワイヤレス デバイスに見られます。フィルタリング アルゴリズムで使用される一般的なデータ型は固定小数点データ型であり、必要な速度を実現するために、組み込みプロセッサには固定小数点データ用の特別なハードウェアが装備されていることがよくあります。 C 言語 (ISO/IEC 9899:1999 で定義されている) は固定小数点算術演算をサポートしていないため、現在、プログラマーはほとんどのアルゴリズムをアセンブリ言語で手作りするしかありません。このテクニカル レポートでは、C の固定小数点データ型を指定します。これは、さまざまな精度と飽和オプションで定義できます。最適化 C コンパイラは、整数データや浮動小数点データと同様に、固定小数点データの効率の高いコードを簡単に生成できます。

多くの組み込みプロセッサには、複数の異なるメモリ バンクがあり、最大のパフォーマンスを実現するには、データを異なるバンクにグループ化する必要があります。たとえば、FIR フィルタリング用に設計されたプロセッサの乗算器/アキュムレータへのデータと係数データの同時フローを保証することは、その動作にとって重要です。プログラマが特定のデータ オブジェクトをフェッチするメモリ空間を宣言できるようにするために、このテクニカル レポートでは、複数のアドレス空間の基本的なサポートを指定しています。その結果、最適化コンパイラは、複数のアドレス空間をサポートするプロセッサの機能を利用できます。たとえば、実行速度を最大化するために、1 つのサイクルで 2 つの別個のメモリからデータを読み取ることができます。

C 言語は何年にもわたって成熟してきたため、言語の欠陥に対処するために、基本 I/O ハードウェア ( iohw ) レジスタにアクセスするためのさまざまな拡張機能が追加されました。現在、フリースタンディング環境および組み込みシステム用のほとんどすべての C コンパイラは、C ソース レベルからiohwレジスタに直接アクセスする方法をサポートしています。ただし、これらの拡張機能は方言間で一貫していません。

このテクニカル レポートでは、一般的な手法をコーディングし、基本的なiohwレジスタ アドレス指定に単一の統一された構文を提供するアプローチを提供します。

ISO/IEC TR 18037 の初版とこのバージョンの機能上の相違点は、付録 G に詳述されています。使用されているフォントの違いと詳細なレイアウトのため、完全に相違点を強調したドキュメントでは、これらの相違点はぼやけています。ただし、適切なレビューのためにそのようなバージョンが必要な場合は、 http://standards.iso.org/iso にアクセスしてください。

1 スコープ

このテクニカル レポートは、ISO/IEC 9899:1999 で指定されているプログラミング言語 C の一連の拡張機能を指定します。これらの拡張機能は組み込みプロセッサをサポートしています。

このテクニカル レポートの各条項は、特定のトピックを扱っています。条項 4, 5, および 6 の最初のサブ条項には、トピックの特徴の技術的な説明が含まれています。これらの節は概要を提供しますが、すべての詳細が含まれているわけではありません。各条項の最後の副次条項には、標準のトピックを完全に指定するために必要な標準の編集上の変更が含まれており、それによって完全な定義が提供されます。追加の説明と根拠は、付録に記載されています。

2 参考文献

本書の適用には、以下の参考文献が不可欠です。日付のある参考文献については、引用された版のみが適用されます。日付のない参照については、参照文書の最新版 (修正を含む) が適用されます。

  • ISO/IEC 9899:1999 —プログラミング言語 — C

Foreword

ISO (the International Organization for Standardization) and IEC (the International Electrotechnical Commission) form the specialized system for worldwide standardization. National bodies that are members of ISO or IEC participate in the development of International Standards through technical committees established by the respective organization to deal with particular fields of technical activity. ISO and IEC technical committees collaborate in fields of mutual interest. Other international organizations, governmental and non-governmental, in liaison with ISO and IEC, also take part in the work. In the field of information technology, ISO and IEC have established a joint technical committee, ISO/IEC JTC 1.

International Standards are drafted in accordance with the rules given in the ISO/IEC Directives, 2.

The main task of the joint technical committee is to prepare International Standards. Draft International Standards adopted by the joint technical committee are circulated to national bodies for voting. Publication as an International Standard requires approval by at least 75 % of the national bodies casting a vote.

In exceptional circumstances, the joint technical committee may propose the publication of a Technical Report of one of the following types:

  • type 1, when the required support cannot be obtained for the publication of an International Standard, despite repeated efforts;
  • type 2, when the subject is still under technical development or where for any other reason there is the future but not immediate possibility of an agreement on an International Standard;
  • type 3, when the joint technical committee has collected data of a different kind from that which is normally published as an International Standard (“state of the art”, for example).

Technical Reports of types 1 and 2 are subject to review within three years of publication, to decide whether they can be transformed into International Standards. Technical Reports of type 3 do not necessarily have to be reviewed until the data they provide are considered to be no longer valid or useful.

Attention is drawn to the possibility that some of the elements of this document may be the subject of patent rights. ISO and IEC shall not be held responsible for identifying any or all such patent rights.

ISO/IEC TR 18037, which is a Technical Report of type 2, was prepared by Joint Technical Committee ISO/IEC JTC 1, Information technology, Subcommittee SC 22, Programming languages, their environments, and system software interfaces.

This second edition cancels and replaces the first edition (ISO/IEC TR 18037:2004), of which it constitutes a minor revision. It includes a number of corrections and updates, based on implementation experiences.

Introduction

In the fast growing market of embedded systems there is an increasing need to write application programs in a high-level language such as C. Basically there are two reasons for this trend: programs for embedded systems become more complex (and hence are difficult to maintain in assembly language), and processor models for embedded systems have a decreasing lifespan (which implies more frequent re-adapting of applications to new instruction sets). The code re-usability achieved by C-level programming is considered to be a major step forward in addressing these issues.

Various technical areas have been identified where functionality offered by processors (such as DSPs) that are used in embedded systems cannot easily be exploited by applications written in C. Examples are fixed-point operations, usage of different memory spaces, low level I/O operations and others. The current proposal addresses only a few of these technical areas.

Embedded processors are often used to analyze analogue signals and process these signals by applying filtering algorithms to the data received. Typical applications can be found in all wireless devices. The common data type used in filtering algorithms is the fixed-point data type, and in order to achieve the necessary speed, embedded processors are often equipped with special hardware for fixed-point data. The C language (as defined in ISO/IEC 9899:1999) does not provide support for fixed-point arithmetic operations, currently leaving programmers with no option but to handcraft most of their algorithms in assembly language. This Technical Report specifies a fixed-point data type for C, definable in a range of precision and saturation options. Optimizing C compilers can generate highly efficient code for fixed-point data as easily as for integer and floating-point data.

Many embedded processors have multiple distinct banks of memory and require that data be grouped in different banks to achieve maximum performance. Ensuring the simultaneous flow of data and coefficient data to the multiplier/accumulator of processors designed for FIR filtering, for example, is critical to their operation. In order to allow the programmer to declare the memory space from which a specific data object must be fetched, this Technical Report specifies basic support for multiple address spaces. As a result, optimizing compilers can utilize the ability of processors that support multiple address spaces, for instance, to read data from two separate memories in a single cycle to maximize execution speed.

As the C language has matured over the years, various extensions for accessing basic I/O hardware (iohw) registers have been added to address deficiencies in the language. Today almost all C compilers for freestanding environments and embedded systems support some method of direct access to iohw registers from the C source level. However, these extensions have not been consistent across dialects.

This Technical Report provides an approach to codifying common practice and providing a single uniform syntax for basic iohw register addressing.

The functional differences between the first edition of ISO/IEC TR 18037 and this version are detailed in Annex G. Due to the different fonts used and the detailed lay-out, in a fully differences-marqued-up-document these differences are blurred. If however such a version is necessary for a proper review, please visit http://standards.iso.org/iso .

1 Scope

This Technical Report specifies a series of extensions of the programming language C, which is specified by ISO/IEC 9899:1999. These extensions support embedded processors.

Each clause in this Technical Report deals with a specific topic. The first subclauses of clauses 4, 5 and 6 contain a technical description of the features of the topic. These subclauses provide an overview but do not contain all the fine details. The last subclause of each clause contains the editorial changes to the standard necessary to fully specify the topic in the standard, and thereby provides a complete definition. Additional explanation and rationale are provided in the Annexes.

2 Normative references

The following referenced documents are indispensable for the application of this document. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies.

  • ISO/IEC 9899:1999 — Programming languages — C