4.3. FLS Module

4.3.1. Acronyms and Definitions

Abbreviation/Term

Explanation

AUTOSAR

Automotive Open System Architecture

RTE

Runtime Environment

BSW

Basic Software

MCAL

Micro Controller Abstraction Layer

MCU

Micro Controller Unit

API

Application Programming Interface

DET

Default Error Tracer

HW

Hardware

SW

Software

FLS

Flash Driver

MCU

Micro Controller Unit

OS

Operating System

4.3.2. Introduction

This document describes MCAL FLS Driver functionality and configuration details as per AUTOSAR version 4.3.1 .

Supported AUTOSAR Release

4.3.1

Supported Configuration Variants

Pre-Compile, Post-build

Vendor ID

FLS_VENDOR_ID (44)

Module ID

FLS_MODULE_ID (92)

The Flash Driver provides services for reading, writing, erasing memory and and a configuration interface for setting / resetting the write / erase protection of internal data flash.

  • Perform storage mode applications:

    • Read from flash.

    • Write to flash.

    • Erase flash.

    • Compare and Blank Check flash memory location.

FLS in AUTOSAR architecture

Fig. 4.8 FLS in AUTOSAR architecture

4.3.3. Functional Overview

The Flash Driver provides services for reading, writing, erasing the internal data flash memory on F29x device.

The Flash driver updates the wait states based on the MCU system cycle, and enable the sector protection. Before each flash write and erase, the driver grabs the flash semaphore, and release it after the job is done or failed.

The Fls_Erase, FLs_Write, Fls_Read, FLs_Compare, and Fls_BlankCheck are performed asynchronously within the FLS module’s main function. All others (Fls_Cancel, Fls_GetStatus, Fls_GetJobResult) are the synchronous functions of this module.

4.3.4. Hardware Features

4.3.4.1. Hardware Features Supported

The features of data flash include:

  1. One dedicated data Flash bank housed in Flash Controller 1 (FLC1), optimized for data bus read accesses

  2. The Flash Controller can program or erase a Data Flash bank while simultaneously reading from the other Program Flash banks

  3. Tight integration with the Safety and Security Unit (SSU) for security management and access control for Flash program, erase and read operations

  4. 128-bit-wide Flash programming, with configurable programming options

  5. Multiple sectors, with the ability to erase individual/specific sectors while leaving others programmed

  6. Code prefetch, block cache and data cache mechanisms for enhanced read performance for program code and data

  7. Configurable wait states to achieve the best performance at a given clock frequency

  8. Safety Features

    • ECC error detection in address bits, with reporting to the Error Signaling Module (ESM)

    • Supports ECC bits for single error correction and double error detection (SECDED)

  9. Integrated Flash program and erase state machines in the Flash Controller modules:

    • Simple Flash API algorithms

    • Fast erase and program times (refer to the device data manual for details)

  10. Automatic arbitration of data accesses between multiple initiators (CPUs, HSM, RTDMA and debugger accesses)

4.3.4.1.1. Hardware Features Not Supported

None

4.3.4.2. Non compliance

Below AUTOSAR requirements are not supported for Mcu Driver :
SWS_Fls_00155 : The function Fls_SetMode shall set the FLS module’s operation mode to the given “Mode” parameter.

Rejection Reason : No SPI interface/ No external flash

SWS_Fls_00156 : If development error detection for the module Fls is enabled: the function Fls_SetMode shall check that the FLS module is currently not busy. If this check fails, the function Fls_SetMode shall reject the set mode request and raise the development error code FLS_E_BUSY.

Rejection Reason : No SPI interface/ No external flash

SWS_Fls_00187 : The function Fls_SetMode shall be pre-compile time configurable On/Off by the configuration parameter FlsSetModeApi.

Rejection Reason : No SPI interface/ No external flash

4.3.5. Source files

Static source C Files are defined below

📦f29h85x_mcal
┣ 📂build
┣ 📂docs
┣ 📂drivers
┃ ┣ 📂BSW_Stubs
┃ ┣ 📂Can
┃ ┣ 📂Cdd_Adc
┃ ┣ 📂Cdd_Sent
┃ ┣ 📂Cdd_Xbar
┃ ┣ 📂Dio
┃ ┣ 📂Fls
┃ ┃ ┣ 📂include
┃ ┃ ┃ ┣ 📜Fls.h : Contains the APIs of the FLS driver to be used by upper layers.
┃ ┃ ┃ ┣ 📜Fls_Ctrl.h : Contains internal function declarations.
┃ ┃ ┃ ┗ 📜Fls_Priv.h : Contains the private function declarations.
┃ ┃ ┣ 📂src
┃ ┃ ┃ ┣ 📜Fls.c : Contains the implementation of the API’s for Fls driver.
┃ ┃ ┃ ┣ 📜Fls_Priv.c : Contains private function definitions which will interact with Flash APIs.
┃ ┃ ┃ ┗ 📜Fls_Ac.c : Contains internal functions definitions which will directly interact with hardware registers.
┃ ┃ ┗ 📜CMakeLists.txt
┃ ┣ 📂Gpt
┃ ┣ 📂hw_include
┃ ┣ 📂Lin
┃ ┣ 📂Mcal_Lib
┃ ┣ 📂Mcu
┃ ┣ 📂Port
┃ ┣ 📂Spi
┃ ┣ 📂Wdg
┣ 📂examples
┣ 📂plugins
┣ 📂CMakeLists.txt
┗ 📜CMakePresets.json

