Skip to main content
Associate
May 30, 2025
Solved

Trustzone & L562 Discovery - Flash Erase and Write problems

  • May 30, 2025
  • 1 reply
  • 350 views

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!

Best answer by Yidaen

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.

 

1 reply

YidaenAuthorBest answer
Associate
May 30, 2025

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.