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.
ZhangJennie_0-1625215200138.png
So to fix the error,
1. in Security access configuration window, set related security level as below:
ZhangJennie_1-1625215450720.png
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.
ZhangJennie_4-1625215667880.png
ZhangJennie_2-1625215643914.png
ZhangJennie_3-1625215651997.png
After above setting, update code. Your Flash code should be able to work.
Best Regards
Jun Zhang