Plugin files are defined below in the table.

Plugin Files

Description

Fls_Cfg.h

Contains the Precompile switches

Fls_PBcfg.c

Contains all Post-Build Configured parameters

Fls_Cfg.c

Contains all Pre-Compile Configured parameters

FLS header file include structure

Fig. 4.9 FLS header file include structure

4.3.6. Module requirements

4.3.6.1. Memory Mapping

Memory Mapping Sections

Compiler Abstraction Definitions

FLS_CODE

FLS_VAR_NO_INIT

FLS_CFG

FLS_START_SEC_VAR_NO_INIT_UNSPECIFIED (.data)

x

FLS_STOP_SEC_VAR_NO_INIT_UNSPECIFIED

x

FLS_START_SEC_CODE (.text)

x

FLS_STOP_SEC_CODE

x

FLS_START_SEC_CONFIG_DATA (.data)

x

FLS_STOP_SEC_CONFIG_DATA

x

4.3.6.2. Scheduling

Schedule Function API

Description

Fls_MainFunction

This function shall perform the processing of the flash read, write, erase, blank check and compare jobs.

4.3.6.3. Error handling

4.3.6.3.1. Development Error Reporting

The Fls Driver will report development errors on enabling FLS_DEV_ERROR_DETECT == STD_ON in Fls_Cfg.h.

The errors reported to DET module are described in the following table:

Type of Error

Related Error code

Value (Hex)

API service called with wrong parameter

FLS_E_PARAM_CONFIG

0x01

API service called with wrong parameter

FLS_E_PARAM_ADDRESS

0x02

API service called with wrong parameter

FLS_E_PARAM_LENGTH

0x03

API service called with wrong parameter

FLS_E_PARAM_DATA

0x04

API service used without module initialization

FLS_E_UNINIT

0x05

API called when module is busy

FLS_E_BUSY

0x06

API called with a Null Pointer

FLS_E_PARAM_POINTER

0x0A

API called with a mismatch in erase type and length provided

FLS_E_PARAM_ALIGNMENT

0x0C

The run time errors reported to DET module are described in the following table:

Type of Error

Related Error code

Value (Hex)

Erase verification (blank check) failed

FLS_E_VERIFY_ERASE_FAILED

0x07

Write verification (compare) failed

FLS_E_VERIFY_WRITE_FAILED

0x08

Timeout supervision (flash erase/write timeout check with published max times)

FLS_E_TIMEOUT

0x09

AUTOSAR requires that API functions check the validity of their parameters. The check in the below table shows the various Development Error Reporting: Assignment of checks to services are internal parameter checks of the API functions. These checks are for development error reporting and can be enabled or disabled. The following table shows which parameter checks are performed on which services:

4.3.6.4. Error Code

Check Services

FLS_E_PARAM_CONFIG

FLS_E_PARAM_ADDRESS

FLS_E_PARAM_LENGTH

FLS_E_PARAM_DATA

FLS_E_UNINIT

FLS_E_BUSY

FLS_E_PARAM_POINTER

Fls_Init

x

x

Fls_Erase

x

x

x

x

Fls_Read

x

x

x

x

x

Fls_Write

x

x

x

x

x

Fls_Compare

x

x

x

x

x

Fls_BlankCheck

x

x

x

x

Fls_GetJobResult

x

Fls_GetVersionInfo

x

Fls_MainFunction

x

Fls_Cancel

x

4.3.7. Used resources

4.3.7.1. Interrupt Handling

There is no hardware interrupt in Fls.

4.3.7.2. Instance support

CPU instances

supported

CPU 1

YES

CPU 2

NO

CPU 3

NO

4.3.7.3. Hardware-Software Mapping

Below image shows Fls driver Hardware-Software mapping. For more information related to HW/SW mapping, refer the F29 Reference Manual.

Fls HW/SW Mapping

Fig. 4.10 Fls HW/SW Mapping

4.3.8. Integration description

4.3.8.1. Dependent modules

4.3.8.1.1. DEM

FLS Production errors are reported to DEM ( Diagnostic Event Manager ) Module. The Fls module reports production errors to the Diagnostic Event Manager.

