AUTOSAR_MCU_Component_UserManuals




ss
AUTOSAR MCAL R4.0.3
User‟s Manual
MCU Driver Component Ver.1.0.5
Embedded User‟s Manual
Target Device:
RH850/P1x
All information contained in these materials, including products and product specifications,
represents information on the product at the time of publication and is subject to change by
Renesas Electronics Corp. without notice. Please review the latest information published by
Renesas Electronics Corp. through various means, including the Renesas Electronics Corp.
website
(http://www.renesas.com). www.renesas.com Rev.0.01 Apr 2015
2
Notice
1.
All information included in this document is current as of the date this document is issued. Such information, however, is subject to
change without any prior notice. Before purchasing or using any Renesas Electronics products listed herein, please confirm the latest
product information with a Renesas Electronics sales office. Also, please pay regular and careful attention to additional and different
information to be disclosed by Renesas Electronics such as that disclosed through our website.
2.
Renesas Electronics does not assume any liability for infringement of patents, copyrights, or other intellectual property rights of third
parties by or arising from the use of Renesas Electronics products or technical information described in this document. No license,
express, implied or otherwise, is granted hereby under any patents, copyrights or other intellectual property rights of Renesas
Electronics or others.
3.
You should not alter, modify, copy, or otherwise misappropriate any Renesas Electronics product, whether in whole or in part.
4.
Descriptions of circuits, software and other related information in this document are provided only to illustrate the operation of
semiconductor products and application examples. You are fully responsible for the incorporation of these circuits, software, and
information in the design of your equipment. Renesas Electronics assumes no responsibility for any losses incurred by you or third
parties arising from the use of these circuits, software, or information.
5.
When exporting the products or technology described in this document, you should comply with the applicable export control laws
and regulations and follow the procedures required by such laws and regulations. You should not use Renesas Electronics products
or the technology described in this document for any purpose relating to military applications or use by the military, including but
not limited to the development of weapons of mass destruction. Renesas Electronics products and technology may not be used for or
incorporated into any products or systems whose manufacture, use, or sale is prohibited under any applicable domestic or foreign
laws or regulations.
6.
Renesas Electronics has used reasonable care in preparing the information included in this document, but Renesas Electronics does
not warrant that such information is error free. Renesas Electronics assumes no liability whatsoever for any damages incurred by
you resulting from errors in or omissions from the information included herein.
7.
Renesas Electronics products are classified according to the following three quality grades: "Standard", "High Quality", and
"Specific". The recommended applications for each Renesas Electronics product depends on the product's quality grade, as indicated
below. You must check the quality grade of each Renesas Electronics product before using it in a particular application. You may
not use any Renesas Electronics product for any application categorized as "Specific" without the prior written consent of Renesas
Electronics. Further, you may not use any Renesas Electronics product for any application for which it is not intended without the
prior written consent of Renesas Electronics. Renesas Electronics shall not be in any way liable for any damages or losses incurred by
you or third parties arising from the use of any Renesas Electronics product for an application categorized as "Specific" or for which
the product is not intended where you have failed to obtain the prior written consent of Renesas Electronics. The quality grade of
each Renesas Electronics product is "Standard" unless otherwise expressly specified in a Renesas Electronics data sheets or data
books, etc.
"Standard":
Computers; office equipment; communications equipment; test and measurement equipment; audio and visual
equipment; home electronic appliances; machine tools; personal electronic equipment; and industrial robots.
"High Quality": Transportation equipment (automobiles, trains, ships, etc.); traffic control systems; anti-disaster systems; anti- crime
systems; safety equipment; and medical equipment not specifically designed for life support.
"Specific":
Aircraft; aerospace equipment; submersible repeaters; nuclear reactor control systems; medical equipment or
systems for life support (e.g. artificial life support devices or systems), surgical implantations, or healthcare
intervention (e.g. excision, etc.), and any other applications or purposes that pose a direct threat to human life.
8.
You should use the Renesas Electronics products described in this document within the range specified by Renesas Electronics,
especially with respect to the maximum rating, operating supply voltage range, movement power voltage range, heat radiation
characteristics, installation and other product characteristics. Renesas Electronics shall have no liability for malfunctions or damages
arising out of the use of Renesas Electronics products beyond such specified ranges.
9.
Although Renesas Electronics endeavors to improve the quality and reliability of its products, semiconductor products have specific
characteristics such as the occurrence of failure at a certain rate and malfunctions under certain use conditions. Further, Renesas
Electronics products are not subject to radiation resistance design. Please be sure to implement safety measures to guard them against
the possibility of physical injury, and injury or damage caused by fire in the event of the failure of a
Renesas Electronics product, such as safety design for hardware and software including but not limited to redundancy, fire control
and malfunction prevention, appropriate treatment for aging degradation or any other appropriate measures. Because the evaluation
of microcomputer software alone is very difficult, please evaluate the safety of the final products or system manufactured by you.
10. Please contact a Renesas Electronics sales office for details as to environmental matters such as the environmental compatibility of
each Renesas Electronics product. Please use Renesas Electronics products in compliance with all applicable laws and regulations
that regulate the inclusion or use of controlled substances, including without limitation, the EURoHS Directive. Renesas Electronics
assumes no liability for damages or losses occurring as a result of your noncompliance with applicable laws and regulations.
11. This document may not be reproduced or duplicated, in any form, in whole or in part, without prior written consent of Renesas
Electronics.
12. Please contact a Renesas Electronics sales office if you have any questions regarding the information contained in this
document or Renesas Electronics products, or if you have any other inquiries.
(Note 1) "Renesas Electronics" as used in this document means Renesas Electronics Corporation and also includes its majority- owned
subsidiaries.
(Note 2) "Renesas Electronics product(s)" means any product developed or manufactured by or for Renesas Electronics.
3
4
Abbreviations and Acronyms Abbreviation / Acronym Description ADC
Analog to Digital Converter
ANSI
American National Standards Institute
API
Application Programming Interface
AUTOSAR
AUTomotive Open System ARchitecture
CAN
Controller Area Network
CVM
Core Voltage Monitor
CLMA
Clock Monitor
DEM/Dem
Diagnostic Event Manager
DET/Det
Development Error Tracer
DIO
Digital Input Output
DMA
Direct Memory Access
ECU
Electronic Control Unit
EEPROM
Electrically Erasable Programmable Read-Only Memory
ECM/Ecm
Error Control Module
GNU
GNU‟s Not Unix
GPT
General Purpose Timer
HW
HardWare
ICU
Input Capture Unit
ID/Id
IDentifier
ISR
Interrupt Service Routine
I/O
Input and Output
KB
Kilo Byte
LIN
Local Interconnect Network
MCAL
Microcontroller Abstraction Layer
MCU/Mcu
MicroController Unit
NA
Not Applicable
NMI
Non Maskable Interrupt
MI
Maskable Interrupt
OS/Os
Operating System
PWM
Pulse Width Modulation
PLL
Phase Locked Loop
RAM/Ram
Random Access Memory
ROM
Read Only Memory
RTE
Run Time Environment
SPI
Serial Peripheral Interface
SW
SoftWare
WDT
WatchDog Timer
5
Definitions Term Represented by Sl. No.
Serial Number
6
Table of Contents Chapter 1 Introduction ..................................................................... 11 1.1. Document Overview ................................................................................................................ 13 Chapter 2 Reference Documents .................................................... 15 Chapter 3 Integration and Build Process ....................................... 17 3.1. MCU Driver Component Makefile ........................................................................................... 17 Chapter 4 Forethoughts ................................................................... 19 4.1. General...................................................................................................................................... 19 4.2. Preconditions ........................................................................................................................... 19 4.3. Data Consistency ..................................................................................................................... 20 4.4. User Mode and Supervisor Mode ........................................................................................... 20 4.5. Deviation List ........................................................................................................................... 21 4.6. RAM Initialization ..................................................................................................................... 22 4.7. Callout API ................................................................................................................................ 22 Chapter 5 Architecture Details ........................................................ 23 Chapter 6 Registers Details ............................................................. 25 Chapter 7 Interaction between the User and MCU Driver Component 33 7.1. Services Provided By MCU Driver Component To User ...................................................... 33 Chapter 8 MCU Driver Component Header And Source File Description 35 Chapter 9 Generation Tool Guide .................................................... 37 Chapter 10 Application Programming Interface .............................. 39 10.1. Imported Types ........................................................................................................................ 39 10.1.1. Standard Types ....................................................................................................... 39 10.1.2. Other Module Types ................................................................................................ 39 10.2. Type Definitions ....................................................................................................................... 39 10.2.1 Mcu_ClockType ....................................................................................................... 39 10.2.2 Mcu_RawResetType ............................................................................................... 39 10.2.3 Mcu_RamSectionType ............................................................................................ 39 10.2.4 Mcu_PllStatusTypes ................................................................................................ 40 10.2.5 Mcu_RamStateType ................................................................................................ 40 10.2.6 Mcu_ResetType ...................................................................................................... 40 10.2.7 Mcu_ClmaIndexType .............................................................................................. 41 7
10.3. Function Definitions ................................................................................................................ 42 Chapter 11 Development And Production Errors ............................ 43 11.1. MCU Driver Component Development Errors ....................................................................... 43 11.2. MCU Driver Component Production Errors .......................................................................... 44 Chapter 12 Memory Organization ..................................................... 45 Chapter 13 P1M Specific Information ............................................... 47 13.1. Interaction between the User and MCU Driver Component ................................................. 47 13.1.1. Translation Header File ........................................................................................... 47 13.1.2. ISR Function ............................................................................................................ 47 13.1.3. Parameter Definition File ......................................................................................... 48 13.2. Sample Application ................................................................................................................. 48 13.2.1 Sample Application Structure .................................................................................. 48 13.2.2 Building Sample Application .................................................................................... 50 13.2.2.1. Configuration Example ............................................................................ 50 13.2.2.2. Debugging the Sample Application ......................................................... 51 13.3. Memory and Throughput ........................................................................................................ 51 13.3.1. ROM/RAM Usage .................................................................................................... 51 13.3.2. Stack Depth ............................................................................................................. 53 13.3.3. Throughput Details .................................................................................................. 53 Chapter 14 Release Details .............................................................. 557 8
List of Figures Figure 1-1 System Overview Of AUTOSAR Architecture .......................................................... 11 Figure 1-2 System Overview Of The MCU Driver In AUTOSAR MCAL Layer .......................... 12 Figure 5-1 MCU Driver Architecture ........................................................................................... 23 Figure 12-1 MCU Driver Component Memory Organization ........................................................ 45 Figure 13-1 Overview of MCU Driver Sample Application ........................................................... 48 List of Tables
Table 4-1 Supervisor mode and User mode details .................................................................. 21 Table 4-2 MCU Driver Deviation List ......................................................................................... 21 Table 6-1 Register Details ......................................................................................................... 25 Table 8-1 Description of the MCU Driver Component Files ...................................................... 35 Table 10-1 API Provided by MCU Driver Component ................................................................. 42 Table 11-1 DET Errors of MCU Driver Component..................................................................... 43 Table 11-2 DEM Errors of MCU Driver Component .................................................................... 44 Table 13-1 ISR For MCU ............................................................................................................. 48 Table 13-2 PDF information for P1M .......................................................................................... 48 Table 13-3 ROM/RAM Details without DET ................................................................................ 52 Table 13-4 ROM/RAM Details with DET ..................................................................................... 52 Table 13-5 Throughput Details of the APIs ................................................................................. 53 9
10
Introduction Chapter 1 Chapter 1 Introduction The purpose of this document is to describe the information related to
MCU Driver Component for Renesas P1x microcontrollers.
This document shall be used as reference by the users of MCU Driver
Component. The system overview of complete AUTOSAR architecture
is shown in the below Figure:
Application Layer
AUTOSAR RTE
System Services
On board Device Abstraction
MCU Driver Microcontroller
Figure 1-1 System Overview Of AUTOSAR Architecture
The MCU Driver is part of the Microcontroller Abstraction Layer (MCAL),
the lowest layer of Basic Software in the AUTOSAR environment.
11































Chapter 1 Introduction The Figure in the following page depicts the MCU Driver as part of layered
AUTOSAR MCAL Layer:
Microcontroller Drivers
Memory Drivers
Communication Drivers I/O Drivers
in
e
in
te
x
t
r
te
e
n
S
W
r
r
a
P
n
F
n
l
a
GP
MC
a
a
EEP
H
CA
LI
le
tc
C
RA
l
l
a
N
x
h
o
F
F
n
N Dr
R
T
U
d
l
re
M
la
a
d
D
I
P
RO
a
CU
A
D
o
D
D
P
g
s
s
le
W
r
y
DC
r
T
I
OR
r
T
h
h
i
r
v
i
i
O
v
D
iv
e
e
D
M
Dr
er
v
D
M
Dr
Dr
e
e
r
e
st
r
s
r
i
r
i
D
v
Dr
Dr
T
r
i
v
r
i
i
D
v
i
v
v
er
v
r
er
D
er
i
i
er
er
r
e
iv
i
v
v
v
r
e
e
e
r
ive
e
r
r
r
r
r
M
E
&
G
WDT
C Po
U
Cl
Micro- xt
F
E
l
E
L
PW
.
a
M
P
S
SCI
I
CA
IC
DIO
PT
n
B
i
o
s
R
N
C
PI
t
c
w
Controller u
h
O
N
U
M
D
s
k
or
A
er
Figure 1-2 System Overview Of The MCU Driver In AUTOSAR MCAL Layer The RTE provides the encapsulation of Hardware channels and basic
services to the Application Software Components. So it is possible to map the
Application Software-Components between different ECUs.
The Basic Software Modules are located below the RTE. The Basic Software
itself is divided into the subgroups: System Services, Memory,
Communication and I/O Hardware-Abstraction. The Complex Drivers are also
located below the RTE. Among others, the Operating System (OS), the
Watchdog manager and the Diagnostic services are located in the System
Services subgroup. The Memory subgroup contains modules to provide
access to the non-volatile memories, namely Flash and EEPROM. In the I/O
Hardware-Abstraction subgroup the whole MCU Driver Component is
provided.
On board Device Abstraction provides an interface to physical values for
AUTOSAR software components. It abstracts the physical origin of signals
(their paths to the hardware ports) and normalizes the signals with respect to
their physical appearance. The Microcontroller driver provides services for
basic microcontroller initialization, power down functionality, reset and
microcontroller specific functions required from the upper layers.
12
Introduction Chapter 1 1.1. Document Overview The document has been segmented for easy reference. The table below
provides user with an overview of the contents of each section:
Section Contents Section1 (Introduction)
This section provides an introduction and overview of MCU Driver
Component.
Section 2 (Reference Documents) This section lists the documents referred for developing this document.
Section 3 (Integration And Build
This section explains the folder structure, Makefile structure for MCU
Process)
Driver Component. This section also explains about the Makefile
descriptions, Integration of MCU Driver Component with other
components, building the MCU Driver Component along with a sample
application.
Section 4 (Forethoughts)
This section provides brief information about the MCU Driver
Component, the preconditions that should be known to the user before
it is used, data consistency details and deviation list.
Section 5 (Architecture Details)
This section describes the layered architectural details of the MCU Driver
Component.
Section 6 (Registers Details)
This section describes the register details of MCU Driver Component.
Section 7 (Interaction between
This section describes interaction of the MCU Driver Component with
The User And MCU Driver
the upper layers.
Component)
Section 8 (MCU Driver
This section provides information about the MCU Driver Component
Component Header And Source
source files is mentioned. This section also contains the brief note on
File Description)
the tool generated output file.
Section 9 (Generation Tool Guide) This section provides information on the MCU Driver Component Code
Generation Tool.
Section 10 (Application
This section explains all the APIs provided by the MCU Driver
Programming Interface)
Component.
Section 11 (Development And
This section lists the DET and DEM errors.
Production Errors)
Section 12 (Memory
This section provides the typical memory organization, which must be
Organization)
met for proper functioning of component.
Section 13 (P1M Specific
This section provides P1M specific information also the information
Information)
about linker compiler and sample application.
Section 14 (Release Details)
This section provides release details with version name and base
version.
13
Chapter 1 Introduction 14
Reference Documents Chapter 2 Chapter 2 Reference Documents Sl. No. Title Version 1.
AUTOSAR_SWS_MCUDriver.pdf
3.2.0
2.
r01uh0436ej0070_rh850p1x.pdf
0.70
3.
AUTOSAR_SWS_MemoryMapping.pdf
1.4.0
4.
AUTOSAR_SWS_PlatformTypes.pdf
2.5.0
5.
AUTOSAR_BSW_MakefileInterface.pdf
0.3
6.
AUTOSAR_SWS_CompilerAbstraction.pdf
3.2.0
7.
AUTOSAR BUGZILLA (http://www.autosar.org/bugzilla) -
Note: AUTOSAR BUGZILLA is a database, which contains concerns
raised against information present in AUTOSAR Specifications.
15
Chapter 2 Reference Documents 16
Integration And Build Process Chapter 3 Chapter 3 Integration and Build Process In this section the folder structure of the MCU Driver Component is explained.
Description of the Make files along with samples is provided in this section.
Remark The details about the C Source and Header files that are generated by the
MCU Driver Generation Tool are mentioned in the Generation Tool User‟s
Manual “AUTOSAR_MCU_Tool_UserManual.pdf”.
3.1. MCU Driver Component Makefile The Makefile provided with the MCU Driver Component consists of the GNU
Make compatible script to build the MCU Driver Component in case of any
change in the configuration. This can be used in the upper level Makefile (of
the application) to link and build the final application executable.
3.1.1. Folder Structure The files are organized in the following folders:
Remark Trailing slash „\‟ at the end indicates a folder
X1X\P1x\modules\mcu\src
\Mcu.c
\Mcu_Irq.c
\Mcu_Ram.c
\Mcu_Version.c
X1X\P1x\modules\mcu\include
\Mcu.h
\Mcu_Debug.h
\Mcu_Irq.h
\Mcu_PBTypes.h
\Mcu_Ram.h
\Mcu_Types.h
\Mcu_Version.h
X1X\P1x\modules\mcu\sample_application\<SubVariant>\make\<compiler>
\App_MCU_P1M_Sample.mak
X1X\P1x\modules\mcu\sample_application\<SubVariant>\obj\<Complier>
X1X\P1x\modules\mcu\generator
\Mcu_P1x.exe
\R403_MCU_P1x_BSWMDT.arxml
X1X\P1x\common_family\generator
\Global_Application_P1x.trxml
\Sample_Application_P1x.trxml
\P1x_translation.h
17
Chapter 3 Integration And Build Process \Test_Application_P1x.trxml
X1X\P1x\modules\mcu\user_manual
(User manuals will be available in this folder)
Note: 1. <Complier> can be ghs.
2. <AUTOSAR_version> should be 4.0.3.
3. <SubVariant> can be P1M.
18
Forethoughts Chapter 4 Chapter 4 Forethoughts 4.1. General Following information will aid the user to use the MCU Driver Component
software efficiently:
• The MCU Driver does not enable or disable the ECU or Microcontroller
power supply. The upper layer should handle this operation.
• The start-up code is ECU and MCU specific. MCU Driver does
not implement the start-up code.
• MCU specific initializations such as reset registers, one time writable
registers, interrupt stack pointer, user stack pointer and MCU internal
watchdog, MCU specific features of internal memory and registers are not
implemented by MCU Driver. These initializations should be implemented
by the start-up code.
• MCU Driver does not implement any call-back notification functions.
• MCU Driver does not implement scheduled functions.
• The MCU Driver component is implemented as a Post build variant.
• MCU Driver depends on Scheduler and Wake-up source service Modules
for disabling all relevant interrupts to protect writing into the protected
registers and invoking the ECU state manager functions.
• In P1x PLL clocks are not configurable and it cannot be controlled by
software. It works with default values after main oscillator activated.
Hence in P1x Mcu dirver code Mcu_DistributePllClock()and
Mcu_GetPllStatus()API's none of the action are taken care except DET
errors.
• The file Interrupt_VectorTable.c provided is just a Demo and not all
interrupts will be mapped in this file. So the user has to update the
Interrupt_VectorTable.c as per his configuration
4.2. Preconditions Following preconditions have to be adhered by the user, for proper
functioning of the MCU Driver Component:
•
The Mcu_Cfg.h, Mcu_Cbk.h and Mcu_Reg.h files generated by the MCU
Driver component Code Generation Tool must be compiled and linked
along with MCU Driver component source files.
• The application has to be rebuilt, if there is any change in the Mcu_Cfg.h file
generated by the MCU Driver component Generation Tool.
• File Mcu_PBcfg.c generated for single configuration set or multiple
configuration sets using MCU Driver component Generation Tool can
be compiled and linked independently.
• The authorization of the user for calling the software triggering of a
hardware reset is not checked in the MCU Driver. This is the responsibility
of the upper layer.
• The MCU Driver component needs to be initialized before accepting
any request. The API Mcu_Init should be called by the ECU State
Manager Module to initialize MCU Driver Component.
19
Chapter 4 Forethoughts The user should ensure that MCU Driver component API requests
are invoked in the correct and expected sequence and with correct
input arguments.
• Input parameters are validated only when the static configuration
parameter MCU_DEV_ERROR_DETECT is enabled. Application should
ensure that the right parameters are passed while invoking the APIs when
MCU_DEV_ERROR_DETECT is disabled.
• There are different clock settings possible. For more details, please refer
the respective device specific component user manual.
• If the handle of clock setting passed to the API Mcu_InitClock is not
configured to any one of the supported clock settings, then the
Development Error Detection function is invoked if the static configuration
parameter MCU_DEV_ERROR_DETECT is enabled.
• The MCU Driver initializes the clock generator as per the required
configuration settings and provides the configured clock sources for the
peripherals as applicable. It is the responsibility of the individual drivers to
select and initialize the respective driver specific registers as required for
their functionality with reference to the clock source provided by the MCU
Driver.
• The API Mcu_InitClock is implemented considering its invocation at run
time. Hence, there is a possibility of change in the baud rate set by the
peripheral drivers if the clock setting is different. Hence, the initialization of
the respective drivers after the invocation of Mcu_InitClock, is the
responsibility of the user of MCU Driver services.
• A mismatch in the version numbers of header and the source files results
in compilation error. User should ensure that the correct versions of the
header and the source files are used.
4.3. Data Consistency To support the re-entrance and interrupt services, the MCU Driver will ensure
the data consistency while accessing its own RAM storage or hardware
registers or to prevent any interrupts between the two write instructions of the
write protected register and the corresponding write enable register.
The MCU Driver will use SchM_Enter_Mcu_<Exclusive Area> and
SchM_Exit_Mcu_<Exclusive Area> functions.
The SchM_Enter_Mcu_<Exclusive Area> function is called before the data
needs to be protected and SchM_Exit_Mcu_<Exclusive Area> function is
called after the data is accessed.
The flowchart will indicate the flow with the precompile option
“McuCriticalSectionProtection” enabled.
The following exclusive area along with scheduler services is used to provide
data integrity for shared resources:
REG_DATA_PROTECTION
The functions SchM_Enter_Mcu_<Exclusive Area> and SchM_Exit_Mcu
_<Exclusive Area> can be disabled by disabling the configuration parameter
„McuCriticalSectionProtection‟.
4.4. User Mode and Supervisor Mode The below table specifies the APIs which can run in user mode, supervisor
20
Forethoughts Chapter 4 mode or both modes
Table 4-1 Supervisor mode and User mode details Sl.No. API Name User Mode Supervisor Known limitation in User Mode mode 1.
Mcu_Init
-
x
1. The enabling of the
interrupt will not be
possible.
2. Critical section protection
cannot be enabled
2.
Mcu_InitRamSection
x
x
Critical section protection
cannot be enabled
3.
Mcu_InitClock
x
x
-
4.
Mcu_DistributePllClock
x
x
-
5.
Mcu_GetPllStatus
x
x
-
6.
Mcu_GetResetReason
x
x
-
7.
Mcu_GetResetRawValue
x
x
-
8.
Mcu_PerformReset
x
x
-
9.
Mcu_SetMode
x
x
-
10.
Mcu_GetRamState
x
x
Critical section protection
cannot be enabled
11.
Mcu_LockStepSelfDiagnosticTest
x
x
Critical section protection
cannot be enabled
12.
Mcu_CvmSelfDiagnosticTest
x
x
-
13.
Mcu_ClmaSelfDiagnosticTest
x
x
-
14.
Mcu_EcmSelfDiagnosticTest
x
x
Critical section protection
cannot be enabled
15.
Mcu_SaveResetReason
x
x
Critical section protection
cannot be enabled
4.5. Deviation List Table 4-2 MCU Driver Deviation List Sl. No. Description AUTOSAR Bugzilla / Mantis 1.
The parameter McuResetSetting from the
-
sub-container McuModuleConfiguration is
not considered.
2.
The MCU Driver considers the parameters of
-
RAM section configuration as pre-compile
parameters, since the number of RAM settings
are not known and hence the generation of
handles is not possible at post-build-time.
21
Chapter 4 Forethoughts Sl. No. Description AUTOSAR Bugzilla / Mantis 3.
The sub-container McuClockReferencePoint in
-
the Clock setting configuration is not used as
the reference frequencies specific to various
peripheral devices need to be published by
MCU Driver component.
4.
The parameter McuClockSettingId range in
54536
McuClockSettingConfig container is changed
from “1 to 255” to “0 to 255” since 0 is valid
minimum value for clock setting ID.
5.
If an invalid database is passed as a
-
parameter to API Mcu_Init, DET Error code
MCU_E_INVALID_DATABASE is reported to
DET.
6.
The Mcu_GetVersionInfo
API is
-
implemented as macro without DET error
MCU_E_PARAM_POINTER.
4.6. RAM Initialization RAM initialization done by an API call to Mcu_InitRamSection must not
overwrite other memory sections of static variables. A dedicated memory
section shall be defined in linker directive file.
4.7. Callout API The MCU_RESET_CALLOUT() API is the call out API from the Mcu
module which will be called by Mcu_PerformReset() API for the software
reset when configuration parameter McuSwResetCall Api is true. This
callout API needs to be filled by user to do the software reset. If the
configuration parameter McuSwResetCall Api is false, the callout shall not
be available and the software reset shall be handled by the MCU itself
using HW feature of the SW reset.
22


Architecture Details Chapter 5 Chapter 5 Architecture Details The MCU Driver architecture is shown in the following figure. The MCU user
shall directly use the APIs to configure and execute the MCU conversions:
Application Software (MCU user)
MCU Driver
On-Chip Registers
On-Chip Hardware
Figure 5-1 MCU Driver Architecture The MCU driver accesses the microcontroller hardware directly and is located
in the MCAL. MCU component provides the functionalities related to PLL
Initialization, Clock Initialization and Distribution, RAM sections Initialization,
PreScaler Initialization, MCU reduced Power Modes Activation and MCU
Reset Activation and Reason.
The component consists of the following sub modules based on the
functionality:
• Initialization
• Self-Diagnostic test for ECM, CVM, Clock Monitor and Lock Step.
• Clock Initialization
• RAM sections Initialization and Status Verification
• MCU Reset Activation and Reason
• Version Information
Initialization This sub module provides the structures and APIs for both global and
controller specific initialization. MCU specific initialization is necessary in
order to ensure different startup behaviors of the microcontroller. This sub
23
Chapter 5 Architecture Details module also checks if the data base is flashed.
Self-Diagnostic test for ECM, CVM, Clock Monitor and Lock Step
This functionality is provided as part MCU module initialization.
Self-diagnostic test for ECM error source is helpful to check the ECM error
output signal by creating the real ECM error signal.
Self-diagnostic test for CVM and CLMA is possible in real scenario.
Clock Initialization The clock initialization sub module provides the functionality for generating all
the required clock signals for microcontroller operation from any one of the
available sources. It enables the provision for individual clock source
selection for CPU and groups of peripherals.
This sub module also provides the functionality for obtaining various
frequencies required for individual peripheral devices.
For available clock sources, please refer to the respective device specific
component user manual.
RAM sections Initialization and Status Verification This sub module provides the functionality for initializing the RAM with the any
given value, at the selected blocks of the RAM and to verify the status of RAM.
MCU Reset Activation and Reason The microcontroller reset activation will be performed by forcing a software
reset. This functionality will be done by using software reset register. ECM
error sources can also be configured for internal reset so that if any error
occurs device will activate reset.
To provide the reset reason, this sub module captures the information
available with RESF – Reset factor register. This register contains
information.
Version Information This module provides APIs for reading Module Id, Vendor Id and vendor
specific version numbers.
24
Registers Details Chapter 6 Chapter 6 Registers Details This section describes the register details of MCU Driver Component.
Table 6-1 Register Details Register API Name Registers Used Access Config Parameter Macro/Variable 8/16/32 bits (LpEcmSetting-
>ulEcmInternalResetReg
MCU_IRCFG0_INIT_VAL
ECMIRCFG0
32
0value &
UE
(~MCU_RAM_MASK0_V
ALUE))
LVICNT
32
LulLVICntValue
MCU_LVI_MASK
PROT1PHCM
32
-
MCU_WRITE_DATA
D
PROT1PS
32
-
-
ECMMICFG0
8
LucDataByte
-
HH
ECMNMICFG
8
LucDataByte
-
0HH
ECMIRCFG0
8
LucDataByte
-
HH
ECMMECLR
8
-
MCU_ONE
ECMMPCMD
32
-
MCU_WRITE_DATA
0
Mcu_Init
ECMCECLR
8
-
MCU_ONE
ECMCPCMD0
32
-
MCU_WRITE_DATA
ECMESSTC0
32
LulEcmStatusData
-
CVMDEW
8
LucCVMCntValue
-
PROTCMDCV
32
-
MCU_WRITE_DATA
M
PROTSCVM
32
-
-
MCU_ECM_ERROUT_TI
ECMEPCTL
8
-
MER
ECMPCMD1
32
-
MCU_WRITE_DATA
ECMPS
8
-
-
MCU_EIBD08_CPU1_VAL
EIBD8
32
-
UE
25
Chapter 6 Register Details
Register API Name Registers Used Access Config Parameter Macro/Variable 8/16/32 bits MCU_ENABLE_TABLE_I
EIC8L
8
-
NTERRUPT
MCU_ECMEMK0_FULL_
ECMEMK0
32
-
MASK
MCU_ECMEMK1_FULL_
ECMEMK1
32
-
MASK
MCU_ECM_ERROUT_MO
ECMEPCFG
8
-
DE
((LpEcmSetting-
>ulEcmMaskInterReg0va
lue &
ECMMICFG0
32
(~MCU_RAM_MASK0_V
-
ALUE)) |
MCU_IRCFG0_INIT_VA
LUE)
(LpEcmSetting-
>ulEcmMaskInterReg1va
ECMMICFG1
32
lue &
-
(~MCU_RAM_MASK1_V
ALUE))
(LpEcmSetting-
>ulEcmNonMaskInterRe
ECMNMICFG
32
g0value &
-
0
(~MCU_RAM_MASK0_V
ALUE))
(LpEcmSetting-
>ulEcmNonMaskInterRe
ECMNMICFG
32
g1value &
-
1
(~MCU_RAM_MASK1_V
ALUE))
(LpEcmSetting-
>ulEcmInternalResetReg
ECMIRCFG1
32
1value &
-
(~MCU_RAM_MASK1_V
ALUE))
MCU_ECM_DELY_TIMER
ECMDTMCTL
8
-
_STOP
ECMDTMCM
MCU_ECM_DLYTIMER_V
16
-
P
ALUE
LpEcmSetting-
>ulEcmDelayTimerReg0
Value, LpEcmSetting-
>ulEcmDelayTimerReg1
ECMDTMCFG
32
Value, LpEcmSetting-
-
0
>ulEcmDelayTimerReg2
Value, LpEcmSetting-
>ulEcmDelayTimerReg3
Value
ECMMESSTR
MCU_RAM_MASK0_VAL
32
-
Mcu_InitRamS
0
UE
ection
MCU_RAM_MASK0_VAL
ECMESSTC0
32
-
UE
26
Registers Details Chapter 6 Register API Name Registers Used Access Config Parameter Macro/Variable 8/16/32 bits ECMMESSTR
MCU_RAM_MASK1_VAL
32
-
1
UE
MCU_RAM_MASK1_VAL
ECMESSTC1
32
-
UE
ECMPCMD1
32
-
MCU_WRITE_DATA
ECMPS
8
-
-
LpEcmSetting-
ECMMICFG0
32
>ulEcmMaskInterReg0va
-
lue
LpEcmSetting-
ECMMICFG1
32
>ulEcmMaskInterReg1va
-
lue
LpEcmSetting-
ECMNMICFG
32
>ulEcmNonMaskInterRe
-
0
g0value
LpEcmSetting-
ECMNMICFG
32
>ulEcmNonMaskInterRe
-
1
g1value
LpEcmSetting-
ECMIRCFG0
32
>ulEcmInternalResetReg
-
0value
LpEcmSetting-
ECMIRCFG1
32
>ulEcmInternalResetReg
-
1value
LpEcmSetting-
ECMEMK0
32
>ulEcmErrorMaskReg0V
-
alue
LpEcmSetting-
ECMEMK1
32
>ulEcmErrorMaskReg1V
--
alue
PROT1PHCM
32
-
MCU_WRITE_DATA
D
PROT1PS
32
-
-
Mcu_GpConfigPtr-
CLMA0CMPH
16
-
>usCLMA0CMPH
Mcu_GpConfigPtr-
CLMA0CMPL
16
-
>usCLMA0CMPL
Mcu_InitClock
CLMA0PCMD
8
-
MCU_WRITE_DATA
CLMA0PS
8
-
-
CLMA0CTL0
8
-
MCU_ONE
Mcu_GpConfigPtr-
CLMA1CMPH
16
-
>usCLMA1CMPH
Mcu_GpConfigPtr-
CLMA1CMPL
16
-
>usCLMA1CMPL
27
Chapter 6 Register Details
Register API Name Registers Used Access Config Parameter Macro/Variable 8/16/32 bits CLMA1PCMD
8
-
MCU_WRITE_DATA
CLMA1PS
8
-
-
CLMA1CTL0
8
-
MCU_ONE
Mcu_GpConfigPtr-
CLMA2CMPH
16
-
>usCLMA2CMPH
Mcu_GpConfigPtr-
CLMA2CMPL
16
-
>usCLMA2CMPL
CLMA2PCMD
8
-
MCU_WRITE_DATA
CLMA2PS
8
-
-
CLMA2CTL0
8
-
MCU_ONE
Mcu_GpConfigPtr-
CLMA3CMPH
16
-
>usCLMA3CMPH
Mcu_GpConfigPtr-
CLMA3CMPL
16
-
>usCLMA3CMPL
CLMA3PCMD
8
-
MCU_WRITE_DATA
CLMA3PS
8
-
-
CLMA3CTL0
8
-
MCU_ONE
Mcu_Distribute
-
-
-
-
PllClock
Mcu_GetPllSta
-
-
-
-
tus
Mcu_GetReset
-
-
-
-
Reason
Mcu_GetReset
-
-
-
-
RawValue
MCU_RES_CORRECT_V
SWRESA
32
-
AL
Mcu_PerformR
PROT1PHCM
32
-
MCU_WRITE_DATA
eset
D
PROT1PS
32
-
-
Mcu_SetMode
-
-
-
-
Mcu_GetRamS
-
-
-
-
tate
Mcu_CvmSelf
MCU_TWELVE,
CVMDIAG
8
-
DiagnosticTest
MCU_ZERO
28
Registers Details Chapter 6 Register API Name Registers Used Access Config Parameter Macro/Variable 8/16/32 bits MCU_CVM_FACTOR_CL
CVMFC
8
-
EAR
MCU_CVM_FACTOR_CL
CVMF
8
-
EAR
CVMDMASK
8
-
MCU_ONE, MCU_ZERO
PROTCMDCV
32
-
MCU_WRITE_DATA
M
PROTSCVM
32
-
-
CLMATESTS
32
-
-
CLMATEST
32
LulClmaXTestValue
-
Mcu_ClmaSelf
DiagnosticTest
PROT1PHCM
32
-
MCU_WRITE_DATA
D
PROT1PS
32
-
-
LpEcmSetting-
ECMEMK0
32
>ulEcmErrorMaskReg0V
-
alue
ECMMESSTR
32
LulEcmPseudoData
-
0
ECMCESSTR
32
LulEcmPseudoData
-
0
LpEcmSetting-
ECMEMK1
32
>ulEcmErrorMaskReg1V
-
alue
ECMMESSTR
MCU_ERROROUT_STAT
32
LulEcmPseudoData
1
US
ECMCESSTR
MCU_ERROROUT_STAT
32
LulEcmPseudoData
1
US
Mcu_EcmSelf
DiagnosticTest
ECMESSTC1
32
LulEcmPseudoData
-
MCU_ECM029_MASK_VA
ECMEMK0HH
8
-
LUE
ECMMICFG0
(~MCU_ECM029_MASK_
8
-
HH
VALUE)
ECMNMICFG
(~MCU_ECM029_MASK_
8
-
0HH
VALUE)
ECMIRCFG0
(~MCU_ECM029_MASK_
8
-
HH
VALUE)
ECMMECLR
8
-
MCU_ONE
ECMMPCMD
32
-
MCU_WRITE_DATA
0
29
Chapter 6 Register Details
Register API Name Registers Used Access Config Parameter Macro/Variable 8/16/32 bits ECMCECLR
8
-
MCU_ONE
ECMCPCMD0
32
-
MCU_WRITE_DATA
(MCU_ECM029_MASK_V
ECMESSTC0
32
LulEcmPseudoData
ALUE <<
MCU_TWENTYFOUR)
ECMPCMD1
32
-
MCU_WRITE_DATA
ECMPE0
32
LulEcmPseudoData
-
ECMPE1
32
LulEcmPseudoData
-
ECMPS
8
-
-
TESTCOMPR
(~MCU_LOCKSTEP_DUM
32
-
EG1
MY_VALUE)
TESTCOMPR
MCU_LOCKSTEP_DUMM
32
-
EG0
Y_VALUE
ECMMESSTR
Mcu_LockStep
32
-
MCU_TWO
0
SelfDiagnostic
Test
ECMESSTC0
32
-
MCU_TWO
ECMPCMD1
32
-
MCU_WRITE_DATA
ECMPS
8
-
-
POF
32
-
MCU_POF_RST
POFC
32
-
MCU_POF_CLEAR
Mcu_GpEcmSetting-
ECMMESSTR
32
>ulEcmInternalResetReg
-
0
0value
Mcu_GpEcmSetting-
ECMMESSTR
32
>ulEcmInternalResetReg
-
1
1value
Mcu_SaveRes
etReason
ECMESSTC0
32
LulEcmStatusData0
-
ECMESSTC1
32
LulEcmStatusData1
-
ECMPCMD1
32
-
MCU_WRITE_DATA
ECMPS
8
-
-
RESF
32
-
MCU_ZERO
30
Registers Details Chapter 6 Register API Name Registers Used Access Config Parameter Macro/Variable 8/16/32 bits RESFC
32
-
MCU_RESF_CLEAR
31
Chapter 6 Register Details
32
Interaction Between The User And MCU Driver Component Chapter 7 Chapter 7 Interaction between the User and MCU Driver Component The details of the services supported by the MCU Driver Component to the
upper layers users and the mapping of the channels to the hardware units is
provided in the following sections:
7.1. Services Provided By MCU Driver Component To User The MCU Driver Component provides the following functions to upper layers,
if supported by hardware:
•
To Perform the Self diagnostic test for the ECM, CVM, Clock Monitor and
Lock step.
• To initialize the RAM and to verify the status, section wise.
• To initialize the MCU specific clock options.
• To activate the specific clock to the MCU clock distribution.
• To read the reset type from the hardware.
• To perform the micro controller reset.
• To read the MCU Driver component version information.
33
Chapter 7 Interaction Between The User And MCU Driver Component
34

MCU Driver Component Header And Source File Description Chapter 8 Chapter 8 MCU Driver Component Header And Source File Description This section explains the MCU Driver Component‟s C Source and C Header
files. These files have to be included in the project application while
integrating with other modules.
The C header file generated by MCU Driver Generation Tool:
• Mcu_Cfg.h
• Mcu_Reg.h
• Mcu_Cbk.h
The C source file generated by MCU Driver Generation Tool:
• Mcu_PBcfg.c
The MCU Driver Component C header files:
• Mcu.h
• Mcu_Debug.h
• Mcu_Irq
• Mcu_PBTypes.h
• Mcu_Ram.h
• Mcu_Types.h
• Mcu_Version.h
The MCU Driver Component source files:
• Mcu.c
• Mcu_Irq.c
• Mcu_Ram.c
• Mcu_Version.c
The mcu specific C header files:
• Compiler.h
• Compiler_Cfg.h
• MemMap.h
• Platform_Types.h
• rh850_Types.h
The description of the MCU Driver Component files is provided in the table
below:
Table 8-1 Description of the MCU Driver Component Files File Details Mcu_Cfg.h
This file is generated by the MCU Driver Module Code
Generation Tool for MCU Driver Module pre-compile time
parameters. The macros and the parameters generated will
vary with respect to the configuration in the input ARXML file.
Mcu_Reg.h
This file contains the definitions for addresses of the hardware
registers used in the MCU Driver Module.
Mcu_Cbk.h
This file contains the extern declaration of call back functions
used in the MCU Driver Module.
35
Chapter 8 MCU Driver Component Header And Source File Description File Details Mcu_PBcfg.c
This file contains post-build configuration data. The structures
related to MCU Initialization, clock and power mode setting are
provided in this file. Data structures will vary with respect to
parameters configured.
Mcu.h
This file provides extern declarations for all the MCU Driver
Module APIs. This file provides service Ids of APIs, DET Error
codes and type definitions for MCU Driver initialization
structure. This header file shall be included in other modules to
use the features of MCU Driver Module.
Mcu_Irq.h
This file contains the ISR functions prototypes of the MCU
Driver Module.
Mcu_Types.h
This file provides data structure and type definitions for
initialization of MCU Driver.
Mcu_PBTypes.h
This file contains the macros used for the post build time
parameters.
Mcu_Ram.h
This file contains the extern declarations for the global variables
that are defined in Mcu_Ram.c file and the version information
of the file.
Mcu_Version.h
This file contains the macros of AUTOSAR version numbers of
all modules that are interfaced to MCU.
Mcu_Debug.h
This file provides Provision of global variables for debugging
purpose.
Mcu.c
This file contains the implementation of all MCU Driver Module
APIs.
Mcu_Irq.c
This file contains the ISR functions of the MCU Driver Module.
Mcu_Ram.c
This file contains the global variables used by MCU Driver
Module.
Mcu_Version.c
This file contains the code for checking version of all modules
that are interfaced to MCU.
Compiler.h
Provides compiler specific (non-ANSI) keywords. All mappings
of keywords, which are not standardized, and/or compiler
specific are placed and organized in this compiler specific
header.
Compiler_Cfg.h
This file contains the memory and pointer classes.
MemMap.h
This file allows mapping of variables, constants and code of
modules to individual memory sections. Memory mapping can
be modified as per ECU specific needs.
Platform_Types.h
This file provides provision for defining platform and compiler
dependent types.
rh850_Types.h
This file provides macros to perform supervisor mode (SV) write
enabled Register ICxxx and IMR register writing using
OR/AND/Direct operation
36
Generation Tool Guide Chapter 9 Chapter 9 Generation Tool Guide For more information on the MCU Driver Component Generation Tool, please
refer “AUTOSAR_MCU_Tool_UserManual.pdf”.
37
Chapter 9 G eneration Tool Guide
38
Application Programming Interface Chapter 10 Chapter 10 Application Programming Interface This section explains the Data types and APIs provided by the MCU Driver
Component to the Upper layers.
10.1. Imported Types This section explains the Data types imported by the MCU Driver Component
and lists its dependency on other modules.
10.1.1. Standard Types In this section all types included from the Std_Types.h are listed:
• Std_ReturnType
• Std_VersionInfoType
10.1.2. Other Module Types In this chapter all types included from the Dem.h are listed:
• Dem_EventIdType
• Dem_EventStatusType
10.2. Type Definitions This section explains the type definitions of MCU Driver Component
according to AUTOSAR Specification.
For more type definitions refer the SWS of MCU driver as mentioned in
chapter 2.
10.2.1 Mcu_ClockType Name: Mcu_ClockType
Type: uint8
Range: 1 to 2
Description: Type definition for Mcu_ClockType used by the API Mcu_InitClock.
10.2.2 Mcu_RawResetType Name: Mcu_RawResetType
Type: uint32
Range: 0 to 4294967295
Description: Type definition for Mcu_RawResetType used by the API Mcu_GetResetRawValue.
Note: Mcu_GetResetRawValue API is returning the RESF register status.
10.2.3 Mcu_RamSectionType Name: Mcu_RamSectionType
Type: uint8
Range: 0 to 255
Description: Type definition for Mcu_RamSectionType used by the API Mcu_InitRamSection.
39
Chapter 10 Application Programming Interfac e
10.2.4 Mcu_PllStatusTypes Name: Mcu_PllStatusType
Type: Enumeration
MCU_PLL_LOCKED
PLL is locked
MCU_PLL_UNLOCKED
PLL is unlocked.
Range: MCU_PLL_STATUS_UNDEFINED
PLL status is unknown
Description: Status value returned by the API Mcu_GetPllStatus.
Note: As per CPU manual Mcu_GetPllStatus API is not supporting the PLL clock implementation.
Hence Mcu_GetPllStatus is returning always MCU_PLL_LOCKED Status.
10.2.5 Mcu_RamStateType Following are the type definitions which are specific to R4.0 used by the MCU
Driver module:
Name: Mcu_RamStateType
Type: Enumeration
MCU_RAMSTATE_INVALID RAM State is valid.
Range: MCU_RAMSTATE_VALID
RAM State is invalid.
Description: Status value returned by the API Mcu_GetRamState
10.2.6 Mcu_ResetType Name: Mcu_ResetType
Type: Enumeration
Range: MCU_POWER_ON_CLEAR_RST
MCU_PIN_RST
MCU_SW_RST
MCU_WDT_RST
MCU_LOCK_STEP_CORE_RST
MCU_CLMA0_UPPER_LIMIT_RST
MCU_CLMA0_LOWER_LIMIT_RST
MCU_CLMA2_UPPER_LIMIT_RST
MCU_CLMA2_LOWER_LIMIT_RST
MCU_CLMA1_UPPER_LIMIT_RST
MCU_CLMA1_LOWER_LIMIT_RST
MCU_CLMA3_UPPER_LIMIT_RST
MCU_CLMA3_LOWER_LIMIT_RST
MCU_LRAM_ECC2_ADDPTY_RST
MCU_GRAM_ECC2_ADDPTY_RST
MCU_CASHE_RAM_ECC2_RST
MCU_CFLH_ECC2_ADDPTY_RST
MCU_DATA_FLSH_ECC2_RST
MCU_DTS_RAM_ECC2_RST
MCU_CSIH_RAM_ECC2_RST
MCU_CAN_RAM_ECC2_RST
MCU_FLXR_RAM_ECC2_RST
MCU_MODE0_RST
40
Application Programming Interface Chapter 10 MCU_MODE1_RST
MCU_MODE2_RST
MCU_PEGUARD_RST
MCU_GRAM_GUARD_RST
MCU_PBUSGUARD_RST
MCU_SAR_ADC_PTY_RST
MCU_DATA_PRTY_RST
MCU_ECM_COMP_RST
MCU_LVI_RST
MCU_TEMP_SENSE_RST
MCU_DMA_TRANSF_RST
MCU_DMA_REG_PROTECT_RST
MCU_LRAM_ECC1_PTY_RST
MCU_GRAM_ECC1_RST
MCU_CFLH_ECC1_RST
MCU_DATA_FLSH_ECC1_RST
MCU_DTS_RAM_ECC1_RST
MCU_ALL_PERI_RAM_ECC1_RST
MCU_BIST_ECC1_RST
MCU_BIST_ECC2_RST
MCU_FACI_TRANSF_RST
MCU_ECM_DELY_OVRFLW_RST
MCU_RESET_UNDEFINED
MCU_RESET_UNKNOWN
Description: Type of reset supported by the hardware
Note: 1. All RAM related ECM error sources are enabled for maskable interrupts only after Ram
initialization.
2. User should configure only one ECM event for each ECM error source at a time priority
level for the ECM event should be as follow:
Internal Reset
Maskable Interrupt
Non Maskable Interrupt
10.2.7 Mcu_ClmaIndexType Name: Mcu_ClmaIndexType
Type: Enumeration
MCU_CLMA0
CLMA0
Range: MCU_CLMA1
CLMA1
MCU_CLMA2
CLMA2
MCU_CLMA3
CLMA3
Description: Variable of this type is used to pass in Mcu_ClmaSelfDiagnosticTest API
41
Chapter 10 Application Programming Interfac e
10.2.8 Mcu_ModeType Name: Mcu_ModeType
Type: uint8
Range: 0 to 2
Description: Type definition for Mcu_ModeType used by the API Mcu_SetMode.
Note: As per CPU Manual Mcu_SetMode API is not supporting for any standby mode.
Hence the Mcu_ModeType parameter is unused for P1x MCU module implementation.
10.3. Function Definitions
Table 10-1 API Provided by MCU Driver Component
Sl. No API’s name 1.
Mcu_Init
2.
Mcu_InitRamSection
3.
Mcu_InitClock
4.
Mcu_DistributePllClock
5.
Mcu_GetPllStatus
6.
Mcu_GetResetReason
7.
Mcu_GetResetRawValue
8.
Mcu_PerformReset
9.
Mcu_SetMode
10.
Mcu_GetRamState
11.
Mcu_LockStepSelfDiagnosticTest
12.
Mcu_CvmSelfDiagnosticTest
13.
Mcu_ClmaSelfDiagnosticTest
14.
Mcu_EcmSelfDiagnosticTest
15.
Mcu_SaveResetReason
42
Development And Production Errors Chapter 11 Chapter 11 Development And Production Errors In this section the development errors that are reported by the MCU Driver
Component are tabulated. The development errors will be reported only when
the pre-compiler option McuDevErrorDetect is enabled in the configuration.
The production code errors are not supported by MCU Driver Component.
11.1. MCU Driver Component Development Errors The following table contains the DET errors that are reported by MCU Driver
Component. These errors are reported to Development Error Tracer Module
when the MCU Driver Component APIs are invoked with wrong input
parameters or without initialization of the driver.
Table 11-1 DET Errors of MCU Driver Component Sl. No. 1 Error Code
MCU_E_PARAM_CONFIG
Related API(s)
Mcu_Init
Source of Error
When the API service is called without module initialization.
Sl. No. 2 Error Code
MCU_E_PARAM_CLOCK
Related API(s)
Mcu_InitClock
Source of Error
When Clock Setting is not within the settings defined in the configuration data
structure.
Sl. No. 3 Error Code
MCU_E_PARAM_RAMSECTION
Related API(s)
Mcu_InitRamSection
Source of Error
When RamSection is not within the sections defined in the configuration data structure.
Sl. No. 4 Error Code
MCU_E_PLL_NOT_LOCKED
Related API(s)
Mcu_DistributePllClock
Source of Error
When PLL is not locked.
Sl. No. 5 Error Code
MCU_E_UNINIT
Related API(s)
Mcu_InitRamSection, Mcu_InitClock, Mcu_DistributePllClock, Mcu_GetPllStatus,
Mcu_GetResetReason, Mcu_GetResetRawValue, Mcu_PerformReset,
Mcu_SetMode, Mcu_GetRamState
Source of Error
When the APIs are invoked without the initialization of the MCU Driver Component.
Sl. No. 6 Error Code
MCU_E_INVALID_DATABASE
Related API(s)
Mcu_Init
Source of Error
When the API is invoked with no database.
Sl. No. 7 Error Code
MCU_E_PARAM_MODE
Related API(s)
Mcu_SetMode
Source of Error
When the API is invoked with invalid MCU mode.
43
Chapter 11 Development And Production Errors 11.2. MCU Driver Component Production Errors In this section the DEM errors identified in the MCU Driver component are
listed. MCU Driver component reports these errors to DEM by invoking
Dem_ReportErrorStatus API. This API is invoked, when the processing of the
given API request fails.
Table 11-2 DEM Errors of MCU Driver Component Sl. No. 1 Error Code
MCU_E_CLOCK_FAILURE
Related API(s)
Mcu_InitClock
Source of Error
When there is failure of the monitored clock frequency.
Sl. No. 2 Error Code
MCU_E_WRITE_TIMEOUT_FAILURE
Related API(s)
Mcu_PerformReset, Mcu_ProtectedWrite
Source of Error
When writing to a write-protected register fails
Sl. No. 3 Error Code
MCU_E_CVM_SELFDIAG_FAILURE
Related API(s)
Mcu_CvmSelfDiagnosticTest
Source of Error
When there is failure CVM self-diagnostic test.
Sl. No. 4
Error Code
MCU_E_CLM_SELFDIAG_FAILURE
Related API(s)
Mcu_ClmaSelfDiagnosticTest
Source of Error
When there is failure CLMA self-diagnostic test.
Sl. No. 5
Error Code
MCU_E_ECM_SELFDIAG_FAILURE
Related API(s)
Mcu_EcmSelfDiagnosticTest
Source of Error
When there is failure ECM self-diagnostic test.
44
























Memory Organization Chapter 12 Chapter 12 Memory Organization Following picture depicts a typical memory organization, which must be met
for proper functioning of MCU Driver Component software.
ROM Section MCU Driver Component RAM ect Library Object es MCU Driver code related to APIs is placed in
Global RAM of unspecific size required for
this memory.
MCU driver functioning.
X1 Y1 Segment Name:
Segment Name:
MCU PUBLIC_CODE_ROM NOINIT_RAM_UNSPECIFIED MCU Driver code related to internal
Global 8-bit RAM initialized by MCU Driver.
functions are placed in this memory
X2 Segment Name:
Segment Name:
Y2 NOINIT_RAM_8BIT MCU_PRIVATE_CODE_ROM MCU Driver code related to ISR functions are
Global 8-bit RAM to be initialized by start-
are placed in this memory
up code
X3 Y3 Segment Name:
Segment Name:
MCU_START_SEC_CODE_FAST RAM_8BIT Tool Generated Files The const section (for MCU configuration
Global RAM of unspecific size required for
structure of type “Mcu_ConfigType”) in the file
MCU Driver functioning. The Generation tool
Mcu_PBcfg.c is placed in this memory.
X4 allocates this RAM.
Y4Segment Name:
MCU_CFG_DBTOC_UNSPECIFIED Segment Name:
44 MCU_CFG_RAM_UNSPECIFIED The const section (other than
MCU Configuration structure) in the file
Mcu_PBcfg.c is placed in this memory.
X5 Segmentname:
MCU_CFG_DATA_UNSPECIFIED The const section in the file Mcu_Pbcfg.c is
placed in this memory.
X6 Segment Name:
CONST_ROM_UNSPECIFIED
Figure 12-1 MCU Driver Component Memory Organization 45
Chapter 12 Memory organization ROM Section (X1, X2, X3, X4, X5 and X6): MCU_PUBLIC_CODE_ROM (X1): API(s) of MCU Driver Component, which
can be located in code memory.
MCU_PRIVATE_CODE_ROM (X2): Internal functions of MCU Driver
Component code that can be located in code memory.
MCU_START_SEC_CODE_FAST (X3): Interrupt functions of MCU Driver
Component code that can be located in code memory.
MCU_CFG_DBTOC_UNSPECIFIED (X4): This section consists of MCU
Driver Component database table of contents generated by the MCU Driver
Component Generation Tool. This can be located in code memory.
MCU_CFG_DATA_UNSPECIFIED (X5): This section consists of MCU
Driver Component constant configuration structures. This can be located in
code memory.
CONST_ROM_UNSPECIFIED (X6): This section consists of MCU Driver
Component constant structures used for function pointers in MCU Driver
Component. This can be located in code memory.
RAM Section (Y1, Y2, Y3 and Y4): NOINIT_RAM_UNSPECIFIED (Y1): This section consists of the global RAM
variables that are used internally by MCU Driver Component. This can be
located in data memory.
NOINIT_RAM_8BIT (Y2): This section consists of the global RAM variables of
8-bit size that are used internally by MCU Driver Component. This can be
located in data memory.
RAM_1BIT (Y3): This section consists of the global RAM variables of 1-bit
size that are initialized by start-up code and used internally by MCU Driver
Component. This can be located in data memory.
MCU_CFG_RAM_UNSPECIFIED (Y4): This section consists of the global
RAM variables that are generated by MCU Driver Component Generation
Tool. This can be located in data memory.
Remark •
X1, X2, Y1, Y2 and Y3 pertain to only MCU Driver Component and do not
include memory occupied by Mcu_PBcfg.c file generated by MCU Driver Component
Generation Tool.
User must ensure that none of the memory areas overlap with each other. Even
„debug‟ information should not overlap.
46
P1M Specific Information Chapter 13
Chapter 13 P1M Specific Information P1M supports following devices:
R7F701304
R7F701305
R7F701310
R7F701311
R7F701312
R7F701313
R7F701314
R7F701315
R7F701318
R7F701319
R7F701320
R7F701321
R7F701322
R7F701323
13.1. Interaction between the User and MCU Driver Component The details of the services supported by the MCU Driver Component to the
upper layers users and the mapping of the channels to the hardware units is
provided in the following sections:
13.1.1. Translation Header File The P1x_translation.h translation header file supports following devices:
R7F701304
R7F701305
R7F701310
R7F701311
R7F701312
R7F701313
R7F701314
R7F701315
R7F701318
R7F701319
R7F701320
R7F701321
R7F701322
R7F701323
13.1.2. ISR Function The table below provides the list of handler addresses corresponding to the
hardware unit ISR(s) in MCU Driver Component. The user should configure
the ISR functions mentioned below:
47

Chapter 13 P1M Specific Information
Table 13-1 ISR For MCU Interrupt Source Name of the ISR Function MCU_FEINT_ISR
INTECM
MCU_ECM_EIC_ISR
13.1.3. Parameter Definition File Parameter definition files support information for P1M
Table 13-2 PDF information for P1M PDF Files Devices supported R403_MCU_P1M_04_05.arxml
701304, 701305
R403_MCU_P1M_10_to_15_18_to_23.arx 701310, 701311, 701312, 701313,
ml
701314, 701315, 7013018, 701319,
701320, 701321, 701322, 7013023
13.2. Sample Application 13.2.1 Sample Application Structure The Sample Application is provided as reference to the user to understand
the method in which the MCU APIs can be invoked from the application.
G eneri c A U T O S A R
R H 8 5 0
T Y P E S
C O M P I L E R
T Y P E S
D evices P 1 x
S T U B
S T U B
S T U B
S T U B
M CU
S ample
D e t
D e m
S chM
O s
Application
Figure 13-1 Overview of MCU Driver Sample Application
48
P1M Specific Information Chapter 13 The Sample Application of the P1M is available in the path:
X1X\P1x\modules\mcu\sample_application
The Sample Application consists of the following folder structure:
X1X\P1x\modules\mcu\definition\<AUTOSAR_version>\<SubVariant>
\R403_MCU_P1M_04_05.arxml
\R403_MCU_P1M_10_to_15_18_to_23.arxml
X1X\P1x\modules\mcu\sample_application
\<SubVariant>\<AUTOSAR_version>
\src\Mcu_PBcfg.c
\include\Mcu_Cfg.h
\include\Mcu_Cbk.h
\include\Mcu_Reg.h
\config\App_MCU_P1M_701304_Sample.arxml
\config\App_MCU_P1M_701304_Sample.html
\config\App_MCU_P1M_701304_Sample.one
\config\App_MCU_P1M_701305_Sample.arxml
\config\App_MCU_P1M_701305_Sample.html
\config\App_MCU_P1M_701305_Sample.one
\config\App_MCU_P1M_701310_Sample.arxml
\config\App_MCU_P1M_701310_Sample.html
\config\App_MCU_P1M_701310_Sample.one
\config\App_MCU_P1M_701311_Sample.arxml
\config\App_MCU_P1M_701311_Sample.html
\config\App_MCU_P1M_701311_Sample.one
\config\App_MCU_P1M_701312_Sample.arxml
\config\App_MCU_P1M_701312_Sample.html
\config\App_MCU_P1M_701312_Sample.one
\config\App_MCU_P1M_701313_Sample.arxml
\config\App_MCU_P1M_701313_Sample.html
\config\App_MCU_P1M_701313_Sample.one
\config\App_MCU_P1M_701314_Sample.arxml
\config\App_MCU_P1M_701314_Sample.html
\config\App_MCU_P1M_701314_Sample.one
\config\App_MCU_P1M_701315_Sample.arxml
\config\App_MCU_P1M_701315_Sample.html
\config\App_MCU_P1M_701315_Sample.one
\config\App_MCU_P1M_701318_Sample.arxml
\config\App_MCU_P1M_701318_Sample.html
\config\App_MCU_P1M_701318_Sample.one
\config\App_MCU_P1M_701319_Sample.arxml
\config\App_MCU_P1M_701319_Sample.html
\config\App_MCU_P1M_701319_Sample.one
\config\App_MCU_P1M_701320_Sample.arxml
\config\App_MCU_P1M_701320_Sample.html
\config\App_MCU_P1M_701320_Sample.one
49
Chapter 13 P1M Specific Information
\config\App_MCU_P1M_701321_Sample.arxml
\config\App_MCU_P1M_701321_Sample.html
\config\App_MCU_P1M_701321_Sample.one
\config\App_MCU_P1M_701322_Sample.arxml
\config\App_MCU_P1M_701322_Sample.html
\config\App_MCU_P1M_701322_Sample.one
\config\App_MCU_P1M_701323_Sample.arxml
\config\App_MCU_P1M_701323_Sample.html
\config\App_MCU_P1M_701323_Sample.one
In the Sample Application all the MCU APIs are invoked in the following
sequence:
• The API Mcu_Init is invoked with a valid database address for the proper
initialization of the MCU Driver, all the MCU Driver control registers and
RAM variables will get initialized after this API is called.
• The API Mcu_InitRamSection is invoked to initialize the RAM section wise
as provided from the configuration structure.
• The API Mcu_InitClock is invoked to initialize the clock sources Main Osc,
High Speed Internal ring Oscillator.
• The API Mcu_GetPllStatus is invoked to provide the lock status of the
PLL. This API will return the PLLstatus as MCU_PLL_LOCKED or
MCU_PLL_UNLOCKED.
• The API Mcu_GetResetReason is invoked to read the reset type from
the hardware by checking the RESF register and if not supported,
returns MCU_POWER_ON_RESET. This API shall clear the reset
factor register.
• The API Mcu_GetResetRawValue is invoked to return reset type value
from the hardware register RESF
• The API Mcu_GetVersionInfo is invoked to get the version of the MCU
Driver module with a variable of Std_VersionInfoType, after the call of
this API the passed parameter will get updated with the MCU Driver
version details.
• The API Mcu_PerformReset invoked to microcontroller reset is
performed by accessing the software reset register.
• The API Mcu_SetMode is invoked to activate the MCU power modes.
Remark To unmask all resets „target pinmask k‟ command is used.
13.2.2 Building Sample Application 13.2.2.1. Configuration Example This section contains the typical configuration which is used for measuring
RAM/ROM consumption, stack depth and throughput details.
50
P1M Specific Information Chapter 13 Configuration Details: App_MCU_P1M_701312_Sample.html
13.2.2.2. Debugging the Sample Application Remark GNU Make utility version 3.81 or above must be installed and available in the
path as defined by the environment user variable “GNUMAKE” to complete
the build process using the delivered sample files.
Open a Command window and change the current working directory to “make”
directory present as mentioned in below path:
“X1X\P1x\common_family\make\<compiler>”
Now execute the batch file SampleApp.bat with following parameters:
SampleApp.bat mcu <AUTOSAR_version> <Device_name>
•
After this, the tool output files will be generated with the configuration
as mentioned in App_MCU_P1M_701312_Sample.html file available
in the path:
“X1X\P1x\modules\mcu\sample_application\<SubVariant>\<AUTOSAR_ve
rsion>\config\App_MCU_P1M_701312_Sample.html”
•
After this, all the object files, map file and the executable file
App_MCU_P1M_Sample.out will be available in the output folder:
(“X1X\P1x\modules\mcu\sample_application\<SubVariant>
\obj\<compiler>”)
•
The executable can be loaded into the debugger and the sample
application can be executed
Remark Executable files with „*.out‟ extension can be downloaded into the target
hardware with the help of Green Hills debugger.
• If any configuration changes (only post-build) are made to the ECU
Configuration Description files
“X1X\P1x\modules\mcu\sample_application\<SubVariant>\<AUTOSAR_versi
on>\config\App_MCU_P1M_701312_Sample.arxml”
•
The database alone can be generated by using the following commands.
make –f App_MCU_P1M_Sample.mak generate_mcu_config
make –f App_MCU_P1M_Sample.mak App_MCU_P1M_Sample.s37
•
After this, a flash able Motorola S-Record file App_MCU_P1M_Sample.s37
is available in the output folder.
Note: The <Device_name> indicates the device to be compiled, which can be
701304, 701305, 701310, 701311, 701312, 701313, 701314, 701315, 701318,
701319, 701320, 701321, 701322, 701323.
13.3. Memory and Throughput
13.3.1. ROM/RAM Usage The details of memory usage for the typical configuration, with DET disabled
as provided in Section 13.3.2.1
Configuration Example are provided in this
section.
51
Chapter 13 P1M Specific Information
Table 13-3 ROM/RAM Details without DET Sl. No. ROM/RAM Segment Name Size in bytes in GHS 1.
ROM
MCU_PUBLIC_CODE_ROM
3578
MCU_PRIVATE_CODE_ROM
2788
MCU_FAST_CODE_ROM
1276
MCU_CFG_DBTOC_UNSPECIFIED
52
MCU_CFG_DATA_UNSPECIFIED
760
ROM.RAM_1BIT
3
ROM.RAM_32BIT
8
2.
RAM
RAM_UNSPECIFIED
16
RAM_1BIT
3
NOINIT_RAM_8BIT
0
RAM_32BIT
8
NOINIT_RAM_UNSPECIFIED
16
MCU_CFG_RAM_UNSPECIFIED
0
The details of memory usage for the typical configuration, with DET enabled
and all other configurations as provided in 13.3.2.1
Configuration Example
are provided in this section.
Table 13-4 ROM/RAM Details with DET Sl. No. ROM/RAM Segment Name Size in bytes in GHS 1.
ROM
MCU_PUBLIC_CODE_ROM
3566
MCU_PRIVATE_CODE_ROM
2788
MCU_FAST_CODE_ROM
1276
MCU_CFG_DBTOC_UNSPECIFIED
52
MCU_CFG_DATA_UNSPECIFIED
760
ROM.RAM_1BIT
3
ROM.RAM_32BIT
8
52
P1M Specific Information Chapter 13 Sl. No. ROM/RAM Segment Name Size in bytes in GHS 2.
RAM
RAM_UNSPECIFIED
16
RAM_1BIT
3
NOINIT_RAM_8BIT
0
RAM_32BIT
8
NOINIT_RAM_UNSPECIFIED
16
MCU_CFG_RAM_UNSPECIFIED
0
13.3.2. Stack Depth The worst-case stack depth for MCU Driver Component for the typical
configuration provided in Section 13.3.2.1 Configuration Example is
approximately 64 bytes.
13.3.3. Throughput Details The throughput details of the APIs for the configuration mentioned in the
Section 13.3.2.1 Configuration Example is as given below.
Table 13-5 Throughput Details of the APIs Throughput in Sl. No. API Name microseconds in GHS Remarks 1.
Mcu_Init
45.5391
-
2.
Mcu_InitClock
154.55
-
3.
Mcu_GetPllStatus
0.25
-
4.
Mcu_InitRamSection
9.137
-
5.
Mcu_GetResetReason
0.25
-
6.
Mcu_GetResetRawValue
0.25
-
7.
Mcu_GetVersionInfo
0.12
-
8.
Mcu_GetRamState
0.562
-
9.
Mcu_DistributePllClock
0.12
10.
Mcu_SetMode
0.12
-
11.
Mcu_PerformReset
0.12
-
12.
Mcu_FEINT_ISR
0.437
-
53
Chapter 13 P1M Specific Information
54
Release Details Chapter 14 Chapter 14 Release Details
MCU Driver Software Version: 1.0.3
55
Chapter 14 Release Details
56
Revision History Sl. No. Description Version Date 1.
Initial Version
1.0.0
18-Oct-2013
2.
Following changes are made:
1.0.1
30-Apr-2014
1. Chapter 2 is updated for reference documents.
2. Section 4.3 is updated for Exclusive Area name change.
3. Section 4.4 is updated for adding user and supervisor mode
details for new APIs.
4. Chapter 6 is updated for Register details used in APIs.
5. Chapter 8 is updated for adding file description for tool
generated file „Mcu_Cbk.h‟.
6. Section 10.3 is updated for adding new APIs in function
definition.
7. Section 11.1 is updated for adding DET error.
8. Chapter 13 and section 13.1.1 is updated for adding new
supported devices.
9. Section 13.2 is updated for change in compiler and linker version
details.
10. Section 13.3 is updated for adding latest configuration details for
supported devices.
11. Section 13.3.2 is updated for change in configuration example
for sample application testing.
12. Section 13.4 is updated for updating ROM/RAM, Stack and
Throughput details.
13. Chapter 14 is updated for increment in MCU Driver software
version.
3.
Following changes are made:
1.0.2
09-May-2014
1. Chapter 4 is updated for adding a new section regarding RAM
Initialization.
2. Chapter 13 and section 13.3.1 is updated for removal of
unsupported devices.
4.
Following changes are made:
1.0.3
20-Oct-2014
1. Chapter 2 is updated for referenced documents version.
2. Section 13.1.1 is updated for adding the device names.
3. Section 13.2 is updated for compiler, assembler and linker
details.
4. Section 13.3 is updated to add parameter definition file and
sample application configuration files for all P1M devices.
5. Chapter 14 is updated for MCU driver component version
information.
6. Deviation list is updated to add MCU_E_PARAM_POINTER
error for Mcu_GetVersioInfo API and AUTOSAR requirement.
5
Following changes are made:
1.0.4
12-Dec-2014
1. Chapters 7 to 11 updated to start at odd page.
2. Date in Revision History updated.
3. Document page numbers are corrected.
4. Chapter 11 updated to add MCU_E_PARAM_MODE DET.
5. Page number is removed from publication info page.
6. Section 13.2 is updated for compiler, assembler and linker details.
7. Chapter 8 is update to include rh850_types.h file.
8. Section 13.4 is updated for Memory and throughput details.
57
6
Following changes are made:
1.0.5
30-Apr-2015
1. New section, “4.7 Callout API” added to chapter 4.
2. Information regarding Interrupt vector table is added to “Section
4.1 General”.
3. As part of device support activity for R7F701304, R7F701305,
R7F701313, R7F701315, R7F701318 to R7F701323 updated
sections 3.1.1, 13.1, 13.2.
4. Removed section Compiler,Linker and Assembler in Chapter13.
5. Updated section 13.3 for memory and throughput
6. Copyright information has been changed to 2015
58
59
AUTOSAR MCAL R4.0.3 User's Manual MCU Driver Component Ver.1.0.5 Embedded User’s Manual Publication Date: Rev.0.01, Apr 30, 2015
Published by: Renesas Electronics Corporation


SALES OFFICES http://www.renesas.com Refer
to "http://www.renesas.com/" for the latest and de tailed information.
Renesas Electronics America Inc. 2880 Scott Boulevard Santa Clara, CA 95050-2554, U.S.A.
Tel: +1-408-588-6000, Fax: +1-408-588-6130
Renesas Electronics Canada Limited 1101 Nicholson Road, Newmarket, Ontario L3Y 9C3, Canada
Tel: +1-905-898-5441, Fax: +1-905-898-3220
Renesas Electronics Europe Limited Dukes Meadow, Millboard Road, Bourne End, Buckinghamshire, SL8 5FH, U.K
Tel: +44-1628-585-100, Fax: +44-1628-585-900
Renesas Electronics Europe GmbH
Arcadiastrasse 10, 40472 Düsseldorf, Germany
Tel: +49-211-65030, Fax: +49-211-6503-1327
Renesas Electronics (China) Co., Ltd. 7th Floor, Quantum Plaza, No.27 ZhiChunLu Haidian District, Beijing 100083, P.R.China
Tel: +86-10-8235-1155, Fax: +86-10-8235-7679
Renesas Electronics (Shanghai) Co., Ltd. Unit 204, 205, AZIA Center, No.1233 Lujiazui Ring Rd., Pudong District, Shanghai 200120, China
Tel: +86-21-5877-1818, Fax: +86-21-6887-7858 / -7898
Renesas Electronics Hong Kong Limited Unit 1601-1613, 16/F., Tower 2, Grand Century Place, 193 Prince Edward Road West, Mongkok, Kowloon, Hong Kong
Tel: +852-2886-9318, Fax: +852 2886-9022/9044
Renesas Electronics Taiwan Co., Ltd. 7F, No. 363 Fu Shing North Road Taipei, Taiwan
Tel: +886-2-8175-9600, Fax: +886 2-8175-9670
Renesas Electronics Singapore Pte. Ltd. 1 harbourFront Avenue, #06-10, keppel Bay Tower, Singapore 098632
Tel: +65-6213-0200, Fax: +65-6278-8001
Renesas Electronics Malaysia Sdn.Bhd. Unit 906, Block B, Menara Amcorp, Amcorp Trade Centre, No. 18, Jln Persiaran Barat, 46050 Petaling Jaya, Selangor Darul Ehsan, Malaysia
Tel: +60-3-7955-9390, Fax: +60-3-7955-9510
Renesas Electronics Korea Co., Ltd. 11F., Samik Lavied' or Bldg., 720-2 Yeoksam-Dong, Kangnam-Ku, Seoul 135-080, Korea
Tel: +82-2-558-3737, Fax: +82-2-558-5141
© 2015 Renesas Electronics Corporation. All rights reserved.
Colophon 1.0



AUTOSAR MCAL R4.0.3
User‟s Manual
Document Outline