Compiler Abstraction (Compiler)
AUTOSAR Classic Special Files-Modul Compiler Abstraction (Compiler, Spezifikation: AUTOSAR_SWS_CompilerAbstraction.pdf).
Für Compiler liegen in den extrahierten Spezifikationsdaten keine C-个 API 函数 oder -Datentypen vor. Nachfolgend sind die 35 Anforderungs-Records der Spezifikation aufgeführt.
Anforderungen — Übersicht
SWS_COMPILER_00001Macro name: FUNC Syntax: #define FUNC(rettype, memclass) Parameters (in): r etype return type of the function m emclass...SWS_COMPILER_00003For each compiler and platform an own compiler abstraction has to be provide d.SWS_COMPILER_00004The file name of the compiler abstraction shall be ‘Compiler.SWS_COMPILER_00005If a compiler does not require or support the usage of special keywords; the corresponding macros specified by this...SWS_COMPILER_00006Macro name: P2VAR Syntax: #define P2VAR(ptrtype, memclass, ptrclass) Parameters (in): ptrtype type of the referenced variable...SWS_COMPILER_00010The compiler abstraction shall define a symbol for the target compiler according to the following naming conventio n: __C__...SWS_COMPILER_00013Macro name: P2CONST Syntax: #define P2CONST(ptrtype, memclass, ptrclass) Parameters (in): ptrtype type of the referenced...SWS_COMPILER_00023Macro name: CONST Syntax: #define CONST(consttype, memclass) Parameters (in): consttype type of the constant memclass classif...SWS_COMPILER_00026Macro name: VAR Sy ntax: #define VAR(vartype, memclass) Parameters (in): v artype type of the variable m emclass...SWS_COMPILER_00030“Compiler.SWS_COMPILER_00031Macro name: CONSTP2VAR Syntax: #define CONSTP2VAR (ptrtype, memclass, ptrclass) Parameters (in): p trtype type of the...SWS_COMPILER_00032Macro name: CONSTP2CONST Syntax: #define CONSTP2CONST(ptrtype, me mclass, ptrclass) Parameters (in): ptrtype type of the...SWS_COMPILER_00036C forbids the use of the far/near - keywords on function local variables (auto - variables).SWS_COMPILER_00039Macro name: P2FUNC Syntax: #def ine P2FUNC(rettype, ptrclass, fctname) Parameters (in): rettype return type of the function...SWS_COMPILER_00040Each AUTOSAR software module and application software component shall support the distinction of at least the following...SWS_COMPILER_00041Each AUTOSAR software module and application software component shall wrap declaration and definition of code, variables,...SWS_COMPILER_00042The file Compiler.SWS_COMPILER_00046Define: AUTOMATIC Range: “empty” -- Description: The memory class AUTOMATIC shall be provided as empty definition, used for...SWS_COMPILER_00047The Compiler.SWS_COMPILER_00048The SWS Compiler Abstraction is applicable for each AUTOSAR basic software module and application software components.SWS_COMPILER_00050It is allowed to extend the Compiler Abstraction header with vendor specific extensions.SWS_COMPILER_00051Define: NULL_PTR Range: void pointer ((void *)0) Description: The compiler abstraction shall provide the NULL_PTR define with...SWS_COMPILER_00053The file Compiler.SWS_COMPILER_00054Module specific extended elements shall contain the module abbreviation of the BSW module in the name.SWS_COMPILER_00055The file Compiler_Cfg.SWS_COMPILER_00057Define: INLINE Range: inline/”empty” -- Description: The compiler abstraction shall provide the INLINE define for abstraction...SWS_COMPILER_00058In the parameter list of this macro no further Compiler Abstraction m acros shall be nested.SWS_COMPILER_00059Define: TYPEDEF Range: “empty” -- Description: The memory class TYPEDEF shall be provided as empty definition.SWS_COMPILER_00060Define: LOCAL_INLINE Range: static inline/”empty” -- Description: The compiler abstraction shall provide the LOCAL_INLINE...SWS_COMPILER_00061Macro name: FUNC_P2CONST Syntax: #define FUNC_P2CONST(rettype, ptrclass, memclass) Parameters (in): ret t ype return type of...SWS_COMPILER_00062In the parameter list of the FUNC_P2CONST, no further Compiler Abstraction macros shall be nested.SWS_COMPILER_00063Macro name: FUNC_P2 VAR Syntax: #define FUNC_P2VAR(rettype, ptrclass, memclass) Parameters (in): ret t ype return type of the...SWS_COMPILER_00064In the parameter list of the macro FUNC_P2VAR, no further Compiler Abstraction macros shall be nested.SWS_COMPILER_00065Macro name: CONSTP2FUNC Syntax: #define CONSTP2FUNC(rettype, ptrclass, fctname) Parameters (in): rettype return type of the...SWS_COMPILER_00999Thes e requirements are not applicable to this specification.
Anforderungen — Detailansicht
requirement SWS_COMPILER_00001 [SWS_COMPILER_00001] 📄 PDF
Macro name: FUNC Syntax: #define FUNC(rettype, memclass) Parameters (in): r etype return type of the function m emclass classification of the function itself Parameters (out): N one -- Return value: N one -- Description: The compiler abstraction shall define the FUNC macro for the declaration and definition of functions that ensures correct syntax of function declarations as required by a specific compiler. Caveats: -- Configuration: --
requirement SWS_COMPILER_00003 [SWS_COMPILER_00003] 📄 PDF
For each compiler and platform an own compiler abstraction has to be provide d.
requirement SWS_COMPILER_00004 [SWS_COMPILER_00004] 📄 PDF
The file name of the compiler abstraction shall be ‘Compiler.h’.
requirement SWS_COMPILER_00005 [SWS_COMPILER_00005] 📄 PDF
If a compiler does not require or support the usage of special keywords; the corresponding macros specified by this specification shall be provided as empty def initions or definitions without effect. Example: #define FUNC(type, memclass) type /* not required for DIABDATA */
requirement SWS_COMPILER_00006 [SWS_COMPILER_00006] 📄 PDF
Macro name: P2VAR Syntax: #define P2VAR(ptrtype, memclass, ptrclass) Parameters (in): ptrtype type of the referenced variable memclass classification of the pointer’s variable itself ptrclass defines the classification of the pointer’s distance Pa rameters (out): none -- Return value: none -- Description: The compiler abstraction shall define the P2VAR macro for the declaration and definition of pointers in RAM, pointing to variables. The pointer itself is modifiable (e.g. ExamplePtr++). The poin ter’s target is modifiable (e.g. *ExamplePtr = 5). Caveats: -- Configuration: --
requirement SWS_COMPILER_00010 [SWS_COMPILER_00010] 📄 PDF
The compiler abstraction shall define a symbol for the target compiler according to the following naming conventio n: _<COMPILERNAME>_C_<PLATFORMNAME>_ Note 1: In order to avoid incompatibilities and/ or inconsistencies , t he compiler symbol definitions are not allowed to contain any value behind the symbol. Note 2 : These defines can be used to switch between differ ent implementations for different compilers, e.g. inline assembler fragments in drivers special pragmas for memory alignment control localization of function calls adaptions to memory models
requirement SWS_COMPILER_00013 [SWS_COMPILER_00013] 📄 PDF
Macro name: P2CONST Syntax: #define P2CONST(ptrtype, memclass, ptrclass) Parameters (in): ptrtype type of the referenced constant memclass classification of the pointer’s va riable itself ptrclass defines the classification of the pointer’s distance Parameters (out): none -- Return value: none -- Description: The compiler abstraction shall define the P2CONST macro for the declaration and definition of pointers in RAM poin ting to constants The pointer itself is modifiable (e.g. ExamplePtr++). The pointer’s target is not modifiable (read only). Caveats: -- Configuration: --
requirement SWS_COMPILER_00023 [SWS_COMPILER_00023] 📄 PDF
Macro name: CONST Syntax: #define CONST(consttype, memclass) Parameters (in): consttype type of the constant memclass classif ication of the constant itself Parameters (out): none -- Return value: none -- Description: The compiler abstraction shall define the CONST macro for the declaration and definition of constants. Caveats: -- Configuration: --
requirement SWS_COMPILER_00026 [SWS_COMPILER_00026] 📄 PDF
Macro name: VAR Sy ntax: #define VAR(vartype, memclass) Parameters (in): v artype type of the variable m emclass classification of the variable itself Parameters (out): N one -- Return value: N one -- Description: The compiler abstraction shall define the VAR macro for the declaration and definition of variables. Caveats: -- Configuration: --
requirement SWS_COMPILER_00030 [SWS_COMPILER_00030] 📄 PDF
“Compiler.h” shall provide information of the supported compiler vendor and the applicable compiler version.
requirement SWS_COMPILER_00031 [SWS_COMPILER_00031] 📄 PDF
Macro name: CONSTP2VAR Syntax: #define CONSTP2VAR (ptrtype, memclass, ptrclass) Parameters (in): p trtype type of the referenced variable m emclass classification of the pointer’s constant itself p trclass defines the classification of the pointer’s d istance Parameters (out): N one -- Return value: N one -- Description: The compiler abstraction shall define the CONSTP2VAR macro for the declaration and definition of constant pointers accessing variables. The pointer itself is not modifiable (fix addre ss). The pointer’s target is modifiable (e.g. *ExamplePtr = 18). Caveats: -- Configuration: --
requirement SWS_COMPILER_00032 [SWS_COMPILER_00032] 📄 PDF
Macro name: CONSTP2CONST Syntax: #define CONSTP2CONST(ptrtype, me mclass, ptrclass) Parameters (in): ptrtype type of the referenced constant memclass classification of the pointer’s constant itself ptrclass defines the classification of the pointer’s distance Parameters (out): none -- Return value: none -- Descri ption: The compiler abstraction shall define the CONSTP2CONST macro for the declaration and definition of constant pointers accessing constants. The pointer itself is not modifiable (fix address). The pointer’s target is not modifiable (read only). Cavea ts: -- Configuration: --
requirement SWS_COMPILER_00036 [SWS_COMPILER_00036] 📄 PDF
C forbids the use of the far/near - keywords on function local variables (auto - variables). For thi s reason when using the macros below to allocate a pointer on stack, the memclass - parameter shall be set to AUTOMATIC.
requirement SWS_COMPILER_00039 [SWS_COMPILER_00039] 📄 PDF
Macro name: P2FUNC Syntax: #def ine P2FUNC(rettype, ptrclass, fctname) Parameters (in): rettype return type of the function ptrclass defines the classification of the pointer’s distance fctname function name respectively name of the defined type Parameters (out): N one -- Return v alue: N one -- Description: The compiler abstraction shall define the P2FUNC macro for the type definition of pointers to functions. Caveats: -- Configuration: --
requirement SWS_COMPILER_00040 [SWS_COMPILER_00040] 📄 PDF
Each AUTOSAR software module and application software component shall support the distinction of at least the following different memory classes and pointer classes.
requirement SWS_COMPILER_00041 [SWS_COMPILER_00041] 📄 PDF
Each AUTOSAR software module and application software component shall wrap declaration and definition of code, variables, constants an d pointer types using the following keyword macros:
requirement SWS_COMPILER_00042 [SWS_COMPILER_00042] 📄 PDF
The file Compiler.h is specific for each build scenario. Therefore there is no standardized configuration interface specified.
requirement SWS_COMPILER_00046 [SWS_COMPILER_00046] 📄 PDF
Define: AUTOMATIC Range: “empty” -- Description: The memory class AUTOMATIC shall be provided as empty definition, used for the declaration of local pointers. Caveats: SWS_COMPILER_00040
requirement SWS_COMPILER_00047 [SWS_COMPILER_00047] 📄 PDF
The Compiler.h header file shall protect itself against multiple inclusions. F or instance: #ifndef COMPILER_H #define COMPILER_H /* implementation of Compiler.h */ ... #endif /* COMPILER_H */ T here may be only comments outside of the ifndef - endif bracket.
requirement SWS_COMPILER_00048 [SWS_COMPILER_00048] 📄 PDF
The SWS Compiler Abstraction is applicable for each AUTOSAR basic software module and application software components. Therefore, the implementation of the memory class (memclass) and pointer class (ptrclass) macro parameters (see SWS_COMPILER_00040 ) shall fulfill the implementation and configuration specific needs of each software module in a specific build scenario.
requirement SWS_COMPILER_00050 [SWS_COMPILER_00050] 📄 PDF
It is allowed to extend the Compiler Abstraction header with vendor specific extensions. Vendor specific extended elements shall contain the AUTOSAR Vendor ID in the name.
requirement SWS_COMPILER_00051 [SWS_COMPILER_00051] 📄 PDF
Define: NULL_PTR Range: void pointer ((void *)0) Description: The compiler abstraction shall provide the NULL_PTR define with a void pointer to zero definition. Caveats: SWS_COMPILER_00040
requirement SWS_COMPILER_00053 [SWS_COMPILER_00053] 📄 PDF
The file Compiler.h shall contain the definitions and macros specified in chapter 7.1.5 . Those are fix for one specific compiler and platform.
requirement SWS_COMPILER_00054 [SWS_COMPILER_00054] 📄 PDF
Module specific extended elements shall contain the module abbreviation of the BSW module in the name. Application software component specific extended elements shall contain the Software Component Type ’s name.
requirement SWS_COMPILER_00055 [SWS_COMPILER_00055] 📄 PDF
The file Compiler_Cfg.h shall contain the module/component specific parameters ( ptrclass and memclass ) that are passed to the macros defined in Compiler.h. See SWS_COMPILER_00040 for memory types and required syntax.
requirement SWS_COMPILER_00057 [SWS_COMPILER_00057] 📄 PDF
Define: INLINE Range: inline/”empty” -- Description: The compiler abstraction shall provide the INLINE define for abstraction of the keyword inline. Caveats: SWS_ COMPILER_00040
requirement SWS_COMPILER_00058 [SWS_COMPILER_00058] 📄 PDF
In the parameter list of this macro no further Compiler Abstraction m acros shall be nested. Instead, use a previously defined type as return type or use FUNC_P2CONST/FUNC_P2VAR.
requirement SWS_COMPILER_00059 [SWS_COMPILER_00059] 📄 PDF
Define: TYPEDEF Range: “empty” -- Description: The memory class TYPEDEF shall be provided as empty definition. This memory class shall be used within type definitions, where no memory qualifier can be specified. Th is can be necessary for defining pointer types, with e.g. P2VAR, where the macros require two parameters. First parameter can be specified in the type definition (distance to the memory location referenced by the pointer), but the second one (memory alloca tion of the pointer itself) cannot be defined at this time. Hence, memory class TYPEDEF shall be applied. Caveats: SWS_COMPILER_00040
requirement SWS_COMPILER_00060 [SWS_COMPILER_00060] 📄 PDF
Define: LOCAL_INLINE Range: static inline/”empty” -- Description: The compiler abstraction shall provide the LOCAL_INLINE define for abstraction of the keyword inline in functions wi th “static” scope. Caveats: Different compilers may require a different sequence of the keywords “static” and “inline” if this is supported at all.
requirement SWS_COMPILER_00061 [SWS_COMPILER_00061] 📄 PDF
Macro name: FUNC_P2CONST Syntax: #define FUNC_P2CONST(rettype, ptrclass, memclass) Parameters (in): ret t ype return type of the function ptrclass defines the classification of the pointer’s distance memclas s classification of the function itself Parameters (out): none -- Return value: none -- Description: The compiler abstraction shall define the FUNC_P2CONST macro for the declaration and definition of functions returning a pointer to a constant. This sha ll ensure the correct syntax of function declarations as required by a specific compiler. Caveats: -- Configuration: --
requirement SWS_COMPILER_00062 [SWS_COMPILER_00062] 📄 PDF
In the parameter list of the FUNC_P2CONST, no further Compiler Abstraction macros shall be nested.
requirement SWS_COMPILER_00063 [SWS_COMPILER_00063] 📄 PDF
Macro name: FUNC_P2 VAR Syntax: #define FUNC_P2VAR(rettype, ptrclass, memclass) Parameters (in): ret t ype return type of the function ptrclass defines the classification of the pointer’s distance memclass classification of the function itself Parameters (out): none -- Return value: none -- Description: The compiler abstraction shall define the FUNC_P2VAR macro for the declaration and definition of functions returning a pointer to a variable. This shall ensure the correct syntax of function declarations as required by a specific compiler. Caveats: -- Configuration: --
requirement SWS_COMPILER_00064 [SWS_COMPILER_00064] 📄 PDF
In the parameter list of the macro FUNC_P2VAR, no further Compiler Abstraction macros shall be nested.
requirement SWS_COMPILER_00065 [SWS_COMPILER_00065] 📄 PDF
Macro name: CONSTP2FUNC Syntax: #define CONSTP2FUNC(rettype, ptrclass, fctname) Parameters (in): rettype return type of the function ptrclass defines t he classification of the pointer’s distance fctname function name respectively name of the defined type Parameters (out): N one -- Return value: N one -- Description: The compiler abstraction shall define the CONSTP2FUNC macro for the type definition o f constant pointers to functions. Caveats: -- Configuration: --
requirement SWS_COMPILER_00999 [SWS_COMPILER_00999] 📄 PDF
Thes e requirements are not applicable to this specification.
Request a governed re-review of this record. The record is not changed immediately.
- Record
AUTOSAR/AP/record/CP_MOD_Compiler- Status
- unspecified
- Version
AUTOSAR/AP/record/CP_MOD_Compiler@rel:R20-11#63e3e222- Content hash
63e3e222- Source
- https://www.autosar.org/fileadmin/standards/R20-11/CP/AUTOSAR_SWS_CompilerAbstraction.pdf#nameddest=SWS_COMPILER_00001