4.3.8.1.2. MCU

The hardware of the internal Fls hardware unit depends on the system clock, pre-scaler(s) and PLL. The FLS driver module will not take care of setting the registers that configure the clock, pre-scaler(s) and PLL (e.g. switching on/off the PLL) in its init functions. The MCU module must do this.

4.3.8.1.3. OS

The FLS driver uses timer and therefore there is a dependency on the OS, which configures the timer.

4.3.8.1.4. SchM

If multiple AUTOSAR runnables have access to the same Data Store Memory block, the exported AUTOSAR specification enforces data consistency by using an AUTOSAR exclusive area. With this specification, the runnables have mutually exclusive access to the per-instance memory global data, which prevents data corruption. Beside the OS, the BSW Scheduler provides functions that FLS module calls at begin and end of critical sections. This implementation requires 1 level of exclusive access to guard critical sections.

The data consistency mechanism that has to be applied to an ExclusiveArea might be domain, ECU or even project specific. The decision which mechanism has to be applied by RTE / Basic Software Scheduler is taken during ECU integration by setting the Exclusive Area configuration parameter RteExclusiveAreaImplMechanism. This parameter is an input for RTE generator. For LIN Module, data consistency and exclusive access to critical sections are required for the following sections as shown in the table below:

Exclusive Area Functions used

FLS Function calling Exclusive Area

Need for Exclusive Area

Recommended Exclusive Area Mapping

FLS_EXCLUSIVE_AREA_0

Fls_Erase
Fls_Write

To protect against multiple access for shared resources

OS_RESOURCE : If the FLS APIs are only called from pre-emptible task context, its recommended to use this mechanism as it takes care of resource access protection and task priority management.
None: If FLS APIs are only called from non pre-emptible task context or during init, its recommended to use this mechanism as multiple access protection to shared resource is not needed.

4.3.8.1.5. MemIf

This implementation depends on MemIf module and uses its imported types such as MemIf_JobResultType, MemIf_ModeType and MemIf_StatusType.

4.3.8.1.6. Fee

This implementation depends on Fee module for callback notification to notify the module environment about job end and job error.

4.3.8.1.7. DET

The module FLS depends on the DET (by default) in order to report development errors. Detection and reporting of development errors can be enabled or disabled by the switch FLS_DEV_ERROR_DETECT = STD_ON in the Fls_Cfg.h

In development mode, the Fls module reports development error through the Det_ReportError function of module DET.

The following table represents the service IDs:

Service ID

Code

Service

FLS_SID_INIT

0x00

Fls_Init

FLS_SID_ERASE

0x01

Fls_Erase

FLS_SID_WRITE

0x02

FLS_Write()

FLS_SID_CANCEL

0x03

FLS_Cancel()

FLS_SID_GET_STATUS

0x04

FLS_GetStatus()

FLS_SID_GET_JOB_RESULT

0x05

Fls_GetJobResult()

FLS_SID_READ

0x07

FLS_Read()

FLS_SID_COMPARE

0x08

FLS_Compare()

FLS_SID_GET_VERSION_INFO

0x10

Fls_GetVersionInfo()

FLS_SID_BLANK_CHECK

0x0A

FLS_BlankCheck()

FLS_SID_MAIN_FUNCTION

0x06

FLS_MainFunction()

4.3.9. Configuration

The Fls can be configured as Post-Build or Pre-Compile variant, using EB tresos tool.

Variants

Configured Files

PostBuild

Fls_PBcfg.c , Fls_Cfg.h

Pre-Compile

Fls_Cfg.c , Fls_Cfg.h

The generated configuration files should not be modified manually. The config tool Elektrobit Tresos should be used to modify the configuration files.

4.3.9.1. Migration Guide to v02.00.00 from v01.01.00 or any older versions

In version v02.00.00, the name of the generated configuration structure used to initialize the module has been changed to comply with AUTOSAR requirement TPS_ECUC_08011. In case of Post build variant, upper modules that call the Fls_Init function will need to use the new configuration structure name. For example:

/* Old code (v01.01.00 or any older versions) */
Fls_Init(&Fls_FlsConfigSet);

/* New code (v02.00.00) */
Fls_Init(&Fls_Config);

This change ensures compliance with AUTOSAR naming conventions.

To successfully migrate to v02.00.00, update any upper module that references the configuration structures to use the new structure name.

4.3.9.2. FlsConfigSet

Container for runtime configuration parameters of the flash driver.

4.3.9.2.1. FlsAcErase

Item

Name

FlsAcErase

Description

Address offset in RAM to which the erase flash access code shall be loaded.

Origin

AUTOSAR_ECUC

Post-Build-Variant-Value

true

Value-Configuration-Class

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

100

Max-value

4294967295

Min-value

0

