HAL FLASH Overview

Introducing FLASH

group FLASH_Introduction

  • This introduction is under development.

Module and files

The following diagram illustrates the FLASH module and its associated files.

Module and files diagram

Component diagram

The following diagram illustrates the software components involved in the FLASH module. It shows the interactions between the user application, HAL drivers, low-level drivers, and the hardware components.



@startuml

<style>

componentDiagram {

   arrow {

      FontSize 8

   }

}

</style>



title FLASH IO Software Component Diagram



package "HAL" {

    [HAL_SERVICE]

    [HAL_FLASH]

}



package "Low Layer" {

    [LL_FLASH]

    [DFP]

    [FLASH IO Interrupt service routine]

}



package "HW" {

    [STM32_HW]

}



[Application] --> [HAL_FLASH] : HAL FLASH IO API

[Application] <-- [HAL_FLASH] : HAL FLASH IO callback



[HAL_FLASH] --> [LL_FLASH] : LL FLASH API

[HAL_FLASH] <-- [FLASH IO Interrupt service routine]

[HAL_FLASH] -l->  [HAL_SERVICE] : HAL_GetTick



[LL_FLASH] -->   [DFP]: FLASH registers definition

[STM32_HW] -u--> [FLASH IO Interrupt service routine] : FLASH_IRQHandler

[STM32_HW] <-u-  [LL_FLASH] : FLASH registers R/W

@enduml



@startuml

<style>

componentDiagram {

   arrow {

      FontSize 8

   }

}

</style>



title FLASH Interface Software Component Diagram



package "HAL" {

    [HAL_SERVICE]

    [HAL_FLASH_ITF]

}



package "Low Layer" {

    [LL_SYSTEM]

    [LL_FLASH]

    [DFP]

    [FLASH ITF Interrupt service routine]

}



package "HW" {

    [STM32_HW]

}



[Application] --> [HAL_FLASH_ITF] : HAL FLASH ITF API

[Application] <-- [HAL_FLASH_ITF] : HAL FLASH ITF callback



[HAL_FLASH_ITF] --> [LL_FLASH] : LL FLASH API

[HAL_FLASH_ITF] --> [LL_SYSTEM] : LL SBS API

[HAL_FLASH_ITF] <-- [FLASH ITF Interrupt service routine]

[HAL_FLASH_ITF] -l->  [HAL_SERVICE] : HAL_GetTick



[LL_FLASH] -->   [DFP]: FLASH registers definition

[STM32_HW] <-u-  [LL_FLASH] : FLASH registers R/W

[LL_SYSTEM] -l->  [DFP]: SBS registers definition

[STM32_HW] <-u-  [LL_SYSTEM] : SBS registers R/W

[STM32_HW] -u--> [FLASH ITF Interrupt service routine] : FLASH_ITF_IRQHandler

@enduml

Configuration table

The following table lists the configuration defines for the HAL FLASH module, specifying their locations, default values, and descriptions:

group FLASH_Configuration_Table

Configuration inside the Flash IO driver

Configuration defines

Description

Default value

Note

PRODUCT

from IDE

NA

The selected device (e.g., STM32U575xx)

USE_HAL_FLASH_MODULE

from hal_conf.h

1

Allows usage of HAL Flash module

USE_ASSERT_DBG_PARAM

from IDE

None

Allows usage of parameter assertions

USE_ASSERT_DBG_STATE

from IDE

None

Allows usage of state assertions

USE_HAL_CHECK_PARAM

from hal_conf.h

0

Allows usage of run-time parameter checks

USE_HAL_CHECK_PROCESS_STATE

from hal_conf.h

0

Allows usage of load/store exclusive checks

USE_HAL_FLASH_CLK_ENABLE_MODEL

from hal_conf.h

HAL_CLK_ENABLE_NO

Allows enabling the clock model for Flash

USE_HAL_FLASH_REGISTER_CALLBACKS

from hal_conf.h

0

Allows enabling callbacks register for Flash

USE_HAL_FLASH_GET_LAST_ERRORS

from hal_conf.h

0

Allows usage of error code mechanism

USE_HAL_FLASH_USER_DATA

from hal_conf.h

0

Allows usage of User data

USE_HAL_FLASH_PROGRAM_BY_ADDR

from hal_conf.h

1

Allows usage of program by address feature

USE_HAL_FLASH_ERASE_BY_ADDR

from hal_conf.h

1

Allows usage of erase by address feature

USE_HAL_FLASH_ERASE_PAGE

from hal_conf.h

1

Allows usage of erase by page feature

USE_HAL_FLASH_ERASE_BANK

from hal_conf.h

1

Allows usage of erase by bank feature

USE_HAL_FLASH_MASS_ERASE

from hal_conf.h

1

Allows usage of mass erase feature

USE_HAL_FLASH_ECC

from hal_conf.h

1

Allows usage of ECC error handling feature

__ARM_FEATURE_CMSE

from IDE

3

Allows Secure access for current context

group FLASH_ITF_Configuration_Table

Configuration inside the Flash ITF driver

Configuration defines

Description

Default value

Note

PRODUCT

from IDE

NA

The selected device (e.g., STM32U575xx)

USE_HAL_FLASH_ITF_MODULE

from hal_conf.h

1

Allows usage of Flash interface HAL module

USE_HAL_FLASH_ITF_ECC

from hal_conf.h

1

Allows enabling ECC mechanism interrupt

USE_ASSERT_DBG_PARAM

from IDE

None

Allows usage of parameter assertions

USE_HAL_CHECK_PARAM

from hal_conf.h

0

Allows usage of run-time parameter checks

__ARM_FEATURE_CMSE

from IDE

3

Allows usage of secure access for current context