cancel
Showing results for 
Search instead for 
Did you mean: 

Trustzone & L562 Discovery - Flash Erase and Write problems

Yidaen
Associate

Hello everyone,

I would like to implement a project using TrustZone on the STM32 L562 Discovery board. To get started, I based my work on the STM32Cube_FW_U5_V1.4.0\Projects\NUCLEO-U575ZI-Q\Examples\FLASH\FLASH_EraseProgram_TrustZone\ example, which is often referenced in the forum for similar questions.

When I try to write from the secure world to the secure world, everything works fine. However, when I try to write from the secure world to the non-secure world, I encounter an error with the SECWRPERR flag. This is puzzling because I haven't set any write protection on the memory areas I'm trying to access.

While trying to understand the cause of this issue, I checked the STM32L562xx Reference Manual and found something interesting. On page 189, it mentions the following:

Yidaen_1-1748595784378.png

 

Additionally, if I understand correctly, the table on page 212 states that the secure world cannot perform write-erase operations in the non-secure world.

Yidaen_0-1748595753259.png

 

However, this seems to contradict the general principles of TrustZone. According to TrustZone documentation (including STM’s own video series and the example project i mentioned in the start), the secure world should have full access to the non-secure world.

Am I misunderstanding something here? Why are erase and write operations failing?

Thank you so much for your help!

1 ACCEPTED SOLUTION

Accepted Solutions
Yidaen
Associate

When performing flash operations in the secure domain, it’s necessary to specify whether the access will be secure or non-secure. This detail had escaped my notice.

 

View solution in original post

1 REPLY 1
Yidaen
Associate

When performing flash operations in the secure domain, it’s necessary to specify whether the access will be secure or non-secure. This detail had escaped my notice.