4.3.9.2.2. FlsAcWrite

Item

Name

FlsAcWrite

Description

Address offset in RAM to which the write flash access code shall be loaded.

Origin

AUTOSAR_ECUC

Post-Build-Variant-Value

true

Value-Configuration-Class

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

16

Max-value

4294967295

Min-value

0

4.3.9.2.3. FlsCallCycle

Item

Name

FlsCallCycle

Description

Cycle time of calls of the flash driver’s main function (in seconds).

Origin

AUTOSAR_ECUC

Post-Build-Variant-Value

true

Value-Configuration-Class

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

0.01

Max-value

100.0

Min-value

0.0

4.3.9.2.4. FlsDefaultMode

Item

Name

FlsDefaultMode

Description

This parameter is the default FLS device mode after initialization.

Origin

AUTOSAR_ECUC

Post-Build-Variant-Value

true

Value-Configuration-Class

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

MEMIF_MODE_SLOW

Range

MEMIF_MODE_FAST
MEMIF_MODE_SLOW

4.3.9.2.5. FlsJobEndNotification

Item

Name

FlsJobEndNotification

Description

Mapped to the job end notification routine provided by some upper layer module, typically the Fee module.

Multiplicity-Configuration-Class

Post-Build Time

VARIANT-POST-BUILD

Pre-Compile Time

VARIANT-PRE-COMPILE

Origin

AUTOSAR_ECUC

Post-build-variant-multiplicity

true

Post-Build-Variant-Value

true

Value-Configuration-Class

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

NULL_PTR

4.3.9.2.6. FlsJobErrorNotification

Item

Name

FlsJobErrorNotification

Description

Mapped to the job error notification routine provided by some upper layer module, typically the Fee module.

Multiplicity-Configuration-Class

Post-Build Time

VARIANT-POST-BUILD

Pre-Compile Time

VARIANT-PRE-COMPILE

Origin

AUTOSAR_ECUC

Post-build-variant-multiplicity

true

Post-Build-Variant-Value

true

Value-Configuration-Class

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

NULL_PTR

4.3.9.2.7. FlsMaxReadFastMode

Item

Name

FlsMaxReadFastMode

Description

The maximum number of bytes to read or compare in one cycle of the flash driver’s job processing function in fast mode.

Origin

AUTOSAR_ECUC

Post-Build-Variant-Value

true

Value-Configuration-Class

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

16

Max-value

4294967295

Min-value

0

4.3.9.2.8. FlsMaxWriteFastMode

Item

Name

FlsMaxWriteFastMode

Description

The maximum number of bytes to read or compare in one cycle of the flash driver’s job processing function in fast mode.

Origin

AUTOSAR_ECUC

Post-Build-Variant-Value

true

Value-Configuration-Class

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

16

Max-value

4294967295

Min-value

0

4.3.9.2.9. FlsMaxReadNormalMode

Item

Name

FlsMaxReadNormalMode

Description

The maximum number of bytes to read or compare in one cycle of the flash driver’s job processing function in normal mode.

Origin

AUTOSAR_ECUC

Post-Build-Variant-Value

true

Value-Configuration-Class

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

16

Max-value

4294967295

Min-value

0

4.3.9.2.10. FlsMaxWriteNormalMode

Item

Name

FlsMaxWriteNormalMode

Description

The maximum number of bytes to write in one cycle of the flash driver’s job processing function in normal mode. It must be 8 bytes or 16 bytes

Origin

AUTOSAR_ECUC

Post-Build-Variant-Value

true

Value-Configuration-Class

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

16

Max-value

16

Min-value

8

4.3.9.2.11. FlsProtection

Item

Name

FlsProtection

Description

Erase/write protection settings. Only relevant if supported by hardware. Currently, not supported by Hardware.

Origin

AUTOSAR_ECUC

Post-Build-Variant-Value

true

Value-Configuration-Class

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

0

Max-value

4294967295

Min-value

0

4.3.9.2.12. Fls_CMDWEPROTA

Item

Name

Fls_CMDWEPROTA

Description

Erase/write protection settings. CMDWEPROTA controls program/erase protection for first 32 sectors. Each bit allows users to enable/disable protection for each sector. Eg: Bit 0 allows protection configuration for Sectors 0. A value of 0 disables protection and a value of 1 enables protection from program/erase

Origin

Texas Instruments

Post-Build-Variant-Value

true

Value-Configuration-Class

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

0

Max-value

4294967295

Min-value

0

4.3.9.2.13. Fls_CMDWEPROTB

Item

Name

Fls_CMDWEPROTB

Description

Erase/write protection settings. CMDWEPROTB controls program/erase protection for sectors 32 to 255. Each bit allows users to enable/disable protection for a group of eight sectors. Note - The first 4 bit fields are reserved (bits 0-3) and protection of bit 4 and above would begin at sector 32. Eg: Bit 4 allows protection configuration for Sectors 32-39. A value of 0 disables protection and a value of 1 enables protection from program/erase

