2023-05-29 11:58 PM
Hi guys! Good day and hope you are doing well.
I am currently working with STM32H573VIT6. I have enabled the Trustzone by using STM32CubeProgrammer (i.e., from the "Option bytes" feature). After that I am having an issue of "Hardfault exception" during debugging(FYI, I am using IAR as IDE). I have got the following logs from the debug log.
From the log, it seems that probably the reason is: "An attempt was made to access parts of the address space that are marked as Secure with NS-Req for the transaction set to Non-secure at address 0xfffffff8".
Can someone help me where I am doing something wrong so that these errors are appearing? Is it that I did not set some parameters on "Option bytes" (by using STM32CubeProgrammer. See the attachment for details) or something else I need to check? By the way, I did not able to find "RDP level" in "Option bytes" feature.
Anyway, I will be very grateful for any advices.
Thanks in advance.
N.B: Please find the screenshots in attachment section.
Solved! Go to Solution.
2023-05-30 02:05 AM - edited 2023-11-20 04:23 AM
Hi @GTest.1
As you enable trust zone, your project should be divided into to parts
First secure code will be executed and then it will jump to non-secure firmware.
I thing if you have used sample code then one bank is used for secure firmware and another bank is for non-secure. So check
Hard fault occurred due to improper memory allocation of secure and non secure. It also occurred many other reasons.
as per your configuration it look like your both bank is configured as secure. Kindly update
SECWM2_START value = 0x01
SECWM2_END value = 0x00
apply and save and try to debug.
SECWM2_START value > SECWM2_END value required to configure bank2 as non-secure.
Check your jump address in secure firmware. it should be start of your bank2 address
Regards,
VIJAY
2023-05-30 02:05 AM - edited 2023-11-20 04:23 AM
Hi @GTest.1
As you enable trust zone, your project should be divided into to parts
First secure code will be executed and then it will jump to non-secure firmware.
I thing if you have used sample code then one bank is used for secure firmware and another bank is for non-secure. So check
Hard fault occurred due to improper memory allocation of secure and non secure. It also occurred many other reasons.
as per your configuration it look like your both bank is configured as secure. Kindly update
SECWM2_START value = 0x01
SECWM2_END value = 0x00
apply and save and try to debug.
SECWM2_START value > SECWM2_END value required to configure bank2 as non-secure.
Check your jump address in secure firmware. it should be start of your bank2 address
Regards,
VIJAY
2023-05-30 04:39 AM
@vijay_03 Thanks a lot for your elaborate clarification. Really appreciate that! I have changed the values as you suggested and it works perfectly. Again thanks a lot!