STM32 Cortex-M33, such as the L5/H5/U5 series, have a cache peripheral for instruction and data caches, which are not present in the C-M33 architecture spec. The driver defaults to direct mapped cache as it uses less power than the alternative set associative mapping [1]. This has also been the default in stm32 soc initialization code for chips that have the ICACHE peripheral, which makes it the safest choice for backward compatibility. The exception to the rule is STM32L5, which has the n-way cache mode selected in SOC code. [1]: https://en.wikipedia.org/wiki/Cache_placement_policies Signed-off-by: Henrik Lindblom <henrik.lindblom@vaisala.com>
25 lines
731 B
Plaintext
25 lines
731 B
Plaintext
# Copyright (c) 2025 Henrik Lindblom <henrik.lindblom@vaisala.com>
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
menuconfig CACHE_STM32
|
|
bool "STM32 cache driver"
|
|
select CACHE_HAS_DRIVER
|
|
depends on CACHE_MANAGEMENT
|
|
help
|
|
Enable support for the STM32 ICACHE / DCACHE peripheral present in some STM32 chips.
|
|
|
|
if CACHE_STM32
|
|
|
|
# "default n" for L5 is legacy - could be removed?
|
|
config CACHE_STM32_ICACHE_DIRECT_MAPPING
|
|
bool "Use 1-way associative mapping for ICACHE"
|
|
default n if SOC_SERIES_STM32L5X
|
|
default y
|
|
help
|
|
Use ICACHE in direct mapping (1-way associative) mode instead of the default n-way
|
|
associative cache mode.
|
|
|
|
This option reduces power consumption but slightly reduces cache's performance.
|
|
|
|
endif # CACHE_STM32
|