cancel
Showing results for 
Search instead for 
Did you mean: 

Need help on writing into secure flash in STM32U575

Shaffi
Associate II

I am working on STM32U575 to write and read from Secure flash. I referred   STM32Cube_FW_U5_V1.4.0\Projects\NUCLEO-U575ZI-Q\Examples\FLASH\FLASH_EraseProgram_TrustZone\

but I was facing following issue

Shaffi_0-1728377891530.png

Can you please help me resolving it. Do we have an document/link explaining read/write access to secure flash and memory map for the same.

Regards,

Shafi

1 ACCEPTED SOLUTION

Accepted Solutions

Hello @Shaffi ,

are you sure you are setting the correct option byte configuration mentinned in the Readme of the project ?

 - User Option Bytes requirement (with STM32CubeProgrammer tool)

        - TZEN = 1                            System with TrustZone-M enabled
        - SECWM1_PSTRT=0x0  SECWM1_PEND=0x7F  All 128 pages of internal Flash Bank1 set as secure
        - SECWM2_PSTRT=0x1  SECWM2_PEND=0x0   No page of internal Flash Bank2 set as secure, hence Bank2 non-secure
you should set the Tzen bit first to be able to see the secure watermark configuration 
STea_0-1728553699503.png

then the view of SECWM programming should be visible

STea_1-1728553760671.png

then using IAR set the project secure as active and rebuild it 
then rebuild the NS project (this is not done from your side that is why you get this error)

STea_2-1728553857152.png

you should be good to go afterwords.

STea_3-1728554263076.png

Regards

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

View solution in original post

7 REPLIES 7
Shaffi
Associate II

I am able to port the project using stm32cubeIde and able to compile and run on NUCLEO-U575 dev kit. But the example code isn't working as it is not able to read data against the data written into it.

project:STM32Cube_FW_U5_V1.4.0\Projects\NUCLEO-U575ZI-Q\Examples\FLASH\FLASH_EraseProgram_TrustZone\FLASH_EraseProgram_TrustZone_Secure
Data written 0x0102030405060708, 0x1112131415161718

Date Read 0xd1062800fdb9f7ff, 0xf451680106c4f8df.

Any help is highly appreciated.

Regards,

Shafi

Shaffi
Associate II

Hello ST,

The example code doesn't work in NUCLEO U575 board. Can you please help me in resolving this issue.

Regards,

Shafi  

Hello @Shaffi ,

are you sure you are setting the correct option byte configuration mentinned in the Readme of the project ?

 - User Option Bytes requirement (with STM32CubeProgrammer tool)

        - TZEN = 1                            System with TrustZone-M enabled
        - SECWM1_PSTRT=0x0  SECWM1_PEND=0x7F  All 128 pages of internal Flash Bank1 set as secure
        - SECWM2_PSTRT=0x1  SECWM2_PEND=0x0   No page of internal Flash Bank2 set as secure, hence Bank2 non-secure
you should set the Tzen bit first to be able to see the secure watermark configuration 
STea_0-1728553699503.png

then the view of SECWM programming should be visible

STea_1-1728553760671.png

then using IAR set the project secure as active and rebuild it 
then rebuild the NS project (this is not done from your side that is why you get this error)

STea_2-1728553857152.png

you should be good to go afterwords.

STea_3-1728554263076.png

Regards

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Hello STea,

First of all Thank you for your response, it worked for me after enabling TZEN bit. I am able to Read and write from Secure flash.
But I had an another issue when I wanted to disable Trustzone bit So first I changed the RDP from AA to DC in STM32Programmer software and clicked on Apply then I powercycled the board  and pressed connect It showed DEV_TARGET_NOT_HALTED. The settings were mode set to Normal and Reset mode set to Software reset.

Shaffi_0-1728645672856.png

Can you please help to progam my board again.

Regards,

Shafi

 

Hello STea,

I am now able to program my device, I resolved it by programming the device using UART mode on STM32programmer by setting BOOT0 pin. I had another question Is there a way to Enable TZEN in the code without using STM32programmer.  

Regards,

Shafi

Hello @Shaffi ,

there is no way to set Trustzone in your code as it is static isolation and needs to be activated using the option bytes setting.
Regards

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Hello @STea ,

Even if I've never actually done it, I'm quite sure TrustZone option byte can be set from the code itself.

Then, after restart, the secure areas will also need to be setup.

Best regards

Jocelyn