Origin

Texas Instruments

Post-Build-Variant-Value

true

Value-Configuration-Class

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

0

Max-value

4294967295

Min-value

0

4.3.9.2.14. FlsExternalDriver

This container is present for external Flash drivers only. Internal Flash drivers do not use the parameter listed in this container, hence its multiplicity is 0 for internal drivers. Currently, not supported as only internal flash is present.

4.3.9.2.14.1. FlsSpiReference

Item

Name

FlsSpiReference

Description

Reference to SPI sequence (required for external Flash drivers).

Multiplicity-Configuration-Class

Post-Build Time

VARIANT-POST-BUILD

Pre-Compile Time

VARIANT-PRE-COMPILE

Origin

AUTOSAR_ECUC

Post-build-variant-multiplicity

false

Post-Build-Variant-Value

false

Value-Configuration-Class

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

4.3.9.2.15. FlsSectorList

List of flashable sectors and pages.

4.3.9.2.16. FlsSector

Configuration description of a flashable sector

4.3.9.2.16.1. FlsNumberOfSectors

Item

Name

FlsNumberOfSectors

Description

Number of continuous sectors with identical values for FlsSectorSize and

Origin

AUTOSAR_ECUC

Post-Build-Variant-Value

false

Value-Configuration-Class

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

1

Max-value

65535

Min-value

0

4.3.9.2.16.2. FlsPageSize

Item

Name

FlsPageSize

Description

Size of one page of this sector.

Origin

AUTOSAR_ECUC

Post-Build-Variant-Value

false

Value-Configuration-Class

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

256

Max-value

4294967295

Min-value

0

4.3.9.2.16.3. FlsSectorSize

Item

Name

FlsSectorSize

Description

Size of this sector.

Origin

AUTOSAR_ECUC

Post-Build-Variant-Value

false

Value-Configuration-Class

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

2048

Max-value

4294967295

Min-value

0

4.3.9.2.16.4. FlsSectorStartaddress

Item

Name

FlsSectorStartaddress

Description

Start address of this sector.

Origin

AUTOSAR_ECUC

Post-Build-Variant-Value

false

Value-Configuration-Class

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

0

Max-value

4294967295

Min-value

0

4.3.9.3. FlsGeneral

Container for general parameters of the flash driver. These parameters are always pre-compile.

4.3.9.3.1. FlsDeviceVariant

Item

Name

FlsDeviceVariant

Description

Select required Device Variant.

Origin

Texas Instruments

Post-Build-Variant-Value

false

Value-Configuration-Class

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

F29H85x

Range

F29H85x

4.3.9.3.2. FlsAcLoadOnJobStart

Item

Name

FlsAcLoadOnJobStart

Description

The flash driver shall load the flash access code to RAM whenever an erase or write job is started and unload (overwrite) it after that job has been finished or canceled.

Origin

AUTOSAR_ECUC

Post-Build-Variant-Value

false

Value-Configuration-Class

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

false

4.3.9.3.3. FlsBaseAddress

Item

Name

FlsBaseAddress

Description

The flash memory start address (see also SWS_Fls_00208 and SWS_Fls_00209).

Origin

AUTOSAR_ECUC

Post-Build-Variant-Value

false

Value-Configuration-Class

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

281018368

Max-value

4294967295

Min-value

0

4.3.9.3.4. FlsTotalSize

Item

Name

FlsTotalSize

Description

The total amount of flash memory in bytes (see also SWS_Fls_00208 and SWS_Fls_00209).

Origin

AUTOSAR_ECUC

Post-Build-Variant-Value

false

Value-Configuration-Class

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

262144

Max-value

4294967295

Min-value

0

4.3.9.3.5. FlsNumBanks

Item

Name

FlsNumBanks

Description

The number of banks present in the current device.

Origin

Texas Instruments

Post-Build-Variant-Value

false

Value-Configuration-Class

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

1

Max-value

4294967295

Min-value

0

4.3.9.3.6. FlsSectorSizeInBytes

Item

Name

FlsSectorSizeInBytes

Description

The flash memory’s sector size in bytes.

Origin

Texas Instruments

Post-Build-Variant-Value

false

Value-Configuration-Class

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

2048

Max-value

4294967295

Min-value

0

4.3.9.3.7. FlsBlankCheckApi

Item

Name

FlsBlankCheckApi

Description

Compile switch to enable/disable the Fls_BlankCheck function.

Origin

AUTOSAR_ECUC

Post-Build-Variant-Value

false

Value-Configuration-Class

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

false

4.3.9.3.8. FlsCancelApi

Item

Name

FlsCancelApi

