Skip to content

Commit ad42647

Browse files
author
Henrik Lindblom
committed
soc: stm32: stm32u5x: use cache peripheral driver
Use the Zephyr cache API in soc initialization code instead of calling the HAL directly. The change does not modify the pre-existing cache settings, just changes the path they are enabled. Issue #71268 Signed-off-by: Henrik Lindblom <[email protected]>
1 parent 9302e68 commit ad42647

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

soc/st/stm32/stm32u5x/Kconfig.defconfig

+16
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,22 @@ rsource "Kconfig.defconfig.stm32u5*"
1010
config ROM_START_OFFSET
1111
default 0x400 if BOOTLOADER_MCUBOOT
1212

13+
config CACHE_STM32
14+
default y if EXTERNAL_CACHE
15+
16+
config ICACHE
17+
default y
18+
19+
config DCACHE
20+
default y
21+
22+
config CACHE_MANAGEMENT
23+
default y
24+
25+
choice CACHE_TYPE
26+
default EXTERNAL_CACHE
27+
endchoice
28+
1329
if STM32_STOP3_LP_MODE
1430

1531
config COUNTER

soc/st/stm32/stm32u5x/soc.c

+2-4
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
*/
1111

1212
#include <zephyr/device.h>
13+
#include <zephyr/cache.h>
1314
#include <zephyr/init.h>
1415
#include <stm32_ll_bus.h>
1516
#include <stm32_ll_pwr.h>
16-
#include <stm32_ll_icache.h>
1717
#include <zephyr/logging/log.h>
1818

1919
#include <cmsis_core.h>
@@ -29,9 +29,7 @@ extern void stm32_power_init(void);
2929
*/
3030
void soc_early_init_hook(void)
3131
{
32-
/* Enable instruction cache in 1-way (direct mapped cache) */
33-
LL_ICACHE_SetMode(LL_ICACHE_1WAY);
34-
LL_ICACHE_Enable();
32+
sys_cache_instr_enable();
3533

3634
/* Update CMSIS SystemCoreClock variable (HCLK) */
3735
/* At reset, system core clock is set to 4 MHz from MSIS */

0 commit comments

Comments
 (0)