cancel
Showing results for 
Search instead for 
Did you mean: 

DCACHE on STM32U599

paolog
Associate III

Hi!

I'm configuring the STM32U599VJT with CubeMX enabling DCACHE1 and 2, as well as ICACHE. Code is generated without error, but functions like SCB_CleanDCache_by_Addr() are not enabled as the definitions in stm32u599xx.h do not include __ICACHE_PRESENT and __DCACHE_PRESENT definitions.

It's my understanding that the CM33 include these features, but how can I enable them?

 

Versions:
STM32CubeIDE: 1.14.0
STM32CubeMX: 6.10
STM32CubeU5 Firmware Package: V1.4.0 / 20-October-2023

 

4 REPLIES 4
CMYL
ST Employee

Hello @paolog 

ICACHE, DCACHE1 and DCACHE2 are ST IPs, not part of the CM33. Refer to figures below from Arm Cortex-M33 Processor Datasheet and STM32U599 RM0456.

 

They are memory mapped as any other STM32 peripherals in stm32u5a9xx.h as follow:

#define ICACHE_BASE_NS (AHB1PERIPH_BASE_NS + 0x10400UL)

#define DCACHE1_BASE_NS (AHB1PERIPH_BASE_NS + 0x11400UL)

#define DCACHE2_BASE_NS (AHB1PERIPH_BASE_NS + 0x11800UL)

They are managed by stm32u5xx_hal_dcache.c and stm32u5xx_hal_icache.c drivers in ~/STM32U5xx_HAL_Driver.

 

CMYL_0-1702472190749.png

CMYL_1-1702472220970.png

 

Best regards

 

 

paolog
Associate III

Hi @CMYL , thank you for the clarification.

In the meantime I found out that my project was using firmware 1.3.0, and was not updated to 1.4.0 (it was created before firmware was updated with CubeMX). Which is the correct way to have CubeIDE to update the project firmware when it's been updated in CubeMX? What I did is correct the firmware version in the .ioc (reflecting the one installed) and regenerating the code (solution read in a forum post).

I replaced the call to SCB_CleanDCache_by_Addr() with the HAL version and the project builds without errors.

Best regards,

Paolo

CMYL
ST Employee

Ciao @paolog Paolo,

good news to see that the new firmware is working fine 🙂

In order to update the firmware, you need first to insert your application code within the meta comments given in code as follows. This avoids erasing your code when you regenerate or update the CubeMx project. Then as you mentioned regenerating the code according to that forum post.

/* USER CODE BEGIN xx */

--> insert your code here

/* USER CODE END xx */

 

I have no idea, how behave the code using SCB_CleanDCache_by_Addr() !! could you share this code to more investigate in the issue root cause ?

 

Best regards,

Younes

 

 

paolog
Associate III

Ciao @CMYL Younes 😊 I have two points here...

1. The project with the STM32U5 was created using its Firmware Package 1.3.0. I then updated the STM32U5 Firmware Package to 1.4.0 using CubeMX, so I needed to update the project STM32U5 Firmware Package too. But CubeIDE doesn't allow that as far as I could find (I can only check which version it's using). I changed the STM32U5 Firmware Package version opening the .ioc file with a text editor and rebuilt the code: is this the correct way?

2. I started a project using an STM32F7. In that case the data cache is cleaned with a call to the function SCB_CleanDCache that I could not find in the STM32U5 package, that is using HAL functions instead. This is solved by updating the STM32U5 Firmware Package to 1.4.0

Best regards,

Paolo