Description

Compile switch to enable and disable the Fls_Cancel function.

Origin

AUTOSAR_ECUC

Post-Build-Variant-Value

false

Value-Configuration-Class

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

true

4.3.9.3.9. FlsCompareApi

Item

Name

FlsCompareApi

Description

Compile switch to enable and disable the Fls_Compare function.

Origin

AUTOSAR_ECUC

Post-Build-Variant-Value

false

Value-Configuration-Class

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

false

4.3.9.3.10. FlsDevErrorDetect

Item

Name

FlsDevErrorDetect

Description

Switches the development error detection and notification on or off.

Origin

AUTOSAR_ECUC

Post-Build-Variant-Value

false

Value-Configuration-Class

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

true

4.3.9.3.11. FlsDriverIndex

Item

Name

FlsDriverIndex

Description

Index of the driver, used by FEE.

Origin

AUTOSAR_ECUC

Post-Build-Variant-Value

false

Value-Configuration-Class

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

0

Max-value

254

Min-value

0

4.3.9.3.12. FlsEraseVerificationEnabled

Item

Name

FlsEraseVerificationEnabled

Description

Compile switch to enable erase verification.

Origin

AUTOSAR_ECUC

Post-Build-Variant-Value

false

Value-Configuration-Class

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

false

4.3.9.3.13. FlsGetJobResultApi

Item

Name

FlsGetJobResultApi

Description

Compile switch to enable and disable the Fls_GetJobResult function.

Origin

AUTOSAR_ECUC

Post-Build-Variant-Value

false

Value-Configuration-Class

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

true

4.3.9.3.14. FlsGetStatusApi

Item

Name

FlsGetStatusApi

Description

Compile switch to enable and disable the Fls_GetStatus function.

Origin

AUTOSAR_ECUC

Post-Build-Variant-Value

false

Value-Configuration-Class

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

true

4.3.9.3.15. FlsSetModeApi

Item

Name

FlsSetModeApi

Description

Compile switch to enable and disable the Fls_SetMode function.

Origin

AUTOSAR_ECUC

Post-Build-Variant-Value

false

Value-Configuration-Class

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

false

4.3.9.3.16. FlsTimeoutSupervisionEnabled

Item

Name

FlsTimeoutSupervisionEnabled

Description

Compile switch to enable timeout supervision.

Origin

AUTOSAR_ECUC

Post-Build-Variant-Value

false

Value-Configuration-Class

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

false

4.3.9.3.17. FlsVersionInfoApi

Item

Name

FlsVersionInfoApi

Description

Pre-processor switch to enable / disable the API to read out the modules version information.

Origin

AUTOSAR_ECUC

Post-Build-Variant-Value

false

Value-Configuration-Class

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

true

4.3.9.3.18. FlsWriteVerificationEnabled

Item

Name

FlsWriteVerificationEnabled

Description

Compile switch to enable write verification.

Origin

AUTOSAR_ECUC

Post-Build-Variant-Value

false

Value-Configuration-Class

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

false

4.3.9.3.19. FlsWaitStates

Item

Name

FlsWaitStates

Description

defines the number of random access wait states. When CPU performs a read access to Flash, data is returned after (RWAIT + 1) SYSCLK cycles.

Origin

Texas Instruments

Post-Build-Variant-Value

false

Value-Configuration-Class

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

3

Max-value

3

Min-value

1

4.3.9.3.20. FlsCpuClockRef

Item

Name

FlsCpuClockRef

Description

Reference to the CPU clock configuration, which is set in the MCU driver configuration

Origin

Texas Instruments

Post-Build-Variant-Value

false

Value-Configuration-Class

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Refer AUTOSAR_SWS_FlashDriver section: 10 Configuration specification for configuration parameters details

4.3.9.4. Steps To Configure Fls Module

  1. Open EB Tresos configurator tool and load Mcu, Os, Dem and Fls modules.

  2. Open Mcu and Dem Module to Configure Clock and Dem Error for Mcu and Fls.

  3. Open FLS module plugin, Select the Config Variant (Pre-compile/Post-Build).

  4. In FLS module plugin configure required parameters.

  5. Save the configuration and generate the configuration.

4.3.9.4.1. Standard Configuration

Standard Parameters

Description

Default Value

Range

Unit

FlsJobEndNotification

Mapped to the job end notification routine provided by some upper layer module, typically the Fee module.

NA

NA

FUNCTION-NAME

FlsJobErrorNotification

Mapped to the job error notification routine provided by some upper layer module, typically the Fee module.

NA

NA

FUNCTION-NAME

FlsMaxReadNormalMode

The maximum number of bytes to read or compare in one cycle of the flash driver’s job processing function in normal mode.

16

0 .. 4294967295

INTEGER

FlsMaxWriteNormalMode

