4.14. FLS Module

4.14.1. Acronyms and Definitions

Abbreviation/Term

Explanation

AUTOSAR

Automotive Open System Architecture

BSW

Basic Software

MCAL

Micro Controller Abstraction Layer

API

Application Programming Interface

DET

Default Error Tracer

HW

Hardware

SW

Software

FLS

Flash Driver

DMA

Direct Memory Access

MCU

Micro Controller Unit

OS

Operating System

4.14.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)

Supported Platform

AM263x

The Flash Driver provides services for reading, writing, erasing flash memory for external Flash device.

4.14.3. Functional Overview

4.14.3.1. FLS Driver Architecture

The FLS driver has architecture as shown in below figure from the AUTOSAR specification.

FLS in AUTOSAR architecture

Fig. 4.63 FLS in AUTOSAR architecture

The below figure shows typical connection of the QSPI module to the external quad-SPI flash memory

QSPI connected to an external Quad SPI flash memory

Fig. 4.64 QSPI connected to an external Quad SPI flash memory

4.14.3.2. Initialization

The driver FLS is initialized by calling Fls_Init() function and takes FlsConfigSet as input and Initializes Flash and QSPI. This will also make driver status to IDLE.

4.14.3.3. States

The Fls driver maintains states for:

  1. MEMIF_UNINIT: This is the state when hardware is not initialized.

  2. MEMIF_IDLE: when FLS driver initialized, it will go to IDLE state.

  3. MEMIF_BUSY: In case of any on-going operation i.e., Erase OR read OR write, the state will be maintained as busy until the operation is completed.

  4. MEMIF_BUSY_INTERNAL is not supported.

4.14.3.4. Assumptions

For using DMA feature, driver assumes that cache initialization is done in application only and not done by the driver.

4.14.3.5. Limitations

Only 1S-1S-4S mode is supported for QSPI.

4.14.3.6. Design overview

Please refer SITARA MCU MCAL Architecture Document and AM26x MCAL: FLS Detailed Design Document provided as part of CSP.

4.14.4. Hardware Features

4.14.4.1. AUTOSAR Features supported

  • Only one QSPI instance will support

  • Perform storage mode applications
    1. Read from flash.
    2. Write to flash.
    3. Erase Flash.
    4. Cancel job is supported.
    5. Compare and Blank Check flash memory location.

  • Configure error detection (DET)

  • DMA mode is supported for Flash Read.

  • Only normal mode is supported.

4.14.4.2. Not supported Features

  • Only one instance of Fls module supported at one time.

  • Access To Address beyond 8MB is not supported in MemMap mode.

  • DMA mode is supported only if MemMap mode and Interrupts are enabled.

  • DMA mode not supported for Flash Write and Flash Erase.

  • Relevant features not supported 1. FlsSetModeAPI
    2. FlsDefaultMode
    3. FlsMaxReadFastMode
    4. FlsMaxWriteFastMod
    5. FlsAcLoadOnJobStart
    6. FlsAcErase
    7. FlsAcRead
    8. FlsAcWrite

4.14.4.3. IP specific Features supported

None

4.14.4.4. Non compliance

4.14.4.4.1. Deviations to requirements (Requirement Traceability)

4.14.4.4.1.1. Deviation of requirements against AUTOSAR specification requirements

Will be updated in next release

4.14.5. Source files

Static source C Files are defined below

📦AM263x
┣ 📂build
┣ 📂mcal
┃ ┣ 📂Fls
┃ ┃ ┣ 📂include
┃ ┃ ┃ ┣ 📜Fls.h : Contains the APIs of the FLS driver to be used by upper layers.
┃ ┃ ┃ ┣ 📜Fls_Cbk.h : Contains the callback functions.
┃ ┃ ┃ ┣ 📜Fls_Irq.h : Contains ISR function declarations.
┃ ┃ ┣ 📂src
┃ ┃ ┃ ┣ 📜Fls.c : Contains the pre-complier switches.
┃ ┃ ┃ ┣ 📜Fls_Irq.c : Contains ISR function definitions..
┃ ┃ ┣ 📂V0
┃ ┃ ┃ ┗ 📜Fls_Brd_Nor.h : Contains internal functions and data structures.
┃ ┃ ┃ ┣ 📜Fls_Nor_config.c : CContains device specific function definitions.
┃ ┃ ┃ ┗ 📜Fls_Nor_config.h : Contains device specific configuration parameters.
┃ ┃ ┃ ┣ 📜Fls_Qspi.c : Contains internal functions definitions.
┃ ┃ ┃ ┣ 📜Fls_Qspi.h : Contains internal functions definitions and data structures.
┃ ┃ ┃ ┣ 📜Fls_Qspi_Edma.c : Contains Flash DMA specific internal functions definitions and data structures.
┃ ┃ ┃ ┣ 📜Fls_Qspi_Edma.h : Contains Flash DMA specific internal functions and data structures.
┃ ┃ ┗ 📜Makefile
┃ 📂mcal_config
┃ 📂mcal_docs
┃ 📜README.txt

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.65 FLS header file include structure

