Hello.
I am going to do flash write/read by referring to the flashiap example code in the trustzone example code.
But VERSION1_FLASH_API_TREE->flash_init(config);
In this part, it falls into a hard fault.
May I know what could be the cause?
Solved! Go to Solution.
Hi idtmdwo
VERSION_FLASH_API_TREE is at boot rom address 0x1301fe00.
According to UM, the user's TrstZone configuration data must allow ROM code execution for successful transition from secure to normal mode and jump to user application. Thus some settings are necessary.
So to fix the error,
1. in Security access configuration window, set related security level as below:
2. When operate Flash and other related peripherals in secure world, make sure the related peripherals are S-Priv. In your application, SYSCTRL and FLASH are used, we need to set both of them as S-Priv.
After above setting, update code. Your Flash code should be able to work.
Best Regards
Jun Zhang
Hi idtmdwo
VERSION_FLASH_API_TREE is at boot rom address 0x1301fe00.
According to UM, the user's TrstZone configuration data must allow ROM code execution for successful transition from secure to normal mode and jump to user application. Thus some settings are necessary.
So to fix the error,
1. in Security access configuration window, set related security level as below:
2. When operate Flash and other related peripherals in secure world, make sure the related peripherals are S-Priv. In your application, SYSCTRL and FLASH are used, we need to set both of them as S-Priv.
After above setting, update code. Your Flash code should be able to work.
Best Regards
Jun Zhang
The problem has been resolved.
Thank you so much for your detailed, easy-to-follow answer.
Good to know.
You are welcome!
Best Regards
Jun Zhang