The maximum number of bytes to write in one cycle of the flash driver’s job processing function in normal mode.

16

0 .. 4294967295

INTEGER

FlsNumberOfSectors

Number of continuous sectors with identical configuration

128

0..65535

INTEGER

FlsPageSize

Size of one page of this sector.

NA

0 .. 4294967295

INTEGER

FlsSectorSize

Size of this sector.

2048

0 .. 4294967295

INTEGER

FlsSectorStartaddress

Start address of this sector.

0

0 .. 4294967295

INTEGER

FlsBlankCheckApi

Compile switch to enable/disable the Fls_BlankCheck function.

FALSE

TRUE

FALSE

BOOLEAN

FlsCancelApi

Compile switch to enable and disable the Fls_Cancel function. Cancel API currently not supported.

TRUE

TRUE

FALSE

BOOLEAN

FlsCompareApi

Compile switch to enable and disable the Fls_Compare function.

TRUE

TRUE

FALSE

BOOLEAN

FlsDevErrorDetect

Switches the development error detection and notification on or off.

FALSE

TRUE

FALSE

BOOLEAN

FlsDriverIndex

Index of the driver, used by FEE.

0

0..254

INTEGER

FlsEraseVerificationEnabled

Compile switch to enable erase verification. Currently not supported.

FALSE

TRUE

FALSE

BOOLEAN

FlsGetJobResultApi

Compile switch to enable and disable the Fls_GetJobResult function.

TRUE

TRUE

FALSE

BOOLEAN

FlsGetStatusApi

Compile switch to enable and disable the Fls_GetStatus function.

TRUE

TRUE

FALSE

BOOLEAN

FlsSetModeApi

Compile switch to enable and disable the Fls_SetMode function. Not relevant as only one mode supported.

FALSE

TRUE

FALSE

BOOLEAN

FlsTimeoutSupervisionEnabled

Compile switch to enable timeout supervision. Currently, not supported.

FALSE

TRUE

FALSE

BOOLEAN

FlsUseInterrupts

Job processing triggered by hardware interrupt.

FALSE

TRUE

FALSE

BOOLEAN

FlsVersionInfoApi

Pre-processor switch to enable / disable the API to read out the modules version information.

FALSE

TRUE

FALSE

BOOLEAN

4.3.9.4.2. IP Specific Configuration

Standard Parameters

Description

Default Value

Range

Unit

FlsMemMapMode

This parameter is used to specify if the flash read operation should occur using the external flash memory map.

TRUE

TRUE

FALSE

BOOLEAN

FlsOsCounterRef

This parameter contains a reference to the OsCounter, which is used by the FLS driver.

FlsDefaultOSCounterId

Default Os Counter Id if node reference to OsCounter ref FlsOsCounterRef is not set

0

0..16

INTEGER

FlsDeviceVariant

Select required Device Variant

ENUMERATION

FlsBaseAddress

The flash memory start address (see also SWS_Fls_00208 and SWS_Fls_00209).

3321888768

0..4294967295

INTEGER

FlsTotalSize

The total amount of flash memory in bytes (see also SWS_Fls_00208 and SWS_Fls_00209).

1073741824

0 .. 4294967295

INTEGER

FlsWriteVerificationEnabled

Compile switch to enable write verification. Currenly, not supported.

FALSE

TRUE

FALSE

BOOLEAN

FlsErasedValue

The contents of an erased flash memory cell.

255

0 .. 4294967295

INTEGER

FlsEraseTime

Maximum time to erase one complete flash sector.

1000

0..INFINITY

FLOAT

FlsExpectedHwId

Unique identifier of the hardware device that is expected by this driver (the device for which this driver has been implemented).

23322

STRING

FlsSpecifiedEraseCycles

Number of erase cycles specified for the flash device (usually given in the device data sheet).

0

0..4294967295

INTEGER

FlsWriteTime

Maximum time to program one complete flash page.

1000

0..INFINITY

FLOAT

FlsEnableRegisterReadbackApi

Switch to indicate that the Fls_RegisterReadBack is supported

FALSE

TRUE

FALSE

BOOLEAN

4.3.10. Examples

4.3.10.1. Overview of Fls_App_Example

  • Fls_App_Example

    • Initializes clock using Mcu_Init()

    • Initialize Fls using Fls_Init()

    • Get Fls Version using Fls_GetVersionInfo()

    • Erase flash sector using Fls_Erase()

    • Perform the processing of jobs using Fls_MainFunction()

    • Read the result of the last job using Fls_GetJobResult()

    • Verify, whether a given memory area has been erased but not (yet) programmed using Fls_BlankCheck()

    • Write complete flash sector using Fls_Write()

    • Reads the flash memory using Fls_Read()

    • Check if the write operation was successful by comparing txBuf_test (hardcoded) with the actual data in flash using Fls_Compare()

    • Check if the read operation was successful by comparing rxBuf_test (previously read) with the actual data in flash