4.14.6. Module requirements

Please refer Software Product Specification document provided as part of CSP.

4.14.6.1. Memory Mapping

Memory Mapping Sections

Compiler Abstraction Definitions

FLS_CODE

FLS_CODE_ISR

FLS_VAR_NO_INIT

FLS_CFG

FLS_START_SEC_ISR_CODE (.text)

x

FLS_STOP_SEC_ISR_CODE

x

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.14.6.2. Scheduling

Schedule Function API

Description

Fls_MainFunction

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

4.14.6.3. Error handling

4.14.6.3.1. DET Errors

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 DMA mode on but Interrupt or MemMap mode off

FLS_E_MEMAP_INTERRUPT_OFF_DMA_ON

0x0B

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

AUTOSAR requires that API functions check the validity of their parameters. The check in 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:

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.14.7. Used resources

4.14.7.1. Interrupt Handling

FLS uses Interrupt line R5FSS0_CORE0_INTR_QSPI0_INT (interrupt number 54) and Fls_Hdlr shall be called when the interrupt occurs

Interrupt Number

ISR API Mapped

R5FSS0_CORE0_INTR_QSPI0_INT

Fls_Hdlr

4.14.8. Integration description

4.14.8.1. Dependent modules

4.14.8.1.1. MCU

The Fls Modules expects the MCU modules to enable the QSPI clock through the configuration. Required parameter for clock enabling:

  1. Module ID: MCU_CLKSRC_MODULE_ID_QSPI

  2. Source ID: MCU_CLKSRC_4

  3. Divider value: 4

4.14.8.1.2. PORT

The Fls Modules expects that pinmux is set correctly to configure the Data line, Chip select and Clock pins for QSPI module. This is done by the PORT driver.

4.14.8.1.3. MemIf

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

4.14.8.1.4. Fee

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

4.14.8.1.5. DET

The module FLS depends on the DET (by default) in order to report development errors.

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()

FLS_SID_REGISTERREADBACK

0x0B

Fls_RegisterReadback()

4.14.8.1.6. DEM

FLS modules does not report DEM errors.

4.14.8.1.7. Callback Functions

The FLS driver does not provide any callback functions.

4.14.8.1.8. DMA

Accessing flash memory via DMA controller can avoid intervention of CPU so that the CPU can perform other critical operations. Data transfer through DMA is efficient and faster.

4.14.8.1.9. Main Functions

The function Fls_MainFunction perform the processing of the flash read, write, erase and compare jobs. When a job has been initiated, the FLS module’s environment shall call the function Fls_MainFunction cyclically until the job is finished.

4.14.8.1.10. Fls Set Erase Function

This function is called from example app based on the macros enabled in application itself. Implementation of this function is done to allow user to select one or more erase types based on the requirement. The function Fls_SetEraseType sets the parameters like data size, data_value, erase type(sector/block/chip), “typeoferase” for Fls_DrvObj, based on the erase type parameter passed to this function while calling from example app. These parameters are required in example app.

4.14.8.1.11. Callback Notification

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

4.14.8.1.12. 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 FLS 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_Interrupt_Enable

To protect against multiple access for shared resources

ALL_INTERRUPT_BLOCKING : All interrupts should be blocked as this API’s can be called in the interrupts

4.14.8.2. Multi-core support

Not supported

4.14.9. Configuration

4.14.9.1. FlsConfigSet

Container for runtime configuration parameters of the flash driver.

