Autosar Sws Platformtypes
Autosar Sws Platformtypes
Disclaimer
This work (specification and/or software implementation) 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
work.
The material contained in this work is protected by copyright and other types of
intellectual property rights. The commercial exploitation of the material contained in
this work requires a license to such intellectual property rights.
This work 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
work may be utilized or reproduced, in any form or by any means, without permission
in writing from the publisher.
The work has been developed for automotive applications only. It has neither been
developed, nor tested for non-automotive applications.
The word AUTOSAR and the AUTOSAR logo are registered trademarks.
Table of Contents
1 Introduction and functional overview ................................................................... 7
2 Acronyms and abbreviations ............................................................................... 8
3 Related documentation........................................................................................ 9
3.1 Input documents ........................................................................................... 9
3.2 Related standards and norms ...................................................................... 9
3.3 Related specification .................................................................................. 10
4 Constraints and assumptions ............................................................................ 11
4.1 Limitations .................................................................................................. 11
4.2 Applicability to car domains ........................................................................ 11
4.3 Applicability to safety related environments ............................................... 11
5 Dependencies to other modules ........................................................................ 12
5.1 File structure .............................................................................................. 12
5.1.1 Code file structure ............................................................................... 12
5.1.2 Header file structure ............................................................................ 12
6 Requirements traceability .................................................................................. 13
7 Functional specification ..................................................................................... 14
7.1 General issues ........................................................................................... 14
7.2 CPU Type ................................................................................................... 14
7.3 Endianess .................................................................................................. 14
7.3.1 Bit Ordering (Register) ........................................................................ 14
7.3.2 Byte Ordering (Memory) ...................................................................... 15
7.4 Optimized integer data types ...................................................................... 17
7.5 Boolean data type ...................................................................................... 17
8 API specification ................................................................................................ 18
8.1 Imported types............................................................................................ 18
8.2 Type definitions .......................................................................................... 18
8.2.1 boolean ............................................................................................... 18
8.2.2 uint8 .................................................................................................... 19
8.2.3 uint16 .................................................................................................. 19
8.2.4 uint32 .................................................................................................. 19
8.2.5 uint64 .................................................................................................. 20
8.2.6 sint8 .................................................................................................... 20
8.2.7 sint16 .................................................................................................. 20
8.2.8 sint32 .................................................................................................. 21
8.2.9 sint64 .................................................................................................. 21
8.2.10 uint8_least ........................................................................................... 21
8.2.11 uint16_least ......................................................................................... 22
8.2.12 uint32_least ......................................................................................... 22
8.2.13 sint8_least ........................................................................................... 22
8.2.14 sint16_least ......................................................................................... 22
8.2.15 sint32_least ......................................................................................... 23
8.2.16 float32 ................................................................................................. 23
8.2.17 float64 ................................................................................................. 23
5 of 36 Document ID 048: AUTOSAR_SWS_PlatformTypes
- AUTOSAR confidential -
Specification of Platform Types
AUTOSAR CP Release 4.4.0
It is required that all platform types files are unique within the AUTOSAR community
to guarantee unique types per platform and to avoid type changes when moving a
software module from platform A to B.
Acronym: Description:
Rollover The following example sequence is called ‘rollover’:
mechanism An unsigned char has the value of 255
It is incremented by 1
The result is 0
SDU Service Data Unit (payload)
Abbreviation: Description:
int Integer
3 Related documentation
[4] Cosmic C Cross Compiler User’s Guide for Motorola MC68HC12, V4.5
Thus, the specification SWS BSW General shall be considered as additional and
required specification for Platform Types.
4.1 Limitations
No limitations.
The optimized AUTOSAR integer data types (*_least) may be used if the correct
usage (see chapter 7.4) is proven by a formal code review or a static analysis by a
validated static analysis tool.
None
6 Requirements traceability
7 Functional specification
7.3 Endianess
The pattern for bit, byte and word ordering in native types, such as integers, is called
endianess.
[SWS_Platform_00043] ⌈For each platform the appropriate bit order on register level
shall be indicated in the platform types header file using the symbol
CPU_BIT_ORDER. ⌋ ( )
Illustrations:
14 of 36 Document ID 048: AUTOSAR_SWS_PlatformTypes
- AUTOSAR confidential -
Specification of Platform Types
AUTOSAR CP Release 4.4.0
Important Note:
The naming convention Bit0, Bit1, etc. and the bit’s significance within a byte, word,
etc. are different topics and shall not be mixed. The counting scheme of bits in
Motorola µC-architecture’s (Big Endian Bit Order) starts with Bit0 indicating the Most
Significant Bit, whereas all other µC using Little Endian Bit Order assign Bit0 to be
the Least Significant Bit!
The MSB in an accumulator is always stored as the left-most bit regardless of the
CPU type. Hence, big and little endianess bit orders imply different bit-naming
conventions.
7.3.2 Byte Ordering (Memory)
Big Endian(HIGH_BYTE_FIRST)
Little Endian(LOW_BYTE_FIRST)
Important Note:
The naming convention Byte0 and Byte1 is not unique and may be different in the
manufacturer’s reference documentation for a particular µC.
Examples of usage:
Loop counters (e.g. maximum loop count = 124 use uint8_least)
Switch case arguments (e.g. maximum number of states = 17 use
uint8_least)
⌋ (SRS_BSW_00378)
8 API specification
8.2.1 boolean
[SWS_Platform_00026] ⌈
Name boolean
Kind Type
Derived
uint
from
This standard AUTOSAR type shall only be used together with the definitions TRUE
Description
and FALSE.
FALSE 0 --
Range
TRUE 1 --
Variation --
8.2.2 uint8
[SWS_Platform_00013] ⌈
Name uint8
Kind Type
Variation --
8.2.3 uint16
[SWS_Platform_00014] ⌈
Name uint16
Kind Type
Variation --
8.2.4 uint32
[SWS_Platform_00015] ⌈
Name uint32
Kind Type
Variation --
⌋ (SRS_BSW_00304)
8.2.5 uint64
[SWS_Platform_00066] ⌈
Name uint64
Kind Type
Variation --
8.2.6 sint8
[SWS_Platform_00016] ⌈
Name sint8
Kind Type
Variation --
8.2.7 sint16
[SWS_Platform_00017] ⌈
Name sint16
Kind Type
Variation --
8.2.8 sint32
[SWS_Platform_00018] ⌈
Name sint32
Kind Type
Variation --
8.2.9 sint64
[SWS_Platform_00067] ⌈
Name: sint64
Type: sint
Range: - -- 0x8000000000000000..0x7FFFFFFFFFFFFFF
9223372036854775808..9223372036854775807
Description: This standard AUTOSAR type shall be 64 bit signed.
Available PlatformTypes.h
via:
⌋ ()
8.2.10 uint8_least
[SWS_Platform_00020] ⌈
Name: uint8_least
Type: uint
Range: At least 0..255 -- 0x00..0xFF
Description: This optimized AUTOSAR type shall be at least 8 bit unsigned.
Available via: PlatformTypes.h
⌋ (SRS_BSW_00304)
8.2.11 uint16_least
[SWS_Platform_00021] ⌈
Name: uint16_least
Type: uint
Range: At least -- 0x0000..0xFFFF
0..65535
Description: This optimized AUTOSAR type shall be at least 16 bit unsigned.
Available via: PlatformTypes.h
⌋ (SRS_BSW_00304)
8.2.12 uint32_least
[SWS_Platform_00022] ⌈
Name: uint32_least
Type: uint
Range: At least -- 0x00000000..0xFFFFFFFF
0..4294967295
Description: This optimized AUTOSAR type shall be at least 32 bit unsigned.
Available via: PlatformTypes.h
⌋ (SRS_BSW_00304)
8.2.13 sint8_least
[SWS_Platform_00023] ⌈
Name: sint8_least
Type: sint
Range: At least - -- 0x80..0x7F
128..+127
Description: This optimized AUTOSAR type shall be at least 8 bit signed.
Available via: PlatformTypes.h
⌋ (SRS_BSW_00304)
8.2.14 sint16_least
[SWS_Platform_00024] ⌈
Name: sint16_least
Type: sint
Range: At least - -- 0x8000..0x7FFF
32768..+32767
Description: This optimized AUTOSAR type shall be at least 16 bit signed.
Available via: PlatformTypes.h
⌋ (SRS_BSW_00304)
8.2.15 sint32_least
[SWS_Platform_00025] ⌈
Name: sint32_least
Type: sint
Range: At least - -- 0x80000000..0x7FFFFFFF
2147483648..+2147483647
Description: This optimized AUTOSAR type shall be at least 32 bit signed.
Available via: PlatformTypes.h
⌋ (SRS_BSW_00304)
8.2.16 float32
[SWS_Platform_00041] ⌈
Name float32
Kind Type
Derived
float
from
This standard AUTOSAR type shall follow the 32-bit binary interchange format
Description according to IEEE 754-2008 with encoding parameters specified in chapter 3.6, table
3.5, column "binary32".
Range -3.4028235e+38..+3.4028235e+38 --
Variation --
Available
PlatformTypes.h
via
⌋ ()
8.2.17 float64
[SWS_Platform_00042] ⌈
Name: float64
Type: double
Range: - -- --
1.7976931348623157e+308..+1.7976931348623157e+308
Description: This standard AUTOSAR type shall follow the 64-bit binary interchange
format according to IEEE 754-2008 with encoding parameters specified
in chapter 3.6, table 3.5, column "binary64".
Available via: PlatformTypes.h
⌋ ()
8.3.1 CPU_TYPE
[SWS_Platform_00064] ⌈
Name: CPU_TYPE
Type: Enumeration
Range: CPU_TYPE_8 -- Indicating a 8 bit processor
CPU_TYPE_16 -- Indicating a 16 bit processor
CPU_TYPE_32 -- Indicating a 32 bit processor
CPU_TYPE_64 -- Indicating a 64 bit processor
Description: This symbol shall be defined as #define having one of the values CPU_TYPE_8,
CPU_TYPE_16, CPU_TYPE_32 or CPU_TYPE_64 according to the platform.
Available via: PlatformTypes.h
⌋ ()
8.3.2 CPU_BIT_ORDER
[SWS_Platform_00038] ⌈
Name: CPU_BIT_ORDER
Type: Enumeration
Range: MSB_FIRST -- The most significant bit is the first bit of the bit sequence.
LSB_FIRST -- The least significant bit is the first bit of the bit sequence.
Description: This symbol shall be defined as #define having one of the values MSB_FIRST or
LSB_FIRST according to the platform.
Available via: PlatformTypes.h
⌋ ()
8.3.3 CPU_BYTE_ORDER
[SWS_Platform_00039] ⌈
Name: CPU_BYTE_ORDER
Type: Enumeration
Range: HIGH_BYTE_FIRST -- Within uint16, the high byte is located before the low byte.
LOW_BYTE_FIRST -- Within uint16, the low byte is located before the high byte.
Description: This symbol shall be defined as #define having one of the values
HIGH_BYTE_FIRST or LOW_BYTE_FIRST according to the platform.
Available via: PlatformTypes.h
⌋ ()
[SWS_Platform_00056] ⌈
Name: TRUE_FALSE
Type: Enumeration
Range: FALSE 0x00 --
TRUE 0x01 --
Description: The symbols TRUE and FALSE shall be defined as follows:
#ifndef TRUE
#define TRUE 1
#endif
#ifndef FALSE
#define FALSE 0
#endif
Available via: PlatformTypes.h
⌋ ()
9 Sequence diagrams
Not applicable.
10 Configuration specification
11 Annex
#define CPU_TYPE_8 8
#define CPU_TYPE_16 16
#define CPU_TYPE_32 32
#define CPU_TYPE_64 64
#define MSB_FIRST 0
#define LSB_FIRST 1
#define HIGH_BYTE_FIRST 0
#define LOW_BYTE_FIRST 1
Symbols:
#define CPU_TYPE CPU_TYPE_16
#define CPU_BIT_ORDER LSB_FIRST
#define CPU_BYTE_ORDER HIGH_BYTE_FIRST
Types:
typedef unsigned char boolean;
Symbols:
#define CPU_TYPE CPU_TYPE_16
#define CPU_BIT_ORDER LSB_FIRST
#define CPU_BYTE_ORDER LOW_BYTE_FIRST
Types:
typedef unsigned char boolean;
Symbols:
#define CPU_TYPE CPU_TYPE_32
#define CPU_BIT_ORDER LSB_FIRST
#define CPU_BYTE_ORDER LOW_BYTE_FIRST
Types:
typedef unsigned char boolean;
Symbols:
#define CPU_TYPE CPU_TYPE_32
#define CPU_BIT_ORDER LSB_FIRST
#define CPU_BYTE_ORDER LOW_BYTE_FIRST
Types:
typedef unsigned char boolean;
Symbols:
#define CPU_TYPE CPU_TYPE_32
#define CPU_BIT_ORDER MSB_FIRST
#define CPU_BYTE_ORDER HIGH_BYTE_FIRST
Types:
typedef unsigned char boolean;
Symbols:
#define CPU_TYPE CPU_TYPE_32
#define CPU_BIT_ORDER LSB_FIRST
#define CPU_BYTE_ORDER LOW_BYTE_FIRST
Types:
typedef unsigned char boolean;
Symbols:
#define CPU_TYPE CPU_TYPE_32
#define CPU_BIT_ORDER LSB_FIRST
#define CPU_BYTE_ORDER HIGH_BYTE_FIRST
Types:
typedef unsigned char boolean;
Symbols:
#define CPU_TYPE CPU_TYPE_16
#define CPU_BIT_ORDER LSB_FIRST
#define CPU_BYTE_ORDER LOW_BYTE_FIRST
Types:
typedef unsigned char boolean;
Symbols:
#define CPU_TYPE CPU_TYPE_32
#define CPU_BIT_ORDER LSB_FIRST
#define CPU_BYTE_ORDER HIGH_BYTE_FIRST
Types:
typedef unsigned char boolean;
Symbols:
#define CPU_TYPE CPU_TYPE_64
#define CPU_BIT_ORDER LSB_FIRST
#define CPU_BYTE_ORDER LOW_BYTE_FIRST
Types:
typedef unsigned char boolean;