4.3.10.2. Setup required to run Fls_App_Example

  • Install Code Composer Studio(CCS) latest version

  • Install latest c29 compiler

  • Connect the hardware and power up

  • Connect the uart set up to check the log on serial console

4.3.10.3. How to run Fls_App_Example

  • Open CCS and Import Fls_App_Example

  • Build project then debug project

4.3.10.3.1. Sample Log of Fls_App_Example

    FLS Example: Sample Application - STARTS !!!
    APP_NAME : Variant - Pre Compile being used !!!
    FLS MCAL version info:1.0.0
    FLS MCAL Module/Driver:92.44 
    FLS_APP: Configured operation on flash is from 0x0 address offset till 4096 bytes!!
    FLS_APP: Perform ERASE, WRITE, READ, BLANKCHECK, CANCEL, COMPARE, etc
    FLS_APP: Sector Erasing 
    FLS_APP: Job Processing in Progress.
    FLS_APP: Job Ends: SUCCESS
    FLS_APP: Job Ends: SUCCESS 
    FLS_APP: Get Job Result Passed, check done through Fls_GetJobResult API()
    FLS_APP: Blank Checking 
    FLS_APP: Job Processing in Progress.
    FLS_APP: Job Ends: SUCCESS
    FLS_APP: Job Ends: SUCCESS 
    FLS_APP: Writing 8-bytes, 16 bytes, 32 bytes, ... 
    FLS_APP: Job Processing in Progress.
    FLS_APP: Job Ends: SUCCESS
    FLS_APP: Job Ends: SUCCESS 

4.3.10.4. File Structure

📦f29h85x_mcal
┣ 📂build
┣ 📂docs
┣ 📂drivers
┣ 📂examples
┃ ┣ 📂AppUtils
┃ ┣ 📂Can
┃ ┣ 📂Cdd_Adc
┃ ┣ 📂Cdd_Sent
┃ ┣ 📂Cdd_Xbar
┃ ┣ 📂DeviceSupport
┃ ┣ 📂Dio
┃ ┣ 📂Fls
┃ ┃ ┗ 📂Fls_App_Example
┃ ┃ ┃ ┣ 📂CCS
┃ ┃ ┃ ┃ ┗ 📜Fls_App_Example.projectspec
┃ ┃ ┃ ┣ 📂Fls_Example_Config
┃ ┃ ┃ ┃ ┣ 📂config
┃ ┃ ┃ ┃ ┃ ┣ 📜Dem.xdm
┃ ┃ ┃ ┃ ┃ ┣ 📜EcuM.xdm
┃ ┃ ┃ ┃ ┃ ┣ 📜fls.xdm: Generated EB Tresos config file in .xdm format
┃ ┃ ┃ ┃ ┃ ┣ 📜Mcu.xdm
┃ ┃ ┃ ┃ ┃ ┣ 📜Os.xdm
┃ ┃ ┃ ┃ ┣ 📂include
┃ ┃ ┃ ┃ ┃ ┣ 📜Dem_Cfg.h
┃ ┃ ┃ ┃ ┃ ┣ 📜EcuM_Cfg.h
┃ ┃ ┃ ┃ ┃ ┣ 📜Fls_Cbk.h : defines callback notification functions.
┃ ┃ ┃ ┃ ┃ ┣ 📜Fls_Cfg.h : Contains the generated pre-compiler configuration header.
┃ ┃ ┃ ┃ ┃ ┣ 📜Mcu_Cfg.h
┃ ┃ ┃ ┃ ┃ ┣ 📜Os_Cfg.h
┃ ┃ ┃ ┃ ┣ 📂src
┃ ┃ ┃ ┃ ┃ ┣ 📜Dem_Cfg.c
┃ ┃ ┃ ┃ ┃ ┣ 📜EcuM_Cfg.c
┃ ┃ ┃ ┃ ┃ ┣ 📜Fls_Cfg.c : Contains the pre-build configuration parameters.
┃ ┃ ┃ ┃ ┃ ┣ 📜Mcu_PBcfg.c
┃ ┃ ┃ ┃ ┃ ┣ 📜Os_Cfg.c
┃ ┃ ┃ ┃ ┗ 📜CMakeLists.txt
┃ ┃ ┃ ┣ 📜CMakeLists.txt
┃ ┃ ┃ ┗ 📜Fls_App_Example.c
┃ ┣ 📂Gpt
┃ ┣ 📂Mcu
┃ ┣ 📂Port
┣ 📂plugins
┣ 📂tests
┣ 📜CMakeLists.txt
┗ 📜CMakePresets.json

4.3.11. References

AUTOSAR_SWS_FlashDriver
Technical Reference Manual