4.14.9.1.1. FlsAcErase

Item

Name

FlsAcErase

Description

Address offset in RAM to which the erase flash access code shall be loaded. Currenly, Flash Access code Erase/Write functionality is not supported.

Origin

AUTOSAR_ECUC

Post-build-variant-multiplicity

false

Post-Build-Variant-Value

true

Value-Configuration-Class

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Max-value

4294967295

Min-value

0

4.14.9.1.2. FlsAcWrite

Item

Name

FlsAcWrite

Description

Address offset in RAM to which the write flash access code shall be loaded. Currenly, Flash Access code Erase/Write functionality is not supported.

Origin

AUTOSAR_ECUC

Post-build-variant-multiplicity

false

Post-Build-Variant-Value

true

Value-Configuration-Class

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Max-value

4294967295

Min-value

0

4.14.9.1.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-multiplicity

false

Post-Build-Variant-Value

true

Value-Configuration-Class

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

1.0

Max-value

INF

Min-value

0.0

4.14.9.1.4. FlsDefaultMode

Item

Name

FlsDefaultMode

Description

This parameter is the default FLS device mode after initialization. Currently, not supported as different modes are not available is Hardware.

Origin

AUTOSAR_ECUC

Post-build-variant-multiplicity

false

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.14.9.1.5. FlsMemMapMode

Item

Name

FlsMemMapMode

Description

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

Origin

Texas Instruments

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

Default-value

true

4.14.9.1.6. FlsEnableDMA

Item

Name

FlsEnableDMA

Description

This parameter is used to specify if the flash read operation should occur using DMA

Origin

Texas Instruments

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

Default-value

false

4.14.9.1.7. 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

4.14.9.1.8. 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

4.14.9.1.9. 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. Currenly not supported as different modes are not available in hardware.

Origin

AUTOSAR_ECUC

Post-build-variant-multiplicity

false

Post-Build-Variant-Value

true

Value-Configuration-Class

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

768

Max-value

4294967295

Min-value

0

4.14.9.1.10. 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-multiplicity

false

Post-Build-Variant-Value

true

Value-Configuration-Class

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

768

Max-value

4294967295

Min-value

0

4.14.9.1.11. FlsMaxWriteFastMode

Item

Name

FlsMaxWriteFastMode

Description

The maximum number of bytes to write in one cycle of the flash driver’s job processing function in fast mode. Currenly not supported as different modes are not available in hardware.

Origin

AUTOSAR_ECUC

Post-build-variant-multiplicity

false

Post-Build-Variant-Value

true

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.14.9.1.12. 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.

Origin

AUTOSAR_ECUC

Post-build-variant-multiplicity

false

Post-Build-Variant-Value

true

Value-Configuration-Class

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

768

Max-value

4294967295

Min-value

0

4.14.9.1.13. 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-multiplicity

false

Post-Build-Variant-Value

true

Value-Configuration-Class

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Max-value

4294967295

Min-value

0

4.14.9.1.14. FlsBaudRateDiv

Item

Name

FlsBaudRateDiv

Description

To Select the baud rate divider values

Origin

Texas Instruments

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

Max-value

4294967295

Min-value

0

4.14.9.1.15. FlsProtocol

Item

Name

FlsProtocol

Description

This parameter is used to select different modes. FLS_1S_1S_1S mode enables single read using one data line. FLS_1S_1S_2S mode enables dual read using two data lines. FLS_1S_1S_4S mode enables quad read using two data lines.

Origin

Texas Instruments

Post-build-variant-multiplicity

false

Post-Build-Variant-Value

true

Value-Configuration-Class

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

FLS_1S_1S_4S

Range

FLS_1S_1S_1S
FLS_1S_1S_2S
FLS_1S_1S_4S

4.14.9.1.16. FlsHwUnitCddDmaHandler

Item

Name

FlsHwUnitCddDmaHandler

Description

Configures the Cdd Dma handler used for FLS transmission

Multiplicity-Configuration-Class

Post-Build Time

VARIANT-POST-BUILD

Pre-Compile Time

VARIANT-PRE-COMPILE

Origin

Texas Instruments

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.14.9.1.17. 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 one external driver present.

4.14.9.1.17.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.14.9.1.18. FlsSectorList

