The image document states an SRAM controller (in 0x57000000) for the range 0x01000000 - 0x011FFFFF (NS) and 0x11000000 - 0x111FFFFF (S). I configured the SRAM region to secure and non-secure for code that works correctly (Fig 5). The stack for the secure world uses internal SRAM, and I am trying to configure 0x21040000 - 0x21040818 to NS (fig 2). The SAU is configured correctly, but the document does not mention the MPC controller address for internal SRAM (fig 3). When I switch to NS the execution perfectly goes to the Non-secure reset handler (setup stack, setup MSPLIM, PSPLIM, etc.) (fig 4). In program_start(), there is a push instruction to PUSH PC, but this instruction does not push any value to the stack. And when the POP PC instruction executes, it pops "0" from the stack generating a hard fault (fig 1).
Fig 1: Push instruction does not push any value to the stack (NS)
I am guessing as the SAU is configured without configuring the MPC, the memory region is not properly configured for NS.
Please let me know if any other causes may lead to this error or if the error is because MPC is not configured, please let me know the controller address for that region (could not find it in the document).
Fig2: Internal SRAM region:
Fig 3: Available MPC controllers:
Fig 4: Branch to Program_start() from Non-secure reset handler:
Fig 5: SAU configuration
Thank you very much for your time.
Did you setup a non-secure callable region in your partition_<device>.h ? That way the non-secure code has a way to branch to the secure?
Also, in your partition_<device>.h , under "Setup behaviour of Sleep and Exception Handling", you might temporarily set "BusFault, HardFault, and NMI target" to "Non-Secure state" … to make it easier to troubleshoot.
No, I did not set up a non-secure callable region in partition_<device>.h. But in my case, I am just trying to run my NS application, the code does not branch back to secure. It's getting this issue in program_start() of reset_handler of non-secure, which is supposed to hand over the execution to the main function (ns). I will try setting up the ns callable region as well.Thank you again for your time, really appreciate it.
A few more questions, to better understand your setup. I want to make sure we can track down what is going on.
1) You didn't say how you are debugging this. Are you using an MPS3 board?
https://developer.arm.com/Tools%20and%20Software/MPS3%20FPGA%20Prototyping%20Board
… Or are you using Arm Virtual hardware? Like the VHT_Corstone_SSE-310?
https://arm-software.github.io/AVH/main/simulation/html/Using.html
If you are running virtual hardware, are you running it on a local machine, or as an EC2 instance (using an amazon AWS account).
=====
2) in Keil, Under project - options for target -device tab, what device did you choose? SSE-310-MPS3_FVP or SSE-310-MPS3_AN555? Although SSE-310-MPS3_FVP and SSE-310-MPS3_AN555 are compatible devices, for debugging it matters.
1) I am using an actual MPS3 FPGA board connected to my local machine. I am using CMSIS-DAP debugger from options. Below are my debugging config:
Content of my Debug.ini:
2) option for target: I choose "SSE-310-MPS3_AN555" as shown in the screenshot below: