AUTOSAR SWS MemoryMapping
AUTOSAR SWS MemoryMapping
V1.4.0
R4.0 Rev 3
Disclaimer
This specification and the material contained in it, as released by AUTOSAR is for
the purpose of information only. AUTOSAR and the companies that have contributed
to it shall not be liable for any use of the specification.
The material contained in this specification is protected by copyright and other types
of Intellectual Property Rights. The commercial exploitation of the material contained
in this specification requires a license to such Intellectual Property Rights.
This specification may be utilized or reproduced without any modification, in any form
or by any means, for informational purposes only.
For any other purpose, no part of the specification may be utilized or reproduced, in
any form or by any means, without permission in writing from the publisher.
The AUTOSAR specifications have been developed for automotive applications only.
They have neither been developed, nor tested for non-automotive applications.
The word AUTOSAR and the AUTOSAR logo are registered trademarks.
Any such exemplary items are contained in the Specification Documents for
illustration purposes only, and they themselves are not part of the AUTOSAR
Standard. Neither their presence in such Specification Documents, nor any later
documentation of AUTOSAR conformance of products actually implementing such
exemplary items, imply that intellectual property rights covering such exemplary
items are licensed under the same rules as applicable to the AUTOSAR Standard.
Table of Contents
This wastage of memory can be circumvented if the variables are mapped to specific
memory sections depending on their size. This minimizes unused space in RAM.
For some variables (e.g. variables that are accessed via bit masks) it improves both
performance and code size if they are located within a RAM section that allows for bit
manipulation instructions of the compiler. Those RAM sections are usually known as
‘Near Page’ or ‘Zero Page’.
Usage of the same source code of a module for boot loader and application
If a module shall be used both in boot loader and application, it is necessary to allow
the mapping of code and data to different memory sections.
A mechanism for mapping of code and data to memory sections that is supported by
all compilers listed in chapter 3.1 is the usage of pragmas. As pragmas are very
compiler specific, a mechanism that makes use of those pragmas in a standardized
way has to be specified.
Support of partitioning
In some cases it is necessary to separate partition assigned memory.
Therefore an additional separation of the module variables into different memory
(partition-)areas is needed if the BSW Module shall support a split over several
Partitions.
Abbreviation / Description:
Acronym:
BSW Basic Software
ISR Interrupt Service Routine
NVRAM Non-Volatile RAM
3 Related documentation
[7] Methodology
AUTOSAR_TR_Methodology.pdf
[8] Cosmic C Cross Compiler User’s Guide for Motorola MC68HC12, V4.5
4.1 Limitations
During specification of abstraction and validation of concept the compilers listed in
chapter 3.1 have been considered. If any other compiler requires keywords that
cannot be mapped to the mechanisms described in this specification this compiler
will not be supported by AUTOSAR. In this case, the compiler vendor has to adapt its
compiler.
The concepts described in this document do only apply to C compilers. C++ is not in
scope of this version.
cd file structure
«includes»
[MEMMAP028] ⌈The Memory Mapping shall provide one BSW memory mapping
header file ‘<MemMap.h’.⌋()
[MEMMAP029] ⌈For each software component type which is part of the input
configuration a software component type specific memory mapping header file
‘<SWC>_MemMap.h’ shall be provided by the Memory Mapping.⌋()
cd file structure
«includes»
6 Requirements traceability
Requirement Satisfied by
- MEMMAP021
- MEMMAP029
- MEMMAP027
- MEMMAP022
- MEMMAP018
- MEMMAP016
- MEMMAP023
- MEMMAP015
- MEMMAP026
- MEMMAP030
- MEMMAP028
BSW00300 MEMMAP999
BSW00301 MEMMAP999
BSW00302 MEMMAP999
BSW00304 MEMMAP999
BSW00306 MEMMAP010, MEMMAP011, MEMMAP013, MEMMAP006, MEMMAP005,
MEMMAP003, MEMMAP007
BSW00307 MEMMAP999
BSW00308 MEMMAP999
BSW00309 MEMMAP999
BSW00310 MEMMAP999
BSW00312 MEMMAP999
BSW00314 MEMMAP999
BSW00323 MEMMAP999
BSW00324 MEMMAP999
BSW00325 MEMMAP999
BSW00326 MEMMAP999
BSW00327 MEMMAP999
BSW00328 MEMMAP005, MEMMAP001
BSW00329 MEMMAP999
BSW00330 MEMMAP999
BSW00331 MEMMAP999
BSW00333 MEMMAP999
BSW00334 MEMMAP999
BSW00335 MEMMAP999
BSW00336 MEMMAP999
BSW00337 MEMMAP999
BSW00338 MEMMAP999
BSW00339 MEMMAP999
BSW00341 MEMMAP999
BSW00342 MEMMAP999
BSW00343 MEMMAP999
BSW00344 MEMMAP999
BSW00345 MEMMAP999
BSW00346 MEMMAP999
BSW00347 MEMMAP999
BSW00348 MEMMAP999
BSW00350 MEMMAP999
BSW00353 MEMMAP999
BSW00355 MEMMAP999
BSW00357 MEMMAP999
BSW00358 MEMMAP999
BSW00359 MEMMAP999
BSW00360 MEMMAP999
BSW00361 MEMMAP002
BSW00369 MEMMAP999
BSW00370 MEMMAP999
BSW00371 MEMMAP999
BSW00373 MEMMAP999
BSW00375 MEMMAP999
BSW00377 MEMMAP999
BSW00378 MEMMAP999
BSW00380 MEMMAP999
BSW00381 MEMMAP999
BSW00383 MEMMAP999
BSW00384 MEMMAP020
BSW00385 MEMMAP999
BSW00386 MEMMAP999
BSW00387 MEMMAP999
BSW00388 MEMMAP999
BSW00389 MEMMAP999
BSW00390 MEMMAP999
BSW00391 MEMMAP999
BSW00392 MEMMAP999
BSW00393 MEMMAP999
BSW00394 MEMMAP999
BSW00395 MEMMAP999
BSW00396 MEMMAP999
BSW00397 MEMMAP999
BSW00398 MEMMAP999
BSW00399 MEMMAP999
BSW004 MEMMAP999
BSW00400 MEMMAP999
BSW00401 MEMMAP999
BSW00404 MEMMAP999
BSW00405 MEMMAP999
BSW00406 MEMMAP999
BSW00407 MEMMAP999
BSW00408 MEMMAP999
BSW00409 MEMMAP999
BSW00410 MEMMAP999
BSW00411 MEMMAP999
BSW00412 MEMMAP999
BSW00413 MEMMAP999
BSW00414 MEMMAP999
BSW00415 MEMMAP999
BSW00416 MEMMAP999
BSW00417 MEMMAP999
BSW00419 MEMMAP999
BSW00420 MEMMAP999
BSW00421 MEMMAP999
BSW00422 MEMMAP999
BSW00423 MEMMAP999
BSW00424 MEMMAP999
BSW00425 MEMMAP999
BSW00426 MEMMAP999
BSW00427 MEMMAP999
BSW00428 MEMMAP999
BSW00429 MEMMAP999
BSW00431 MEMMAP999
BSW00432 MEMMAP999
BSW00433 MEMMAP999
BSW00434 MEMMAP999
BSW005 MEMMAP999
BSW006 MEMMAP010, MEMMAP011, MEMMAP013, MEMMAP006, MEMMAP005,
MEMMAP003, MEMMAP007
16 of 63 Document ID 128: AUTOSAR_SWS_MemoryMapping
- AUTOSAR confidential -
Specification of Memory Mapping
V1.4.0
R4.0 Rev 3
BSW00605 MEMMAP999
BSW007 MEMMAP999
BSW009 MEMMAP999
BSW010 MEMMAP999
BSW101 MEMMAP999
BSW158 MEMMAP999
BSW159 MEMMAP999
BSW160 MEMMAP999
BSW161 MEMMAP999
BSW162 MEMMAP999
BSW164 MEMMAP999
BSW167 MEMMAP999
BSW168 MEMMAP999
BSW170 MEMMAP999
BSW171 MEMMAP999
BSW172 MEMMAP999
Requirement Satisfied by
Not applicable
[BSW00344] Reference to link-time configuration (Memory Mapping is specific per build
scenario)
Not applicable
[BSW00404] Reference to post build time configuration (Memory Mapping is specific per build
scenario)
Not applicable
[BSW00405] Reference to multiple configuration sets (Memory Mapping is specific per build
scenario)
Not applicable
[BSW00345] Pre-compile-time configuration (Memory Mapping is specific per build
scenario)
Not applicable
[BSW159] Tool-based configuration (Memory Mapping is specific per build
scenario)
Not applicable
[BSW167] Static configuration checking (Memory Mapping is specific per build
scenario)
Not applicable
[BSW171] Configurability of optional functionality (Memory Mapping is specific per build
scenario)
Not applicable
[BSW170] Data for reconfiguration of AUTOSAR SW-
(Memory Mapping is specific per build
Components
scenario)
Not applicable
[BSW00380] Separate C-Files for configuration
(Memory Mapping is specific per build
parameters
scenario)
Requirement Satisfied by
Not applicable
[BSW00419] Separate C-Files for pre-compile time
(Memory Mapping is specific per build
configuration parameters
scenario)
Not applicable
[BSW00381] Separate configuration header file for pre-
(Memory Mapping is specific per build
compile time parameters
scenario)
Not applicable
[BSW00412] Separate H-File for configuration
(Memory Mapping is specific per build
parameters
scenario)
Not applicable
[BSW00383] List dependencies of configuration files (Memory Mapping is specific per build
scenario)
[BSW00384] List dependencies to other modules MEMMAP020
Not applicable
[BSW00387] Specify the configuration class of callback
(Memory Mapping is specific per build
function
scenario)
Not applicable
[BSW00388] Introduce containers (Memory Mapping is specific per build
scenario)
Not applicable
[BSW00389] Containers shall have names (Memory Mapping is specific per build
scenario)
Not applicable
[BSW00390] Parameter content shall be unique within
(Memory Mapping is specific per build
the module
scenario)
Not applicable
[BSW00391] Parameter shall have unique names (Memory Mapping is specific per build
scenario)
Not applicable
[BSW00392] Parameters shall have a type (Memory Mapping is specific per build
scenario)
Not applicable
[BSW00393] Parameters shall have a range (Memory Mapping is specific per build
scenario)
Not applicable
[BSW00394] Specify the scope of the parameters (Memory Mapping is specific per build
scenario)
Not applicable
[BSW00395] List the required parameters (per
(Memory Mapping is specific per build
parameter)
scenario)
Not applicable
[BSW00396] Configuration classes (Memory Mapping is specific per build
scenario)
Not applicable
[BSW00397] Pre-compile-time parameters (Memory Mapping is specific per build
scenario)
Not applicable
[BSW00398] Link-time parameters (Memory Mapping is specific per build
scenario)
Not applicable
[BSW00399] Loadable Post-build time parameters (Memory Mapping is specific per build
scenario)
Not applicable
[BSW00400] Selectable Post-build time parameters (Memory Mapping is specific per build
scenario)
[BSW00402] Published information MEMMAP019
Not applicable
[BSW00375] Notification of wake-up reason
(Memory Mapping is not a BSW module)
18 of 63 Document ID 128: AUTOSAR_SWS_MemoryMapping
- AUTOSAR confidential -
Specification of Memory Mapping
V1.4.0
R4.0 Rev 3
Requirement Satisfied by
Not applicable
[BSW101] Initialization interface
(Memory Mapping is not a BSW module)
Not applicable
[BSW00416] Sequence of Initialization
(Memory Mapping is not a BSW module)
Not applicable
[BSW00406] Check module initialization
(Memory Mapping is not a BSW module)
Not applicable
[BSW168] Diagnostic Interface of SW components
(Memory Mapping is not a BSW module)
Not applicable
[BSW00407] Function to read out published parameters
(Memory Mapping is not a BSW module)
[BSW00423] Usage of SW-C template to describe BSW Not applicable
modules with AUTOSAR Interfaces (Memory Mapping is not a BSW module)
[BSW00424] BSW main processing function task Not applicable
allocation (Memory Mapping is not a BSW module)
Not applicable
[BSW00425] Trigger conditions for schedulable objects
(Memory Mapping is not a BSW module)
Not applicable
[BSW00426] Exclusive areas in BSW modules
(Memory Mapping is not a BSW module)
Not applicable
[BSW00427] ISR description for BSW modules
(Memory Mapping is not a BSW module)
[BSW00428] Execution order dependencies of main Not applicable
processing functions (Memory Mapping is not a BSW module)
Not applicable
[BSW00429] Restricted BSW OS functionality access
(Memory Mapping is not a BSW module)
[BSW00431] The BSW Scheduler module implements Not applicable
task bodies (Memory Mapping is not a BSW module)
[BSW00432] Modules should have separate main
Not applicable
processing functions for read/receive and write/transmit
(Memory Mapping is not a BSW module)
data path
Not applicable
[BSW00433] Calling of main processing functions
(Memory Mapping is not a BSW module)
[BSW00434] The Schedule Module shall provide an API Not applicable
for exclusive areas (Memory Mapping is not a BSW module)
Not applicable
[BSW00336] Shutdown interface
(Memory Mapping is not a BSW module)
Not applicable
[BSW00337] Classification of errors
(Memory Mapping is not a BSW module)
[BSW00338] Detection and Reporting of development Not applicable
errors (Memory Mapping is not a BSW module)
[BSW00369] Do not return development error codes via Not applicable
API (Memory Mapping is not a BSW module)
[BSW00339] Reporting of production relevant error Not applicable
status (Memory Mapping is not a BSW module)
[BSW00421] Reporting of production relevant error Not applicable
events (Memory Mapping is not a BSW module)
[BSW00422] Debouncing of production relevant error Not applicable
status (Memory Mapping is not a BSW module)
[BSW00420] Production relevant error event rate Not applicable
detection (Memory Mapping is not a BSW module)
[BSW00417] Reporting of Error Events by Non-Basic Not applicable,
Software (Memory Mapping does not report errors)
Not applicable
[BSW00323] API parameter checking
(Memory Mapping is not a BSW module)
Not applicable
[BSW004] Version check
(Memory Mapping is not a BSW module)
Not applicable
[BSW00409] Header files for production code error IDs
(Memory Mapping is not a BSW module)
Requirement Satisfied by
Not applicable
[BSW00385] List possible error notifications
(Memory Mapping is not a BSW module)
Not applicable
[BSW00386] Configuration for detecting an error
(Memory Mapping is not a BSW module)
Not applicable
[BSW161] Microcontroller abstraction
(non-functional requirement)
Not applicable
[BSW162] ECU layout abstraction
(non-functional requirement)
Not applicable
[BSW00324] Do not use HIS I/O Library
(non-functional requirement)
[BSW005] No hard coded horizontal interfaces within Not applicable
MCAL (non-functional requirement)
Not applicable
[BSW00415] User dependent include files
(non-functional requirement)
Not applicable
[BSW164] Implementation of interrupt service routines
(non-functional requirement)
Not applicable
[BSW00325] Runtime of interrupt service routines
(Memory Mapping is not a BSW module)
Not applicable
[BSW00326] Transition from ISRs to OS tasks
(Memory Mapping is not a BSW module)
Not applicable
[BSW00342] Usage of source code and object code
(non-functional requirement)
Not applicable
[BSW00343] Specification and configuration of time
(Memory Mapping is not a BSW module)
Not applicable
[BSW160] Human-readable configuration data
(Memory Mapping is not a BSW module)
Not applicable,
[BSW007] HIS MISRA C (Memory Mapping is the C-language
extension header)
Not applicable
[BSW00300] Module naming convention
(Memory Mapping is not a BSW module)
Not applicable
[BSW00413] Accessing instances of BSW modules
(Memory Mapping is not a BSW module)
[BSW00347] Naming separation of different instances Not applicable
of BSW drivers (Memory Mapping is not a BSW module)
Not applicable
[BSW00305] Self-defined data types naming convention
(Memory Mapping is not a BSW module)
Not applicable
[BSW00307] Global variables naming convention
(Memory Mapping is not a BSW module)
Not applicable
[BSW00310] API naming convention
(Memory Mapping is not a BSW module)
[BSW00373] Main processing function naming Not applicable
convention (Memory Mapping is not a BSW module)
Not applicable
[BSW00327] Error values naming convention
(Memory Mapping is not a BSW module)
Not applicable
[BSW00335] Status values naming convention
(Memory Mapping is not a BSW module)
Not applicable
[BSW00350] Development error detection keyword
(Memory Mapping is not a BSW module)
[BSW00408] Configuration parameter naming Not applicable
convention (Memory Mapping is not a BSW module)
[BSW00410] Compiler switches shall have defined Not applicable
values (Memory Mapping is not a BSW module)
Not applicable
[BSW00411] Get version info keyword
(Memory Mapping is not a BSW module)
Not applicable
[BSW00346] Basic set of module files
(Memory Mapping is not a BSW module)
Requirement Satisfied by
[BSW158] Separation of configuration from Not applicable
implementation (Memory Mapping is not a BSW module)
[BSW00314] Separation of interrupt frames and service Not applicable
routines (Memory Mapping is not a BSW module)
Not applicable
[BSW00370] Separation of callback interface from API
(Memory Mapping is not a BSW module)
Not applicable
BSW00348] Standard type header
(Memory Mapping is not a BSW module)
Not applicable
[BSW00353] Platform specific type header (Memory Mapping is a C-language
extension header)
[BSW00361] Compiler specific language extension
MEMMAP002
header
Not applicable
[BSW00301] Limit imported information
(Memory Mapping is not a BSW module)
Not applicable
[BSW00302] Limit exported information
(Memory Mapping is not a BSW module)
supported by:
[BSW00328] Avoid duplication of code
MEMMAP001, MEMMAP005
Not applicable
[BSW00312] Shared code shall be reentrant
(Memory Mapping is not a BSW module)
supported by:
MEMMAP010, MEMMAP004,
[BSW006] Platform independency MEMMAP003, MEMMAP005,
MEMMAP006, MEMMAP007,
MEMMAP011, MEMMAP013
Not applicable
[BSW00357] Standard API return type
(Memory Mapping is not a BSW module)
Not applicable
[BSW00377] Module specific API return types
(Memory Mapping is not a BSW module)
Not applicable
[BSW00304] AUTOSAR integer data types
(Memory Mapping is not a BSW module)
[BSW00355] Do not redefine AUTOSAR integer data Not applicable
types (Memory Mapping is not a BSW module)
Not applicable
[BSW00378] AUTOSAR boolean type
(Memory Mapping is not a BSW module)
supported by:
MEMMAP010, MEMMAP004,
[BSW00306] Avoid direct use of compiler and platform
MEMMAP003, MEMMAP005,
specific keywords
MEMMAP006, MEMMAP007,
MEMMAP011, MEMMAP013
Not applicable
[BSW00308] Definition of global data
(Memory Mapping is not a BSW module)
Not applicable
[BSW00309] Global data with read-only constraint
(Memory Mapping is not a BSW module)
Not applicable
[BSW00371] Do not pass function pointers via API
(Memory Mapping is not a BSW module)
Not applicable
[BSW00358] Return type of init() functions
(Memory Mapping is not a BSW module)
Not applicable
[BSW00414] Parameter of init function
(Memory Mapping is not a BSW module)
Not applicable
[BSW00414] Parameter of init function
(Memory Mapping is not a BSW module)
Not applicable
[BSW00359] Return type of callback functions
(Memory Mapping is not a BSW module)
Not applicable
[BSW00360] Parameters of callback functions
(Memory Mapping is not a BSW module)
[BSW00329] Avoidance of generic interfaces Not applicable
21 of 63 Document ID 128: AUTOSAR_SWS_MemoryMapping
- AUTOSAR confidential -
Specification of Memory Mapping
V1.4.0
R4.0 Rev 3
Requirement Satisfied by
(Memory Mapping is not a BSW module)
[BSW00330] Usage of macros / inline functions instead Not applicable
of functions (Memory Mapping is not a BSW module)
Not applicable
[BSW00331] Separation of error and status values
(Memory Mapping is not a BSW module)
Not applicable
[BSW009] Module User Documentation
(Memory Mapping is not a BSW module)
[BSW00401] Documentation of multiple instances of Not applicable
configuration parameters (Memory Mapping is not a BSW module)
[BSW172] Compatibility and documentation of Not applicable
scheduling strategy (Memory Mapping is not a BSW module)
Not applicable
[BSW010] Memory resource documentation
(Memory Mapping is not a BSW module)
[BSW00333] Documentation of callback function Not applicable
context (Memory Mapping is not a BSW module)
[BSW00374] Module vendor identification MEMMAP019
[BSW00379] Module identification MEMMAP019
[BSW003] Version identification MEMMAP019
[BSW00318] Format of module version numbers MEMMAP019
[BSW00321] Enumeration of module version numbers MEMMAP019
[BSW00341] Microcontroller compatibility Not applicable
documentation (Memory Mapping is not a BSW module)
[BSW00334] Provision of XML file Not applicable
(Memory Mapping is not a BSW module)
7 Analysis
This chapter does not contain requirements. It just gives an overview to used
keywords and their syntax within different compilers. This analysis is required for a
correct and complete specification of methods and keywords.
#pragma default_attributes
#pragma clear
#pragma clear
#pragma for_extern_data_use_memory
#pragma for_initialized_data_use_memory
#pragma for_uninitialized_data_use_memory
GreenHills, V850 #pragma align (n)
#pragma alignvar (n)
#pragma ghs section sect=”name”
#pragma ghs section sect =default
Section Keyword: data, sdata, tdata, zdata, bss,
sbss, zbss
ADS, ST30 #pragma arm section [sort_type[[=]"name"]]
[,sort_type="name"]*
sort_type="rwdata, zidata
alignment control via key words:
__packed, __align()
DIABDATA, MPC5554 #pragma section class_name [init_name]
[uninit_name] [address_mode] [access]
#pragma section class_name
Pragma shall be used before declaration.
sort_type="code"
DIABDATA, MPC5554 #pragma section class_name [init_name]
[uninit_name] [address_mode] [access]
#pragma section class_name
Pragma shall be used before declaration.
8 Functional specification
[MEMMAP001] ⌈For each build scenario (e.g. Boot loader, ECU Application) an own
set of memory mapping files has to be provided.⌋(BSW00328)
[MEMMAP002] ⌈The memory mapping file name shall be ‘MemMap.h’ for basic
software modules and “<SWC>_MemMap.h” for software components where
<SWC> is the name of the software component type.⌋(BSW00361)
For instance:
#ifdef EEP_START_SEC_VAR_CLEARED_16
#undef EEP_START_SEC_VAR_CLEARED_16
#endif
In [7] further information is provided how Memory Mapping is used in the AUTOSAR
Methodology.
Recommendation A:
Each AUTOSAR basic software module and software component shall support the
configuration of at least the following different memory types as described in Tabelle
8-1 and Tabelle 8-2.
It is allowed to add module specific sections as they are mapped and thus are
configurable within the module’s configuration file.
16, used for variables and constants which have to be aligned to 16 bit. For instance
used for variables and constants of size 16 bit or used for composite data types:
arrays, structs and unions containing elements of maximum 16 bits
32, used for variables and constants which have to be aligned to 32 bit. For instance
used for variables and constants of size 32 bit or used for composite data types:
arrays, structs and unions containing elements of maximum 32 bits.
UNSPECIFIED, used for variables, constants, structure, array and unions when SIZE
(alignment) does not fit the criteria of 8,16 or 32 bit.
For instance used for variables and constants of unknown size
In case structures and unions, it shall be allowed to use an alignment larger than the
bit size of the elements. For instance to facilitate copy instruction a structure may
have minimum 2 byte alignment, even if members are byte aligned. In this case, it
should be possible to use alignment 16 bit instead of 8 bit for this structure.
Please note that the values 8BIT, 16BIT, 32BIT are changed to 8, 16, 32 in order to
reach a harmonization with Meta Model attributes. These values are classified as
deprecated.
• NO_INIT, used for variables that are never cleared and never initialized.
• CLEARED, used for variables that are cleared to zero after every reset.
• POWER_ON_CLEARED, used for variables that are cleared to zero only after
power on reset.
• INIT, used for variables that are initialized with values after every reset.
• POWER_ON_INIT, used for variables that are initialized with values only after
power on reset.
Please note if the Memory Allocation Keywords shall appear in capital letters in the
code the related Memory Sections in the BSWMD or SWC Descriptions have to be
named with capital letters.
1
This section was replaced by the generic definition of <PREFIX>_START_SEC_VAR_<INIT_POLICY>_<ALIGNMENT>.
30 of 63 Document ID 128: AUTOSAR_SWS_MemoryMapping
- AUTOSAR confidential -
Specification of Memory Mapping
V1.4.0
R4.0 Rev 3
2
This section was replaced by the generic definition of
<PREFIX>_START_SEC_VAR_FAST_<INIT_POLICY>_<ALIGNMENT>.
31 of 63 Document ID 128: AUTOSAR_SWS_MemoryMapping
- AUTOSAR confidential -
Specification of Memory Mapping
V1.4.0
R4.0 Rev 3
3
This section was replaced by the generic definition of
<PREFIX>_START_SEC_INTERNAL_VAR_<INIT_POLICY>_<ALIGNMENT>.
32 of 63 Document ID 128: AUTOSAR_SWS_MemoryMapping
- AUTOSAR confidential -
Specification of Memory Mapping
V1.4.0
R4.0 Rev 3
[MEMMAP021] ⌈There are different kinds of execution code sections. This code
sections shall be identified with dedicated keywords. If a section is not supported by
the integrator and micro controller then be aware that the keyword is ignored. The
table below defines the keyword to be used for each code section:
4
This section was replaced by the definition of <PREFIX>_START_SEC_CONST_SAVED_RECOVERY_ZONE<X>.
33 of 63 Document ID 128: AUTOSAR_SWS_MemoryMapping
- AUTOSAR confidential -
Specification of Memory Mapping
V1.4.0
R4.0 Rev 3
Application hint:
For code which is implemented with the LOCAL_INLINE macro of the “Compiler.h”
the wrapping with Memory Allocation Keywords is required. In the case that the
LOCAL_INLINE is set to the inline keyword of the compiler the related Memory
Allocation Keywords shall not define any linker section assignments or change the
addressing behavior because this is already set by the environment of the calling
function where the code is inlined. In the case that the LOCAL_INLINE is set to
empty the related Memory Allocation Keywords shall be configured like for regular
code.
For code which his implemented with the INLINE macro of the “Compiler.h” the
wrapping with Memory Allocation Keywords is required at least for the code which is
remaining if INLINE is set to empty.
Please note as well that in the Basic Software Module Description the
MemorySection related to the used Memory Allocation Keywords has to document
the usage of INLINE and LOCAL_INLINE in the option attribute. For further
information see [4].
The inclusion of the memory mapping header files within the code is a MISRA
violation. As neither executable code nor symbols are included (only pragmas) this
violation is an approved exception without side effects.
The start and stop symbols for section control are configured with section identifiers
defined in the inclusion of memory mapping header file. For details on configuring
sections see “Configuration specification”
#define EEP_START_SEC_VAR_INIT_16
#include “MemMap.h”
static uint16 EepTimer = 100;
static uint16 EepRemainingBytes = 16;
#define EEP_STOP_SEC_VAR_INIT_16
#include “MemMap.h”
Application hint:
An implicit assignment of objects to default sections is not allowed because
properties of default sections are platform and tool dependent and therefore these
implementations are not platform independent.
[MEMMAP023] ⌈Memory mapping header files shall not be included inside the body
of a function.⌋()
The goal of this requirement is to support compiler which do not support #pragma
inside the body of a function. To force a special memory mapping of a function’s
static variable, this variable must be moved to file static
[MEMMAP026] ⌈The BSW memory mapping header file ‘MemMap.h’ shall support
the Memory Allocation Keywords to start and to stop a section for each
MemorySection defined in a BswImplementation which is part of the input
configuration.⌋()
[MEMMAP027] ⌈The software component type specific memory mapping header file
‘<SWC>_MemMap.h’ shall support the Memory Allocation Keywords to start and to
stop a section for each MemorySection defined in a SwcImplementation
associated of this software component type.⌋()
[MEMMAP016] ⌈The selection of a section shall only influence the linker’s behavior
for one of the three different object types code, variables or constants
concurrently.⌋()
Application hint:
On one side the creation of combined sections (for instance code and constants) is
not allowed. For the other side the set-up of the compiler / linker must be done in a
way, that only the settings of the selected section type is changed. For instance the
set-up of the code section shall not influence the configuration of the constant section
and other way around.
For instance:
#ifdef EEP_START_SEC_VAR_INIT_16
#undef EEP_START_SEC_VAR_INIT_16
#define START_SECTION_DATA_INIT_16
#elif
/*
additional mappings of modules sections into project
sections
*/
...
#endif
#ifdef START_SECTION_DATA_INIT_16
#pragma section data "sect_data16"
#undef START_SECTION_DATA_INIT_16
#undef MEMMAP_ERROR
#elif
/*
additional statements for switching the project sections
*/
...
#endif
Application hint:
Those code or variables sections can be used for the allocation of objects from more
than one module.
Those code or variables sections can be used for the allocation of objects from
different module specific code or variable sections of one module.
For instance:
#ifdef EEP_STOP_SEC_CODE
#undef EEP_STOP_SEC_CODE
#define STOP_SECTION_COMMON_CODE
#elif
/*
additional mappings of modules sections into project
sections
*/
...
#endif
#ifdef STOP_SECTION_COMMON_CODE
#pragma section code restore
#undef STOP_SECTION_COMMON_CODE
#undef MEMMAP_ERROR
#elif
/*
additional statements for switching the project sections
*/
#endif
[MEMMAP007] ⌈The memory mapping header files shall check if they have been
included with a valid memory mapping symbol and in a valid sequence (no START
preceded by a START, no STOP without the corresponding START). This shall be
done by a preprocessor check.⌋(BSW006, BSW00306)
For instance:
#define MEMMAP_ERROR
/*
mappings of modules sections into project sections and
statements for switching the project sections
*/
...
#elif STOP_SECTION_COMMON_CODE
#pragma section code restore
#undef STOP_SECTION_COMMON_CODE
#undef MEMMAP_ERROR
#endif
#ifdef MEMMAP_ERROR
#error "MemMap.h, wrong pragma command"
#endif
[MEMMAP011] ⌈The memory mapping header files shall undefine the module or
software component specific Memory Allocation Key Words for starting or stopping a
section.⌋(BSW006, BSW00306)
For instance:
#ifdef EEP_STOP_SEC_CODE
#undef EEP_STOP_SEC_CODE
[MEMMAP013] ⌈The memory mapping header files shall use if-else structures to
reduce the compilation effort.⌋(BSW006, BSW00306)
For instance:
#define MEMMAP_ERROR
...
/* module and ECU specific section mappings */
#if defined START_SECTION_COMMON_CODE
#pragma section ftext
#undef START_SECTION_COMMON_CODE
#undef MEMMAP_ERROR
#elif defined START_SECTION_UNBANKED_CODE
#pragma section code text
#undef START_SECTION_UNBANKED_CODE
#undef MEMMAP_ERROR
#elif defined ...
...
#endif
8.3 Examples
The examples in this section shall illustrate the relationship between the Basic
Software Module Descriptions, Software Component Descriptions, the ECU
configuration of the Memory Mapping and the Memory Mapping header files.
+swAddrmethod +swAddrmethod
+internalBehavior
IB_MySwc : Run1 :
+runnable
SwcInternalBehavior RunnableEntity
symbol = Run1
+behavior
MemMap relevant
According the SWS RTE the Runnable Entity prototype in the Application Header File
of the software component is emitted as:
#define MySwc_START_SEC_CODE
39 of 63 Document ID 128: AUTOSAR_SWS_MemoryMapping
- AUTOSAR confidential -
Specification of Memory Mapping
V1.4.0
R4.0 Rev 3
#include "MySwc_MemMap.h"
#define MySwc_STOP_SEC_CODE
#include "MySwc_MemMap.h"
Please note that the same Memory Allocation Keywords have to be used for the
function definition of “Run1” and all other functions of the Software Component which
shall be located to same MemorySection.
MemMap :EcucModuleDef
lowerMultiplicity = 0
upperMultiplicity = 1
implementationConfigVariant = PreconfiguredConfiguration
MemMap :EcucModuleConfigurationValues
implementationConfigVariant = VariantPreCompile
+container
CODE_INTERNAL :EcucContainerValue
definition = MemMapAddressingModeSet
+value
+subContainer
CODE_INTERNAL :EcucContainerValue
definition = MemMapAddressingMode
+parameterValue
:EcucTextualParamValue
+subContainer
+referenceValue :EcucReferenceValue
A definition = EcucMemoryMappingSwAddrMethodRef
+value
CODE :SwAddrMethod
sectionType = code
With this information of the Memory Allocation Header for the Software Component
can be generated like:
#ifdef MySwc_START_SEC_CODE
#pragma section_code "fls_code"
#pragma ...
#undef MySwc_START_SEC_CODE
#ifdef MySwc_STOP_SEC_CODE
#pragma section_code "illegal"
#undef MySwc_STOP_SEC_CODE
SWC Description
IB_MySwc : FooBar :
+swDataDefProps «atpVariation»
SwcInternalBehavior VariableDataPrototype :SwDataDefProps
+explicitInterRunnableVariable
+swDataDefProps
«atpVariation»
:SwDataDefProps
+baseType
uint8 :BaseType
baseTypeSize = 8
+implicitInterRunnableVariable
+behavior
+swDataDefProps
«atpVariation»
:SwDataDefProps
+baseType
SWC Description
VAR_FAST_INIT :SwAddrMethod
sectionType = var
sectionInitializationPolicy = init
memoryAllocationKeywordPolicy = AddrMethodShortNameAndAlignment
+swAddrmethod
alignment = 8
+internalBehavior VAR_FAST_INIT_16 :
+memorySection
MemorySection
RTE_xyz :
BswInternalBehavior
alignment = 16
+behavior VAR_FAST_INIT_TASK_BUF_8 :
+memorySection
MemorySection
alignment = 8
RTE_xyz : +resourceConsumption
BswImplementation
+memorySection VAR_FAST_INIT_TASK_BUF_16 :
MemorySection
alignment = 16
MemMap :EcucModuleDef
lowerMultiplicity = 0
upperMultiplicity = 1
(from MemMap)
+definition
MemMap :EcucModuleConfigurationValues
implementationConfigVariant = PreconfiguredConfiguration
+container
VAR_NEAR_INIT :EcucContainerValue
definition = MemMapAddressingModeSet
:EcucTextualParamValue
+parameterValue
value = var
definition = MemMapSectionType
:EcucTextualParamValue
+parameterValue
value = init
definition = MemMapSupportedSectionInitializationPolicy
+parameterValue :EcucTextualParamValue
definition = MemMapAddressingMode
:EcucTextualParamValue
+parameterValue
value = #pragma section nearbss "data_near_fast_8" CR LF #pragma section neardata "data_near_fast_8" ....
definition = MemMapAddressingModeStart
:EcucTextualParamValue
+parameterValue
value = #pragma section nearbss "illegal" CR LF #pragma section neardata "illegal" ....
definition = MemMapAddressingModeStop
:EcucTextualParamValue
+parameterValue
value = 8
+subContainer definition = MemMapAlignmentSelector
VAR_INIT_NEAR_16 :EcucContainerValue
definition = MemMapAddressingMode
:EcucTextualParamValue
+parameterValue
value = #pragma section nearbss "data_near_fast_16" CR LF #pragma section neardata "data_near_fast_16" ....
definition = MemMapAddressingModeStart
:EcucTextualParamValue
+parameterValue
value = #pragma section nearbss "illegal" CR LF #pragma section neardata "illegal" ....
definition = MemMapAddressingModeStop
:EcucTextualParamValue
+parameterValue
value = 16
definition = MemMapAlignmentSelector
MemMap :EcucModuleDef
lowerMultiplicity = 0
upperMultiplicity = 1
+container
VAR_FAR_INIT :EcucContainerValue
definition = MemMapAddressingModeSet
+container +container
+value
+container
+referenceValue :EcucReferenceValue
A definition = EcucMemoryMappingSwAddrMethodRef
VAR_FAST_INIT :SwAddrMethod
sectionType = var
sectionInitializationPolicy = init
memoryAllocationKeywordPolicy = AddrMethodShortNameAndAlignment
With this information of the Memory Allocation Header for the BSW can be generated
like:
#ifdef RTE_START_SEC_VAR_FAST_8
46 of 63 Document ID 128: AUTOSAR_SWS_MemoryMapping
- AUTOSAR confidential -
Specification of Memory Mapping
V1.4.0
R4.0 Rev 3
#ifdef RTE_STOP_SEC_VAR_FAST_8
#pragma section_code "illegal"
#undef RTE_STOP_SEC_VAR_FAST_8
#ifdef RTE_START_SEC_VAR_FAST_16
#pragma section nearbss "data_near_fast_16"
#pragma section neardata "data_near_fast_16"
....
#pragma ...
#undef RTE_START_SEC_VAR_FAST_16
#ifdef RTE_STOP_SEC_VAR_FAST_16
#pragma section_code "illegal"
#undef RTE_STOP_SEC_VAR_FAST_16
#ifdef RTE_START_SEC_VAR_FAST_TASK_BUF_8
#pragma section nearbss "data_near_fast_8"
#pragma section neardata "data_near_fast_8"
....
#pragma ...
#undef RTE_START_SEC_VAR_FAST_TASK_BUF_8
#ifdef RTE_STOP_SEC_VAR_FAST_TASK_BUF_8
#pragma section_code "illegal"
#undef RTE_STOP_SEC_VAR_FAST_TASK_BUF_8
#ifdef RTE_START_SEC_VAR_FAST_TASK_BUF_16
#pragma section nearbss "data_near_fast_16"
#pragma section neardata "data_near_fast_16"
....
#pragma ...
#undef RTE_START_SEC_VAR_FAST_TASK_BUF_16
#ifdef RTE_STOP_SEC_VAR_FAST_TASK_BUF_16
#pragma section_code "illegal"
#undef RTE_STOP_SEC_VAR_FAST_TASK_BUF_16
The following Basic Software Module Description would result in the support of the
Memory Allocation Keywords in the MemMap.h file:
+internalBehavior
MEM : +entity
BswInternalBehavior NvM_MainFunction :
BswSchedulableEntity
+executableEntity
+entity
NvM_WriteBlock :
BswCalledEntity
+schedulerNamePrefix +executableEntity
+schedulerNamePrefix
NvM :
+schedulerNamePrefix BswSchedulerNamePrefix
+executableEntity
+schedulerNamePrefix
MemIf :
+schedulerNamePrefix
BswSchedulerNamePrefix
+swAddrMethod
+swAddrMethod
symbol = MemIf +swAddrMethod
+behavior
CODE :SwAddrMethod
sectionType = code
MEM : +swAddrmethod
BswImplementation +swAddrmethod
+resourceConsumption
MEM : CODE_MEMIF :
ResourceConsumption +memorySection NVM_START_SEC_CODE
MemorySection
NVM_STOP_SEC_CODE
symbol = CODE
MEMIF_PART : +prefix
+sectionNamePrefix SectionNamePrefix
symbol = MEMIF
CODE_NVM :
+memorySection MEMIF_START_SEC_CODE
MemorySection
MEMIF_STOP_SEC_CODE
symbol = CODE
+sectionNamePrefix NVM_PART : +prefix
SectionNamePrefix
symbol = NVM
#ifdef NVM_START_SEC_CODE
…
#ifdef NVM_STOP_SEC_CODE
48 of 63 Document ID 128: AUTOSAR_SWS_MemoryMapping
- AUTOSAR confidential -
Specification of Memory Mapping
V1.4.0
R4.0 Rev 3
…
#ifdef MEMIF_START_SEC_CODE
…
#ifdef MEMIF_STOP_SEC_CODE
9 API specification
Not applicable.
10 Sequence diagrams
Not applicable.
11 Configuration specification
In general, this chapter defines configuration parameters and their clustering into
containers. In order to support the specification Chapter 11.1 describes
fundamentals. It also specifies a template (table) you shall use for the parameter
specification. We intend to leave Chapter 11.1 in the specification to guarantee
comprehension.
Chapter 11.2 specifies the structure (containers) and the parameters of the module
Memory Mapping.
The following is only a short survey of the topic and it will not replace the ECU
Configuration Specification document.
11.1.2 Variants
Thus describe the possible configuration variants of this module. Each Variant must
have a unique name which could be referenced to in later chapters. The maximum
number of allowed variants is 3. Each variant shall have its own requirement ID.
11.1.3 Containers
Configuration Parameters
Name <Identifies the parameter by name. The naming convention shall follow
BSW00408.>
Description <Explains the intention of the configuration parameter.>
Type <Specify the type of the parameter (e.g., uint8..uint32) if possible or
mark it “--“>
Unit <Specify the unit of the parameter (e.g., ms) if possible or mark it “--“ >
Range <Specify the range (or <Describe the value(s) or ranges.>
possible values) of the
parameter (e.g., 1..15,
ON,OFF) if possible or
mark it “--“>
5
Configuration Class Pre-compile see <Refer here to (a) variant(s).>
6
Link time see <Refer here to (a) variant(s).>
7
Post Build see <Refer here to (a) variant(s).>
Scope <Describe the scope of the parameter if known or mark it as “- -“.
The scope describes the impact of the configuration parameter: Does
the setting affect only one instance of the module (instance), all
instances of this module (module), the ECU or a network.
5
see the explanation below this table - Pre-compile time
6
see the explanation below this table - Link time
7
see the explanation below this table - Post Build
53 of 63 Document ID 128: AUTOSAR_SWS_MemoryMapping
- AUTOSAR confidential -
Specification of Memory Mapping
V1.4.0
R4.0 Rev 3
Included Containers
11.2.1 Variants
11.2.1.1 VARIANT-PRE-COMPILE
MEMMAP024:
Variant 1 – VARIANT-PRE-COMPILE: In this configuration variant all parameters
need to be configured pre compile time.
11.2.2 MemMap
Included Containers
Container Name Multiplicity Scope / Dependency
Defines a set of addressing modes which might apply to a
MemMapAddressingModeSet 0..*
SwAddrMethod.
Defines a set of addressing modes which might apply to a
MemMapAllocation 0..*
SwAddrMethod.
11.2.3 MemMapAddressingModeSet
minLength --
regularExpression [a-zA-Z]([a-zA-Z0-9]|_[a-zA-Z0-9])*_?
ConfigurationClass Pre-compile time X All Variants
Link time --
Post-build time --
Scope / Dependency scope: ECU
Included Containers
Container Name Multiplicity Scope / Dependency
Defines a addressing mode with a set of #pragma
MemMapAddressingMode 1..* statements implementing the start and the stop of a
section.
11.2.4 MemMapAddressingMode
Default value --
maxLength --
minLength --
regularExpression --
ConfigurationClass Pre-compile time X All Variants
Link time --
Post-build time --
Scope / Dependency scope: ECU
No Included Containers
11.2.5 MemMapAllocation
Included Containers
Container Name Multiplicity Scope / Dependency
Defines which SwAddrMethod is implemented with which
MemMapAddressingModeSet. The pragmas for the
implementation of the MemorySelectorKeywords are taken
from the MemMapAddressingModeStart and
MemMapAddressingModeStop parameters of the
MemMapAddressingModeSet for the individual alignments.
MemMapGenericMapping 0..*
That this mapping becomes valid requires matching
MemMapSupportedSectionType's,
MemMapSupportedSectionInitializationPolicy's and
MemMapSupportedAddressingMethodOption's. The
MemMapGenericMapping applies only if it is not overruled
by an MemMapSectionSpecificMapping
Defines which MemorySection of a BSW Module or a
Software Component is implemented with which
MemMapAddressingModeSet. The pragmas for the
implementation of the MemorySelectorKeywords are taken
MemMapSectionSpecificMappin
0..* from the MemMapAddressingModeStart and
g
MemMapAddressingModeStop parameters of the
MemMapAddressingModeSet for the specific alignment of
the MemorySection. The MemMapSectionSpecificMapping
precedes a mapping defined by MemMapGenericMapping.
11.2.6 MemMapGenericMapping
No Included Containers
11.2.7 MemMapSectionSpecificMapping
No Included Containers
Label Description
X The configuration parameter shall be of configuration class Pre-compile time.
-- The configuration parameter shall never be of configuration class Pre-compile time.
Label Description
X The configuration parameter shall be of configuration class Link time.
-- The configuration parameter shall never be of configuration class Link time.
Label Description
The configuration parameter shall be of configuration class Post Build and no specific
X
implementation is required.
Loadable - the configuration parameter shall be of configuration class Post Build and only
L
one configuration parameter set resides in the ECU.
Multiple - the configuration parameter shall be of configuration class Post Build and is
M selected out of a set of multiple parameters by passing a dedicated pointer to the init
function of the module.
-- The configuration parameter shall never be of configuration class Post Build.