This is the multi-page printable view of this section. Click here to print.
Component Implementation
1 - FlsMem Integration Manual
Integration Manual
For
FlsMem
VERSION: 1
DATE: 11/12/17
Prepared By:
Software Group,
Nexteer Automotive,
Saginaw, MI, USA
Location: The official version of this document is stored in the Nexteer Configuration Management System.
Revision History
| Sl. No. | Description | Author | Version | Date | 
| 1 | Initial version | Avinash James | 1 | 11/12/17 | 
Table of Contents
3.2 Global Functions(Non RTE) to be provided to Integration Project 6
4 Configuration REQUIREMeNTS 7
4.2 Configuration Files to be provided by Integration Project 7
4.3 Da Vinci Parameter Configuration Changes 7
4.4 DaVinci Interrupt Configuration Changes 8
4.5 Manual Configuration Changes 8
5 Integration DATAFLOW REQUIREMENTS 9
5.1 Required Global Data Inputs 9
5.2 Required Global Data Outputs 9
5.3 Specific Include Path present 9
Abbrevations And Acronyms
| Abbreviation | Description | 
| DFD | Design functional diagram | 
| MDD | Module design Document | 
| FDD | Functional Design Document | 
| CCT | Common Checksum Tool | 
References
This section lists the title & version of all the documents that are referred for development of this document
| Sr. No. | Title | Version | 
| 1 | FDD – CM102B FlsMem | See Synergy subproject version | 
| 2 | Software Naming Conventions | Process 04.04.02 | 
| 3 | Software Coding Standards | Process 04.04.02 | 
Dependencies
SWCs
| Module | Required Feature | 
| AR202A MicroCtrlrSuprt | NxtrMcuSuprtLib functions and register definitions | 
| CM800A SyncCrc | CRC HW Module Configuration and Allocation | 
Note : Referencing the external components should be avoided in most cases. Only in unavoidable circumstance external components should be referred. Developer should track the references.
Global Functions(Non RTE) to be provided to Integration Project
DtsInin - To be defined as a trusted function as the DTS Channel master registers need to be configured in the supervisor mode.
DtsClnUp - To be defined as a trusted function as the DTS registers are being re-configured in the supervisor mode to avoid access protection violation
CodFlsSngBitEcc – Single bit code flash ECC error handler call back function provided to the MCAL driver
Configuration REQUIREMeNTS
Build Time Config
| Modules | Notes | |
Configuration Files to be provided by Integration Project
CDD_FlsMem_Cfg.c
CDD_FlsMem_Cfg_private.h
Da Vinci Parameter Configuration Changes
| Parameter | Notes | SWC | 
| /Nexteer/FlsMem/FlashCRCRegnConfig/ StartAddress | Configured with “FlashCRCRegnConfig” Each Flash region(for eg:- Boot, App, Cal1) has a start address where the code resides on the flash | FlsMem | 
| /Nexteer/FlsMem/FlashCRCRegnConfig/Length | Configured with “FlashCRCRegnConfig” Each Flash region has a length defined for the region | FlsMem | 
| /Nexteer/FlsMem/FlashCRCRegnConfig/PredefinedCrcAddress | Configured with “FlashCRCRegnConfig” Each Flash region has a PredefinedCrcAddress defined for the region which is used by the CCT tool for storing the checksum on the flash and serves as the reference location to retrieve the pre calculated CRC and do a comparison with calculated CRC | FlsMem | 
| /Nexteer/FlsMem/FlashCRCRegnConfig/LengthSymbol | Configured with “FlashCRCRegnConfig” Each Flash region has a length defined for the region and accepts linker symbols | FlsMem | 
| /Nexteer/FlsMem/FlashCRCRegnConfig/PredefinedCrcAddressSymbol | Configured with “FlashCRCRegnConfig” Each Flash region has a PredefinedCrcAddress defined for the region which is used by the CCT tool for storing the checksum on the flash and serves as the reference location to retrieve the pre calculated CRC and do a comparison with calculated CRC and accepts linker symbols | FlsMem | 
| /Nexteer/FlsMem/FlashCRCRegnConfig/StartingAddressSymbol | Configured with “FlashCRCRegnConfig” Each Flash region(for eg:- Boot, App, Cal1) has a start address where the code resides on the flash and accepts linker symbol | FlsMem | 
| /Nexteer/FlsMem/FlashCRCRegnConfig/UseSymbolName | Configured with “FlashCRCRegnConfig” to select either the symbol names or the actual values | FlsMem | 
| /Renesas/EcucDefs_Mcu/Mcu/McuModuleConfiguration /McuEcmErrorSourcesCfg/McuEcmErrorSource36 | Call back function name is “CodFlsSngBitEcc”. Refer the CM104A Integration manual for the configuration of the error source. (Type of the error, classification of the error eg FENMI or EI information) . | |
| /Nexteer/FlsMem/ApplCRCRegnIdx/ApplCrcRegnNr | The array Index for the application region CRC region definition | FlsMem | 
DaVinci Interrupt Configuration Changes
| ISR Name | VIM # | Priority Dependency | Notes | 
Manual Configuration Changes
| Constant | Notes | SWC | 
| None | 
Integration DATAFLOW REQUIREMENTS
Required Global Data Inputs
None
Required Global Data Outputs
None
Specific Include Path present
Yes
Runnable Scheduling
This section specifies the required runnable scheduling.
| Init | Scheduling Requirements | Trigger | 
| FlsMemInit1 | None | Once At Init (RTE) | 
| FlsMemInit2 | Non-RTE Init, Called in Startup Sequence* | Function call in Startup Sequence | 
| Runnable | Scheduling Requirements | Trigger | 
| FlsMemPer1 | None | 100ms(RTE) | 
*“FlsMemInit2” shall schedule after OS Start – Refer CM100 Start up sequence.
PEG shall be configured before “FlsMemInit2”.
CrcHw Init shall be scheduled before “FlsMemInit2”.
FlsMemInit1 should be called before DiagcMgrInit1
Memory Map REQUIREMENTS
Mapping
| Memory Section | Contents | Notes | 
| CDD_FlsMem_START_SEC_CODE | ||
| CDD_FlsMem_START_SEC_CONST_UNSPECIFIED | Constant section for constant variable | |
| CDD_FlsMemNonRte_START_SEC_VAR_INIT_128 | Data that a DMA channel writes to during CRC test | This gets mapped to a “.data_dma_128” section and/or a “.sdata_dma_128” section (depending on compiler settings) that will need to be explicitly added to the linker file. The intent of these sections is to be placed in a RAM memory section that only the DMA has write access to (processor in user mode only has read access). Additionally, since these are initialized data sections, the appropriate ROM sections will need to be added to the linker to allow initial values to be copied from Flash to RAM during startup for these sections. e.g.: .ROM_data_dma_128 ROM(.data_dma_128) FILL(0xFF) :{}>. and .ROM_sdata_dma_128 ROM(.sdata_dma_128) FILL(0xFF) :{}>. | 
* Each …START_SEC… constant is terminated by a …STOP_SEC… constant as specified in the AUTOSAR Memory Mapping requirements.
Usage
| Feature | RAM | ROM | 
Table 1: ARM Cortex R4 Memory Usage
NvM Blocks
None
Compiler Settings
Preprocessor MACRO
None
Optimization Settings
None
Appendix
2 - FlsMem Module Design Document
Module Design Document
For
FlsMem
Dec 07 , 2017
Prepared For:
Software Engineering
Nexteer Automotive,
Saginaw, MI, USA
Prepared By:
Software Group,
Nexteer Automotive,
Saginaw, MI, USA
Change History
| Description | Author | Version | Date | 
| Initial Version | Avinash James | 1.0 | 11/12/2017 | 
| Updated unit test consideration | Avinash James | 2.0 | 12/07/2017 | 
Table of Contents1 Introduction 5
2 FlsMem & High-Level Description 6
3 Design details of software module 7
3.1 Graphical representation of FlsMem 7
4.1 Program (fixed) Constants 8
5.1 User defined typedef definition/declaration 9
5.2 Variable definition for enumerated types 9
6 Software Component Implementation 10
6.1.3.2 Store Module Inputs to Local copies 10
6.1.3.3 (Processing of function)……… 10
6.1.3.4 Store Local copy of outputs into Module Outputs 10
6.4 Module Internal (Local) Functions 11
6.5 GLOBAL Function/Macro Definitions 11
7 Known Limitations with Design 15
Appendix A Abbreviations and Acronyms 17
Introduction
Purpose
Scope
The following definitions are used throughout this document:
- Shall: indicates a mandatory requirement without exception in compliance. 
- Should: indicates a mandatory requirement; exceptions allowed only with documented justification. 
- May: indicates an optional action. 
FlsMem & High-Level Description
See FDD
Design details of software module
Graphical representation of FlsMem