List of flashable sectors and pages.The maximum number of sectors/sector size/pages/pagesize that can be configured, is based on external flash used, and care must be taken to configure these parameters as per the external flash used

4.14.9.1.19. FlsSector

Configuration description of a flashable sector

4.14.9.1.19.1. FlsNumberOfSectors

Item

Name

FlsNumberOfSectors

Description

Number of continuous sectors with identical configuration

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

Default-value

32

Max-value

65535

Min-value

0

4.14.9.1.19.2. FlsPageSize

Item

Name

FlsPageSize

Description

Size of one page of this sector.

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

Default-value

256

Max-value

4294967295

Min-value

0

4.14.9.1.19.3. FlsSectorSize

Item

Name

FlsSectorSize

Description

Size of this sector.

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

Default-value

4096

Max-value

4294967295

Min-value

0

4.14.9.1.19.4. FlsSectorStartaddress

Item

Name

FlsSectorStartaddress

Description

Start address of this sector.

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

Default-value

0

Max-value

4294967295

Min-value

0

4.14.9.2. FlsGeneral

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

4.14.9.2.1. 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-multiplicity

false

Post-Build-Variant-Value

false

Value-Configuration-Class

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

false

4.14.9.2.2. 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-multiplicity

false

Post-Build-Variant-Value

false

Value-Configuration-Class

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

1610612736

Max-value

4294967295

Min-value

0

4.14.9.2.3. FlsBlankCheckApi

Item

Name

FlsBlankCheckApi

Description

Compile switch to enable/disable the Fls_BlankCheck function.

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

Default-value

false

4.14.9.2.4. FlsCancelApi

Item

Name

FlsCancelApi

Description

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

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.14.9.2.5. FlsCompareApi

Item

Name

FlsCompareApi

Description

Compile switch to enable and disable the Fls_Compare function.

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.14.9.2.6. FlsDevErrorDetect

Item

Name

FlsDevErrorDetect

Description

Switches the development error detection and notification on or off.

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

Default-value

false

4.14.9.2.7. FlsDriverIndex

Item

Name

FlsDriverIndex

Description

Index of the driver, used by FEE.

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

Max-value

254

Min-value

0

4.14.9.2.8. FlsEraseVerificationEnabled

Item

Name

FlsEraseVerificationEnabled

Description

Compile switch to enable erase verification. Currently not supported.

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

Default-value

true

4.14.9.2.9. FlsGetJobResultApi

Item

Name

FlsGetJobResultApi

Description

Compile switch to enable and disable the Fls_GetJobResult function.

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.14.9.2.10. FlsGetStatusApi

Item

Name

FlsGetStatusApi

Description

Compile switch to enable and disable the Fls_GetStatus function.

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.14.9.2.11. FlsSetModeApi

Item

Name

FlsSetModeApi

Description

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

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.14.9.2.12. FlsTimeoutSupervisionEnabled

Item

Name

FlsTimeoutSupervisionEnabled

Description

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

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

Default-value

false

4.14.9.2.13. 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-multiplicity

false

Post-Build-Variant-Value

false

Value-Configuration-Class

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

16777215

Max-value

4294967295

Min-value

0

4.14.9.2.14. FlsUseInterrupts

Item

Name

FlsUseInterrupts

Description

Job processing triggered by hardware interrupt.

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

Default-value

false

4.14.9.2.15. 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-multiplicity

false

Post-Build-Variant-Value

false

Value-Configuration-Class

Post-Build-Time

VARIANT-POST-BUILD

Pre-Compile-Time

VARIANT-PRE-COMPILE

Default-value

false

4.14.9.2.16. FlsWriteVerificationEnabled

Item

Name

FlsWriteVerificationEnabled

Description

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

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

Default-value

true

4.14.9.2.17. FlsQspiCtrlBaseAddr

Item

Name

FlsQspiCtrlBaseAddr

Description

This parameter used to select the QSPI base Address

Origin

Texas Instruments

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

Default-value

1210056704

Max-value

4294967295

Min-value

1

4.14.9.2.18. FlsIrqType

Item

Name

FlsIrqType

Description

Type of Isr function:
void functionname(void)
CAT1 see description in oil tool : interrupt void func(void)
CAT2 see description in oil tool : ISR(func)

Origin

