General Specification Of Basic Software Modules - AUTOSAR

Transcription

General Specification of Basic Software ModulesAUTOSAR CP Release 4.3.1Document TitleGeneral Specification of BasicSoftware ModulesDocument OwnerDocument ResponsibilityDocument Identification NoAUTOSARAUTOSAR578Document StatusPart of AUTOSAR StandardPart of Standard ReleaseFinalClassic Platform4.3.1Document Change HistoryDateRelease Changed nagementChange Description minor corrections / clarifications /editorial changes; For details pleaserefer to the ChangeDocumentation Meta Data handling Changed to MISRA C 2012Standard Debugging support was removed minor corrections / clarifications /editorial changes; For details pleaserefer to the ChangeDocumentation Debugging support marked asobsolete minor corrections / clarifications /editorial changes; For details pleaserefer to the ChangeDocumentation Update in error handlingclassification Update in initialization functionrequirements Updated due toSupportForPBLAndPBSECUConfiguration concept minor corrections / clarifications /editorial changes; For details pleaserefer to the BWCStatement1 of 86Document ID 578: AUTOSAR SWS BSWGeneral- AUTOSAR confidential -

General Specification of Basic Software ModulesAUTOSAR CP Release 4.3.1Document Change HistoryDateRelease Changed ARAdministrationChange Description Update of include file structure andrequired header files requirementspecification Update of inter-module versioncheck – removedREVISION/PATCH VERSION fromthe required check Formating and spelling corrections Moved declarations ofMainFunctions andBswModuleClientServerEntrys fromthe module header files toRTE/BswScheduler Modified the Published Informationdefinitions Added the NULL pointer checkingmechanism description Removed the "Fixed cyclic","Variable cyclic" and "On precondition" from the ScheduledFunctions description Editorial changes Initial release2 of 86Document ID 578: AUTOSAR SWS BSWGeneral- AUTOSAR confidential -

General Specification of Basic Software ModulesAUTOSAR CP Release 4.3.1DisclaimerThis work (specification and/or software implementation) and the material containedin it, as released by AUTOSAR, is for the purpose of information only. AUTOSARand the companies that have contributed to it shall not be liable for any use of thework.The material contained in this work is protected by copyright and other types ofintellectual property rights. The commercial exploitation of the material contained inthis work requires a license to such intellectual property rights.This work may be utilized or reproduced without any modification, in any form or byany means, for informational purposes only. For any other purpose, no part of thework may be utilized or reproduced, in any form or by any means, without permissionin writing from the publisher.The work has been developed for automotive applications only. It has neither beendeveloped, nor tested for non-automotive applications.The word AUTOSAR and the AUTOSAR logo are registered trademarks.3 of 86Document ID 578: AUTOSAR SWS BSWGeneral- AUTOSAR confidential -

General Specification of Basic Software ModulesAUTOSAR CP Release 4.3.1Table of Contents1Introduction and functional overview . 61.11.2Traceability . 6Document conventions . 62Acronyms and abbreviations . 83Related documentation. 93.13.24Input documents . 9Related standards and norms . 10Constraints and assumptions . 114.14.25Limitations . 11Applicability to car domains . 11Dependencies to other modules . 125.1File structure . 125.1.1 Module implementation prefix . 125.1.2 Module implementation files. 135.1.3 Imported and exported information . 145.1.4 BSW Module Description . 155.1.5 Module documentation . 155.1.6 Code file structure . 165.1.7 Header file structure . 205.1.8 Version check . 256Requirements traceability . 277Functional specification . 347.1General implementation specification. 347.1.1 Conformance to MISRA C and C standard . 347.1.2 Conformance to AUTOSAR Basic Software Requirements . 347.1.3 Conformance to AUTOSAR Methodology . 357.1.4 Platform independency and compiler abstraction . 357.1.5 Configurability . 377.1.6 Various naming conventions . 387.1.7 Configuration parameters . 397.1.8 Shared code. 407.1.9 Global data . 407.1.10Usage of macros and inline functions . 417.1.11Calling Scheduled functions (Main processing functions) . 417.1.12Exclusive areas . 417.1.13Callouts. 427.1.14AUTOSAR Interfaces. 437.1.15Interrupt service routines . 437.1.16Restricted OS functionality access . 447.1.17Access to hardware registers . 467.1.18Data types . 474 of 86Document ID 578: AUTOSAR SWS BSWGeneral- AUTOSAR confidential -