Data Flow Diagram
Component level DFD
See FDD
Function level DFD
See FDD
Constant Data Dictionary
Program (fixed) Constants
Embedded Constants
Local Constants
| Constant Name | Resolution | Units | Value | 
|---|---|---|---|
| CPU1PEID_CNT_U32 | 1 | uint32 | 0x01U | 
| CODFLSTOCRCSPID_CNT_U32 | 1 | uint32 | 0x04U | 
| CRCTOLCLRAMSPID_CNT_U32 | 1 | uint32 | 0x03U | 
| USRMODDIS_CNT_U32 | 1 | uint32 | 0x00U | 
| FLSBLKLEN_CNT_U32 | 1 | uint32 | 0x0003FFFCU | 
| DTSDATALEN_CNT_U32 | 1 | uint32 | 4U | 
| CRCCHKMAXALLWDTI_CNT_U32 | 1 | uint32 | 2000 | 
| MAXNROFDTSCH_CNT_U32 | 1 | uint32 | 32 | 
| TOUTCRCCALCN_CNT_U08 | 1 | uint08 | 0xFFU | 
| READADRCASE0_CNT_U08 | 1 | uint08 | 0 | 
| READADRCASE1_CNT_U08 | 1 | uint08 | 1 | 
| READADRCASE2_CNT_U08 | 1 | uint08 | 2 | 
| READADRCASE3_CNT_U08 | 1 | uint08 | 3 | 
| ERRADRMASK_CNT_U32 | 1 | Uint32 | ((uint32)0x80UL) | 
| NROFADRCHK_CNT_U08 | 1 | uint08 | ((uint8)4U) | 
Variable Data Dictionary
User defined typedef definition/declaration
<This section documents any user types uniquely used for the module.>
| Typedef Name | Element Name | User Defined Type | Legal Range (min) | Legal Range (max) | 
|---|---|---|---|---|
| FlsCrcCfgBlkRec | CrcFlsBlkStrtAdr | uint32 | 0 | 0xFFFFFFFFH | 
| CrcFlsBlkLen | uint32 | 0 | 0xFFFFFFFFH | |
| PreCalcnCrcFlsAdr | uint32 | 0 | 0xFFFFFFFFH | 
Variable definition for enumerated types
| Enum Name | Element Name | Value | 
|---|---|---|
| <(Name given for the user defined typdef of type struct/union) (Variable name qualified in refer[2])> | <(Variable name qualified Refer[2])> | <Define the value > | 
Software Component Implementation
Sub-Module Functions
Init: FlsMemInit1
Design Rationale
Function to return the application region CRC to Diag Manager
Module Outputs
None
Init: FlsMemInit2
Design Rationale
The FlsMemInit2 function is a non RTE function which shall be called to set up the DTS configuration for the Flash CRC check. The DTS channel configuration has to be applied only when the system is waking up from a Power On Reset or after a flash programming reset. In such a scenario a Hardware CRC unit is allocated by function call to the CRC module and once a hardware assignment is successful, the DTS channels are configured for chaining for the entire definition of the flash blocks (Boot, App, Cal1, Cal2 etc.). Record the time when the DTS transfer is initiated so that a check on a timeout can be made in the periodic function where a maximum timeout of 200 ms is checked for
This function shall be called in the startup sequence. Hence it is a non RTE function
See FDD for more.
Module Outputs
None
None
Per: FlsMemPer1
Design Rationale
See FDD
Store Module Inputs to Local copies
Refer to FDD
(Processing of function)………
Refer to FDD
Store Local copy of outputs into Module Outputs
Refer to FDD
Server Runnables - CodFlsSngBitEcc
Design Rationale
See FDD
Store Module Inputs to Local copies
Refer to FDD
(Processing of function)………
Refer to FDD
Store Local copy of outputs into Module Outputs
Refer to FDD
Interrupt Functions
None
Module Internal (Local) Functions
Local Function #1
| Function Name | (Exact name used) | Type | Min | Max | 
| Arguments Passed | None | <Refer MDD guidelines[1]> | <Refer MDD guidelines[1]> | <Refer MDD guidelines[1]> | 
| Return Value | 
Design Rationale
Processing
GLOBAL Function/Macro Definitions
DtsInin
| Function Name | DTSInit | Type | Min | Max | 
| Arguments Passed | CrcHwIdxInReg | uint32 | 0 | 0xFFFFFFFF | 
| CrcHwIdxOutReg | uint32 | 0 | 0xFFFFFFFF | |
| Return Value | None | 
Design Rationale
Trusted function that performs all register initialization from the CM102B_FlsMem_DTSPeripheralCfg.xlsx spreadsheet in the FDD. The DTSMstrCfg channel master registers can be written only in supervisor mode. After the Channel master register for a given channel has been written, the selected Processor Element can write to that channel’s registers. However, for simplicity, all DTS register initialization and chaining is being done in one trusted function.
The chaining is done in the following manner
- Consider the first flash region to have the CRC calculated 
- Calculate the number of DTS chains required for the length of the CRC region. Each DTS channel can address up to a maximum of 0x3FFFC bytes of data (0xFFFF maximum transfer count multiplied by 4 bytes of data in each transfer). 
Hence number of channel is equal to Region length/0x3FFFC + {1} if (Region length % 0x3FFFC is non zero)
- Clear the DTS Transfer flag to make sure no pending requests are present for all the used channels 
- Configure the DTS channels starting from 0 using the configuration defined as per CM102B_FlsMem_DTSPeripheralCfg.xlsx for the above calculated number of chains 
- Configure the next DTS channel to transfer the CRC result from CRC HW output register to Per Instance Memory 
- Configure the next DTS channel to transfer zero value to the CRC HW output register to clear the output register to continue with next flash region operation 
- Repeat Step 1 thru 5 for all the flash regions(Boot, App, Cal1, Cal2 etc) The definition of the flash region is in the generated file CDD_FlsMem_Cfg.c which takes inputs defined in the Vector configurator Tool 
- Disable chaining on the last channel 
- Enable the Interrupt on the second last channel 
- Clear the interrupt status register which shall be monitored in the periodic 
- Start the DTS transfer 
Processing
DtsClnUp
| Function Name | DTSClnUp | Type | Min | Max | 
| Arguments Passed | None | |||
| Return Value | None | 
Design Rationale
None
Processing
None
Known Limitations with Design
We have made use of a static constant global variable (static const uint32 CrcClrData_M = 0U) for the purpose of clearing the CRC hardware as mentioned in the FDD in the function FlsMemInit2.
Also the result array (HwCrcCalcdRes_C[8]) has been also declared as a global array for the purpose of DTS write access in the Dma Write MemMap memory map section
There is a polyspace warning which exist showing the array DTSMstrCfg could go out of bounds. However, we have considered the fact that we wouldn’t need more than 32 channels of DTS registers and hence this is not a functional problem .
UNIT TEST CONSIDERATION
Register file definitions are in the P1Xc/include folder of AR202A since this component is designed for P1X-c micro.
Abbreviations and Acronyms
| Abbreviation or Acronym | Description | 
|---|---|
Glossary
Note: Terms and definitions from the source “Nexteer Automotive” take precedence over all other definitions of the same term. Terms and definitions from the source “Nexteer Automotive” are formulated from multiple sources, including the following:
- ISO 9000 
- ISO/IEC 12207 
- ISO/IEC 15504 
- Automotive SPICE® Process Reference Model (PRM) 
- Automotive SPICE® Process Assessment Model (PAM) 
- ISO/IEC 15288 
- ISO 26262 
- IEEE Standards 
- SWEBOK 
- PMBOK 
- Existing Nexteer Automotive documentation 
| Term | Definition | Source | 
|---|---|---|
| MDD | Module Design Document | |
| DFD | Data Flow Diagram | 
References
| Ref. # | Title | Version | 
|---|---|---|
| 1 | AUTOSAR Specification of Memory Mapping (Link:AUTOSAR_SWS_MemoryMapping.pdf) | v1.3.0 R4.0 Rev 2 | 
| 2 | MDD Guideline | EA4 01.00.00 | 
| 3 | Software Naming Conventions.doc | 1.0 | 
| 4 | Software Design and Coding Standards.doc | 2.1 | 
| 5 | CM102B_FlsMem_Design | See Synergy Sub project version | 
3 - FlsMem Peer Review Checklists
Overview
Summary SheetSynergy Project
Source Code-CDD_FlsMemNonRte.c
Source Code-CDD_FlsMem_Cfg.c
Source Code-CDD_FlsMem.c
PolySpace
Sheet 1: Summary Sheet