Texas Instruments

Post-build-variant-multiplicity

false

Post-Build-Variant-Value

false

Value-Configuration-Class

Pre-Compile-Time

VARIANT-PRE-COMPILE

Post-Build-Time

VARIANT-POST-BUILD

Default-value

FLS_ISR_CAT1

Range

FLS_ISR_VOID
FLS_ISR_CAT1
FLS_ISR_CAT2

4.14.9.2.19. FlsDefaultOSCounterId

Item

Name

FlsDefaultOSCounterId

Description

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

Origin

Texas Instruments

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

Default-value

0

Max-value

16

Min-value

0

4.14.9.2.20. FlsEnableRegisterReadbackApi

Item

Name

FlsEnableRegisterReadbackApi

Description

Switch to indicate that the Fls_RegisterReadBack is supported

Origin

Texas Instruments

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

Default-value

true

4.14.9.2.21. FlsOsCounterRef

Item

Name

FlsOsCounterRef

Description

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

Origin

Texas Instruments

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.14.9.3. Configuration changes with DMA mode

  1. Flash configuration should include Cdd_Dma in module configurations to use DMA.

FLS Module Configurations

Fig. 4.66 FLS Module Configurations

  1. Flash DMA handler is required for Flash DMA support in DMA configurations and CDD_TRANSFER_MODE_CHAINING should be used in Flash DMA Handler.

FLS Handler in Cdd_Dma configuration

Fig. 4.67 FLS Handler in Cdd_Dma configuration

  1. Flash Dma Handler should have two channels because it uses CDD_TRANSFER_MODE_CHAINING mode.

FLS Handler Channels in Cdd_Dma configuration

Fig. 4.68 FLS Handler Channels in Cdd_Dma configuration

  1. Flash configuration should enable Memmap mode and Interrupt mode to use DMA.

Dma, Memmap in FLS configuration (FlsConfigSet)

Fig. 4.69 Dma, Memmap in FLS configuration (FlsConfigSet)

Interrupt in FLS configuration (FlsGeneral)

Fig. 4.70 Interrupt in FLS configuration (FlsGeneral)

4.14.9.3.1. Program changes with DMA mode

For DMA mode support, DMA TPCC0 Interrupt aggregation (INTR) line number 72 gets used to register ISR (CDD_EDMA_lld_transferCompletionMasterIsrFxn) with EDMA and Cache invalidation on destination buffers should happen using Mcal_CacheP_inv APIs before using Flash DMA support for read.

4.14.10. Examples

4.14.10.1. Overview

  1. Initializes clock using Mcu_Init()

  2. Initialize port using Port_Init()

  3. Initialize Fls using Fls_Init()

  4. Get Fls Version using Fls_GetVersionInfo()

  5. Erase flash sector using Fls_Erase()

  6. Perform the processing of jobs using Fls_MainFunction()

  7. Read the result of the last job using Fls_GetJobResult()

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

  9. Write complete flash pages using Fls_Write()

  10. Reads the flash memory using Fls_Read()

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

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

4.14.10.2. Hardware Software Setup and Tools

None

4.14.10.3. Steps to build and run example

  1. FLS example application demonstrating the MCAL Fls driver features is in folder <MCAL_ROOT>/examples/Fls.

  2. This application can be built from the root folder by giving gmake –s fls_app PLATFORM=am263.

  3. after the build is completed we get a binary file,which is loaded in our controller and executed.