General Specification of Basic Software ModulesAUTOSAR CP Release 4.3.17.1.19Distributed execution on multi-partitioned systems . 497.2Error Handling . 507.2.1 Classification . 507.2.2 Development errors . 507.2.3 Runtime errors . 537.2.4 Transient faults . 547.2.5 Extended production errors and production errors . 557.2.6 Specific topics . 597.3Meta Data Handling. 618API specification . 638.1Imported types. 638.2Type definitions . 638.3Function definitions . 648.3.1 General specification on API functions . 648.3.2 Initialization function. 668.3.3 De-Initialization function . 688.3.4 Get Version Information . 688.4Callback notifications. 718.5Scheduled functions . 728.6Expected Interfaces. 738.6.1 Mandatory Interfaces . 738.6.2 Optional Interfaces . 738.6.3 Configurable interfaces . 738.7Service Interfaces. 749Sequence diagrams . 7510 Configuration specification . 7610.1 Introduction to configuration specification . 7610.1.1Configuration and configuration parameters . 7610.1.2Variants . 7610.1.3Containers . 7710.1.4Configuration parameter tables . 7710.1.5Configuration class labels . 7910.2 General configuration specification . 7910.2.1Configuration files . 7910.2.2Implementation names for configuration parameters . 7910.2.3Pre-compile time configuration . 8010.2.4Link time configuration . 8110.2.5Post-build time configuration . 8110.2.6Configuration variants . 8210.3 Published Information. 845 of 86Document ID 578: AUTOSAR SWS BSWGeneral- AUTOSAR confidential -

General Specification of Basic Software ModulesAUTOSAR CP Release 4.3.11Introduction and functional overviewThis document is the general basic software specification on AUTOSAR BasicSoftware modules. It complements the specification of BSW modules with as acommon specification, which is valid for various BSW modules.1.1 TraceabilityThe Specification items from this document describe the work products from theBSW Module implementation or their parts with regard to the Basic SoftwareRequirements, which are described in AUTOSAR General Requirements on BasicSoftware Modules [3].For every BSW Module, the traceability between Specification items and BasicSoftware Requirements is in scope of this document and the according BSW ModuleSoftware Specification. See also chapter 6 - Requirements traceability.The BSW Module implementation must guarantee traceability to the correspondingSpecification items of this document and of the corresponding BSW Modulespecification.Some Specification items are not applicable to every BSW Module. In such a case,its description explicitly mentions the condition for its applicability. If no condition ismentioned, the Specification item is applicable for all BSW Modules.Please refer to AUTOSAR Standardization Template [13], chapter “Support fortraceability” for further information.1.2 Document conventionsCode examples, symbols and other technical terms in general are typeset inmonospace font, e.g. const.Terms and expressions defined in AUTOSAR Glossary [7], within this specification(see chapter 2 - Acronyms and abbreviations) or in related documentation aretypeset in italic font, e.g. Module implementation prefix.The Basic Software Requirements are described in document SRS BSW General [3].These are referenced using SRS BSW n where n is its requirement id. Forinstance: SRS BSW 00009.Every Specification item starts with [SWS BSW nr ], where nr is its uniqueidentifier number of the Specification item. This number is followed by theSpecification item title. The scope of the Specification item description is marked withhalf brackets and is followed by the list of related requirements from SRS BSWGeneral, between braces.6 of 86Document ID 578: AUTOSAR SWS BSWGeneral- AUTOSAR confidential -

General Specification of Basic Software ModulesAUTOSAR CP Release 4.3.1Example:[SWS BSW nr ] Specification item title⌈ Specification item description. ⌋(SRS BSW nr1 , SRS BSW nr2 )References to Specification items from other AUTOSAR documents use theconventions from the according document, for instance [SWS CANIF 00001].7 of 86Document ID 578: AUTOSAR SWS BSWGeneral- AUTOSAR confidential -

General Specification of Basic Software ModulesAUTOSAR CP Release 4.3.12Acronyms and abbreviationsAbbreviation /Acronym:BSW driverCamel case Ie Ma MA MCAL Mip MIP WMDSWCDDescription:For a list of BSW drivers see the List of Basic Software Modules [1],column “AUTOSAR SW layer”.This document does not aim to specify rules for the camel casenotation. Definition of CamelCase according to Wikipedia (seechapter 3.1):“camelCase ( ) is the practice of writing compound words orphrases in which the elements are joined without spaces, with eachelement's initial letter capitalized within the compound and the firstletter either upper or lower case ( ).”Example: GetVersionInfoImplementation specific file name extension, see SWS BSW 00103.Module abbreviation, see SWS BSW 00101.Capitalized module abbreviation. The Capitalized module abbreviation MA is the Module abbreviation Ma (see bsw constr 001)completely written in upper case.The MCAL, Microcontroller Abstraction Layer, is defined inAUTOSAR Layered Software Architecture [2]Module implementation prefix, see SWS BSW 00102.Capitalized module implementation prefix. The Capitalized moduleimplementation prefix MIP is the Module implementation prefix Mip (SWS BSW 00102) completely written in upper case.Module implementation prefix, see SWS BSW 00102.Module abbreviation, see SWS BSW 00101.Worst case execution time.Basic Software Module DescriptionSoftware Component Description8 of 86Document ID 578: AUTOSAR SWS BSWGeneral- AUTOSAR confidential -

