I am trying to create a TrustZone project for the Cortex-m85 (AN555 FPGA image for MPS3 board).
The default linker script loads the non-secure project on 0x1020000 memory(in SRAM). So am using the MPC API functions to configure the memory region to non-secure(mpc_sie_get_region_config).
I am using 0x57000000 as the controller address found in the AN555 document as shown below in the screenshot.
But as soon as the memory gets configured as Non-secure it wipes out the code loaded previously on that region.
API call to configure as non secure: enum mpc_sie_error_t mpc_config_ret = mpc_sie_config_region(&dev_test, 0x01020000, 0x011FFFFF, mpc_attr);
Before MPC API call:
After the MPC API call:
Verification code to check MPC configuration: mpc_current_config_ret = mpc_sie_get_region_config(&dev_test, 0x01020000, 0x011FFFFF, &mpc_get_config_holder);
which sets the value of mpc_get_config_holder to MPC_SIE_SEC_ATTR_NONSECURE. And return value is MPC_SIE_ERR_NONE so the configuration seems to be correct as requested.
Can anyone please suggest why this might happen?
Thank you for your help.