Sheet 2: Synergy Project
| Rev 2.00 | 29-Nov-17 | |||||||||||||||||||||||
| Peer Review Meeting Log (Component Synergy Project Review) | ||||||||||||||||||||||||
| Quality Check Items: | ||||||||||||||||||||||||
| Rationale is required for all answers of No | ||||||||||||||||||||||||
| New baseline version name from Summary Sheet follows | Yes | Comments: | ||||||||||||||||||||||
| naming convention | ||||||||||||||||||||||||
| Project contains necessary subprojects | Yes | Comments: | ||||||||||||||||||||||
| Project contains the correct version of subprojects | Yes | Comments: | ||||||||||||||||||||||
| Design subproject is correct version | Yes | Comments: | ||||||||||||||||||||||
| .gpj file in tools folder matches .gpj generated by TL109 script | Yes | Comments: | ||||||||||||||||||||||
| File/folder structure is correct per documentation in | Yes | Comments: | ||||||||||||||||||||||
| TL109A_SwcSuprt | ||||||||||||||||||||||||
| General Notes / Comments: | ||||||||||||||||||||||||
| Review Board: | ||||||||||||||||||||||||
| Change Owner: | Avinash James | Review Date : | 12/08/17 | |||||||||||||||||||||
| Lead Peer Reviewer: | Shruthi R | Approved by Reviewer(s): | ||||||||||||||||||||||
| Other Reviewer(s): | Xin Liu | |||||||||||||||||||||||
| Rationale/justification for items marked "No" approved by: | ||||||||||||||||||||||||