General Specification of Basic Software ModulesAUTOSAR CP Release 4.3.13Related documentation3.1 Input documents[1] List of Basic Software ModulesAUTOSAR TR BSWModuleList.pdf[2] AUTOSAR Layered Software ArchitectureAUTOSAR EXP LayeredSoftwareArchitecture.pdf[3] AUTOSAR General Requirements on Basic Software ModulesAUTOSAR SRS BSWGeneral.pdf[4] AUTOSAR Specification of BSW Module Description TemplateAUTOSAR TPS BSWModuleDescriptionTemplate.pdf[5] AUTOSAR Specification of RTEAUTOSAR SWS RTE.pdf[6] AUTOSAR Specification of Memory MappingAUTOSAR SWS MemoryMapping.pdf[7] AUTOSAR GlossaryAUTOSAR TR Glossary.pdf[8] AUTOSAR Specification of Operating SystemAUTOSAR SWS OS.pdf[9] AUTOSAR Specification of Software Component TemplateAUTOSAR TPS SoftwareComponentTemplate.pdf[10]AUTOSAR Specification of Diagnostic Event ManagerAUTOSAR SWS DiagnosticEventManager.pdf[11]AUTOSAR MethodologyAUTOSAR TR Methodology.pdf[12]AUTOSAR Specification of Standard TypesAUTOSAR SWS PlatformTypes.pdf[13]AUTOSAR Standardization TemplateAUTOSAR TPS StandardizationTemplate.pdf[14]AUTOSAR Specification of ECU ConfigurationAUTOSAR TPS ECUConfiguration.pdf9 of 86Document ID 578: AUTOSAR SWS BSWGeneral- AUTOSAR confidential -

General Specification of Basic Software ModulesAUTOSAR CP Release 4.3.1[15]AUTOSAR Specification of Default Error TracerAUTOSAR SWS DefaultErrorTracer.pdf[16]CamelCase – Wikipedia, the free 3.2 Related standards and norms[17]MISRA C 2012 StandardHomepage: http://www.misra.org.uk/[18]IEC 7498-1 The Basic Model, IEC Norm, 199410 of 86Document ID 578: AUTOSAR SWS BSWGeneral- AUTOSAR confidential -

General Specification of Basic Software ModulesAUTOSAR CP Release 4.3.14Constraints and assumptions4.1 LimitationsThis specification is common to all AUTOSAR BSW Modules [1] and contains onlygeneral Specification items on BSW Modules. Some of these specification items maynot be relevant to particular BSW Modules, whenever the conditions specified are notfulfilled.4.2 Applicability to car domainsThis document can be used for all domain applications when AUTOSAR BasicSoftware modules are used.11 of 86Document ID 578: AUTOSAR SWS BSWGeneral- AUTOSAR confidential -

General Specification of Basic Software ModulesAUTOSAR CP Release 4.3.15Dependencies to other modulesThis specification is common to all AUTOSAR BSW Modules [1] and contains onlygeneral Specification items, which complement every single BSW Modulespecification. It shall not be used as a standalone specification.Example: The CAN Interface module is specified by this specification (GeneralSpecification for BSW Modules) and by the document Specification on CAN Interface(SWS CAN Interface).5.1 File structureThis specification does not completely define the BSW Module file structure.Nevertheless, names of implementation files not specified here must anyway followSWS BSW 00103.5.1.1 Module implementation prefixThe BSW Module implementation prefix is used to form various identifiers used inwork products of the BSW Module implementation, e.g. API names, parameternames, symbols and file names. This prefix is mainly formed by the Moduleabbreviation and, when necessary, additional vendor specific information.The list of Module abbreviations is available in the List of Basic Software Modules [1]within the column “Module Abbreviation”.[SWS BSW 00101] Module abbreviation⌈The Module abbreviation Ma of a BSW Module shall be the same as defined inthe List of Basic Software Modules [1].⌋(SRS BSW 00300)The Capitalized module abbreviation MA is the Module abbreviation completelywritten in upper case.Examples of BSW Module abbreviations: EcuM, CanIf, OS, Com. The correspondingCapitalized module abbreviations are ECUM, CANIF, OS, COM.[SWS BSW 00102] Module implementation prefix⌈The Module implementation prefix Mip shall be formed in the following way: Ma [ vi ai ]Where Ma is the Module abbreviation of the BSW Module (SWS BSW 00101), vi is its vendorId and ai is its vendorApiInfix. The sub part in squarebrackets [ vi ai ] is omitted if no vendorApiInfix is defined for the BSWModule. For Complex Drivers and transformers, the Mip is directly derived fromthe apiServicePrefix.⌋(SRS BSW 00300, SRS BSW 00347)12 of 86Document ID 578: AUTOSAR SWS BSWGeneral- AUTOSAR confidential -