4.14.10.4. Example Logs


      [HSM_CLIENT] New Client Registered with Client Id = 0
      Starting QSPI Bootloader ... 
      [BOOTLOADER_PROFILE] Boot Media       : NOR SPI FLASH 
      [BOOTLOADER_PROFILE] Boot Media Clock : 80.000 MHz 
      [BOOTLOADER_PROFILE] Boot Image Size  : 219 KB 
      [BOOTLOADER_PROFILE] Cores present    : 
      r5f0-0
      [BOOTLOADER PROFILE] System_init                      :        304us 
      [BOOTLOADER PROFILE] Drivers_open                     :         82us 
      [BOOTLOADER PROFILE] LoadHsmRtFw                      :       8768us 
      [BOOTLOADEFLS_APP: Job Ends: SUCCESS 
      FlsApp: Sample Application - STARTS !!!
      FLS CHIP ERASE !!! 
      FLS_APP: Variant - Pre Compile being used !!!
      FLS MCAL version info:9.1.0
      FLS MCAL Module/Driver:92.44 
      FLS_APP: DATA SIZE TEST is 0x10000 
      FLS_APP: Offset is 0x0 
      FLS_APP: Erasing 
      FLS_APP: Erasing full chip..please wait.. 
      FLS_APP: Job Processing in Progress.
      FLS_APP: Job Ends: SUCCESS
      FLS_APP: Blank Checking 
      FLS_APP: Job Processing in Progress.
      FLS_APP: Job Ends: SUCCESS
      FLS_APP: Writing 
      FLS_APP: Job Processing in Progress.
      FLS_APP: Job Ends: SUCCESS
      FLS_APP: Reading 
      FLS_APP: Job Processing in Progress.
      FLS_APP: Job Ends: SUCCESS
      FLS_APP: Write Compare 
      FLS_APP: Job Processing in Progress.
      FLS_APP: Job Ends: SUCCESS
      FLS_APP: Read Compare 
      FLS_APP: Job Processing in Progress.
      FLS_APP: Job Ends: SUCCESS
      FLS_APP: 
      FLS_APP: Job Cancel 
      FLS_APP:         1. Writing 
      FLS_APP:         2. Canceling 
      FLS_APP: Job Canceled (SUCCESS) ! 
      FLS_APP: 
      FLS_APP: 
      FLS_APP: ---------- FLS Sample application Done !! ----------  
      FLS_APP: 
      

4.14.10.5. File Structure

📦AM263x
┣ 📂build
┣ 📂mcal
┃ ┣ 📂examples
┃ ┃ ┣ 📂Fls
┃ ┃ ┃ ┣ 📂soc
┃ ┃ ┃ ┣ 📜FlsApp.c : Contains FLS test example.
┃ ┃ ┃ ┣ 📜Makefile
┃ ┃ ┣ 📂Flsdiag
┃ ┃ ┃ ┣ 📂soc
┃ ┃ ┃ ┣ 📜Fls_DiagApp.c : Contains FLS Diag test example.
┃ ┃ ┃ ┣ 📜Fls_NOR_SFDP.c : Contains SFDP Driver APIs implementation.
┃ ┃ ┃ ┣ 📜Fls_NOR_SFDP.h : Contains SFDP Driver APIs implementation.
┃ ┃ ┃ ┣ 📜Makefile
┃ ┣ 📂examples_config
┃ ┃ ┣ 📂Fls_Demo_Cfg
┃ ┃ ┃ ┣ 📂soc
┃ ┃ ┃ ┃ ┣ 📂am263
┃ ┃ ┃ ┃ ┃ ┣ 📂r5f0_0
┃ ┃ ┃ ┃ ┃ ┃ ┣ 📂include
┃ ┃ ┃ ┃ ┃ ┃ ┃ ┣ 📜Fls_Cfg.h : Contains the Precompile switches, Symbolic names.
┃ ┃ ┃ ┃ ┃ ┃ ┣ 📂src
┃ ┃ ┃ ┃ ┃ ┃ ┃ ┣ 📜Fls_Cfg.c : Contains all Pre-Compile Configured parameters
┃ ┃ ┃ ┃ ┃ ┃ ┃ ┣ 📜Fls_PBcfg.c : Contains all Post-Build Configured parameters
┃ 📂mcal_config
┃ 📂mcal_docs
┣ 📜README.txt

4.14.11. FAQ’s

Q1. What if some flashes also support write enable for non-volatile registers?

Before writing to any register in flash, write enable command is issued to the flash.
The Write enable can be issued to both volatile and non volatile registers depending on 
what the flash supports. Currently the existing flash in the device supports write 
enable to volatile registers. In case any external flash (e.g. S25FL064LABMFB01X) supports 
write enable to both volatile and non volatile registers, the user can issue write enable
command for non volatile registers using Nor_QspiCmdWrite API. User can also update 
the fls_config_sfdp_1.cmdWren parameter in Flash_sfdpParams_init API in V0/Fls_Nor_config.c file by following the flash datasheet.

4.14.12. References

AUTOSAR_SWS_FlashDriver
Technical Reference Manual