General Specification of Basic Software ModulesAUTOSAR CP Release 4.3.1The elements vendorId and vendorApiInfix are defined in BSW ModuleDescription Template [4]. Their usage may be obligatory in some situations, like incase of multiple instantiation of BSW Driver modules. These constraints are not inscope of SWS BSW General.The element apiServicePrefix is defined in BSW Module Description Template[4].The Capitalized module implementation prefix MIP is the Module implementationprefix completely written in upper case.In some situations, the Module implementation prefix is written in the same way asthe Module abbreviation. Nevertheless, their meanings are different: The usage ofModule implementation prefix is requested whenever a differentiation within the samemodule type could be necessary, e.g. to differentiate symbols from different moduleinstances.Examples of Module implementation prefixes: FrIf: Prefix for FlexRay Interface module implementation, where novendorId and vendorApiInfix are defined. Eep 21 LDExt: Prefix for EEPROM driver implementation, wherevendorApiInfix and vendorId are identified by “LDExt” and “21”respectively.Examples of Module abbreviations: FrIf: FlexRay Interface module abbreviation Eep: EEPROM driver module abbreviation5.1.2 Module implementation filesThis specification defines the following file types. Some of these types are mandatoryfor all BSW Modules, other depend on the according BSW Module specification:File type, for all BSW ModulesModule documentationBSW Module descriptionImplementation sourceImplementation headerCallback headerPre-compile time configuration headerLink time configuration sourceLink time configuration headerPost-build time configuration sourcePost-build time configuration headerInterrupt frame implementation conditionalconditionalconditionalExample: ComNot defined.Not defined. See [4].Com.cCom.hCom Cbk.hCom Cfg.hCom Lcfg.cCom Lcfg.hCom PBcfg.cCom PBcfg.hGpt Irq.cTable 1: Module Implementation Files13 of 86Document ID 578: AUTOSAR SWS BSWGeneral- AUTOSAR confidential -

General Specification of Basic Software ModulesAUTOSAR CP Release 4.3.1Note that according to AUTOSAR Methodology [11] it is possible to deliver a BSWModule with its object files and only part of the source code. See alsoSWS BSW 00117.[SWS BSW 00103] General file naming convention⌈The name of all BSW Module implementation files shall be formed in the followingway: Mip [ Ie ]*.*The sup-part in square brackets [ Ie ] is an optional implementation specific filename extension. The wildcards * are replaced according to the different types of filesspecified for the module.⌋(SRS BSW 00300)Example:Implementation sources for Can Interface module with vendor specific file nameextensions added: CanIf MainFncs.c, CanIf Api.c.[SWS BSW 00170] File names are case sensitive⌈File names shall be considered case sensitive regardless of the file system in whichthey are used.⌋(SRS BSW 00464)[SWS BSW 00171] File names are non-ambiguous⌈It shall not be allowed to name any two files so that they only differ by the case oftheir letters.⌋(SRS BSW 00465)5.1.3 Imported and exported information[SWS BSW 00104] Restrict imported information⌈The BSW Module shall import only the necessary information (i.e. header files) thatis required to fulfill its functional requirements.⌋(SRS BSW 00301)Note that the availability of other modules in the basic software depends on the usedconfiguration. This has to be considered before including header files of thesemodules.Example: The BSW module implementation is generated by an AUTOSAR toolchain.The module generator has to check before including header files of other modules ifthe respective module is available in the system according to the used configuration.[SWS BSW 00105] Restrict exported information⌈The BSW Module shall export only that kind of information in their correspondingheader files that is explicitly needed by other modules.⌋(SRS BSW 00302)This is necessary to avoid modules importing or exporting functionality that could bemisused. Also compile time might possibly be shortened through this restriction.14 of 86Document ID 578: AUTOSAR SWS BSWGeneral- AUTOSAR confidential -

General Specification of Basic Software ModulesAUTOSAR CP Release 4.3.1Example: The NVRAM Manager does not need to know all processor registers justbecause some implementation has included the processor register file in anotherheader file used by the NVRAM Manager.Note: After the module configuration, some imported or exported information mayalso become unnecessary, as part of the implementation may be disabled.5.1.4 BSW Module Description[SWS BSW 00001] Provide BSW Module description⌈The BSW Module description (.arxml) shall be provided for the module accordingto the AUTOSAR Specification of BSW Module Description Template[4].⌋(SRS BSW 00423, SRS BSW 00426, SRS BSW 00427, SRS BSW 00334)This specification does not define any file of the package structure for the BSWModule Description, as this delivery is specified in AUTOSAR Specification of BSWModule Description Template [4].5.1.5 Module documentation[SWS BSW 00002] Provide BSW Module documentation⌈The BSW Module documentation shall be provided with the BSW Moduleimplementation.The following content shall be part of it: Cover sheet with title, version number, date, company, document status,document name; Change history with version number, date, company, change description,document status; Table of contents (navigable); Functional overview; Source file list and description; Deviations to specification Deviations to requirements; Used resources (interrupts, µC peripherals etc.); Integration description (OS, interface to other modules etc.); Configuration description with parameter, description, unit, valid range, defaultvalue, relation to other parameters. Examples for:o The correct usage of the API;o The configuration of the module.The following content may be part of it: Memory footprint (RAM, ROM, stack size) together with the moduleconfiguration, platform information, compiler and compiler options, which wereused for the calculation.⌋(SRS BSW 00009, SRS BSW 00010)If possible the Memory footprint documentation may include a dependency15 of 86Document ID 578: AUTOSAR SWS BSWGeneral- AUTOSAR confidential -

General Specification of Basic Software ModulesAUTOSAR CP Release 4.3.1formula between configuration elements and used memory (e.g. each configuredDTC additionally requires x bytes ROM and y bytes RAM).[SWS BSW 00003] Provide information on supported microcontroller and used toolchain⌈If the BSW Module implementation depends on microcontroller, then the BSWModule documentation shall also contain the following information: Microcontroller vendor Microcontroller family Microcontroller derivative Microcontroller stepping (mask revision), if relevant Tool chain name and version Tool chain options which were used for development / qualification of module⌋(SRS BSW 00341)The scheduling strategy that is built inside the BSW Modules shall be compatible withthe strategy used in the system. To achieve this, the scheduling strategy of moduleimplementation shall be accordingly documented:[SWS BSW 00054] Document calling sequence of Scheduled functions⌈The BSW Module documentation shall provide information about the execution orderof his Scheduled functions, i.e. for every one of these functions, if it has to beexecuted in a specific order or sequence with respect to other BSW Scheduledfunction (or functions).⌋(SRS BSW 00428)The BSW Module own specification provides further details on the intendedsequence order of its Scheduled functions. This information shall be considered indocumentation either.[SWS BSW 00061] Document configuration rules and constraints⌈The BSW Module implementation shall provide configuration rules and constraints inthe Module documentation to enable plausibility checks of configuration during ECUconfiguration time where possible.⌋(SRS BSW 00167)5.1.6 Code file structureThe code file structure for the BSW Module implementation is provided in thischapter. Note that the file structure delivered to user may be different.Example:Source code is not delivered; various post-build configuration sets are delivered.5.1.6.1 Implementation sourceThe Implementation source provides the implementation for functionality of the BSWModule.16 of 86Document ID 578: AUTOSAR SWS BSWGeneral- AUTOSAR confidential -

General Specification of Basic Software ModulesAUTOSAR CP Release 4.3.1[SWS BSW 00004] Provide Implementation source files⌈The code file structure shall contain one or more files for the implementation of theprovided BSW Module functionality: the Implementation source files. The file namesshall be formed in the following way: Mip [ Ie ].c⌋(SRS BSW 00346)[SWS BSW 00060] Declarations within Implementation source files are restricted⌈The Implementation source files of the BSW Module shall declare all constants,global data types and functions that are only used by the module internally. Pre-linktime configuration parameters are an exception of this rule.⌋()To allow the compiler to check for consistency between declaration and definition ofglobal variables and fu

General Specification of Basic Software Modules AUTOSAR CP Release 4.3.1 - AUTOSAR confidential -