I am using DS-5 V5.22.0 to debug the TrustZone example given (i.e. TrustZone-versatile-A9x4-example and TrustZone-Cortex-A9x4-FVP-example) by the ARM. My experiment platform is the Exynos4412, which is a ARM A9x4 platform.
I can build the project and get the Binaries (TrustZone-versatile.axf). And when I debugging the project, I get the error message from the DS-5 “Commands”, which is shown as follows:
Connected to stopped target ARM FVP - VE_Cortex_A9x4 Execution stopped in SVC mode at S:0x00000000 On core ARM_Cortex-A9MP_0 (ID 0) cd "E:\ARMWorkSpace" S:0x00000000 DCI 0xe7ff0010 ; ? Undefined Working directory "E:\ARMWorkSpace" loadfile "E:\ARMWorkSpace\TrustZone\TrustZone-versatile.axf" Loaded section SECURE_EXE: S:0x80000000 ~ S:0x80001303 (size 0x1304) Loaded section SECURE_EXE: S:0x80001304 ~ S:0x80001307 (size 0x4) Loaded section NORMAL_IMAGE: S:0x80100000 ~ S:0x80101047 (size 0x1048) Entry point S:0x80000000 Semihosting server socket created at port 8001 Semihosting enabled automatically due to semihosting symbol detected in image 'TrustZone-versatile.axf' set debug-from *$ENTRYPOINT start Starting target with image E:\ARMWorkSpace\TrustZone\TrustZone-versatile.axf Running from entry point Execution stopped in SVC mode at S:0x80000000 On core ARM_Cortex-A9MP_0 (ID 0) In startup_secure.s S:0x80000000 48,0 MSR CPSR_c, #Mode_SVC:OR:I_Bit:OR:F_Bit Then the press F8, it continues give: wait continue Execution stopped in SVC mode at S:0x80000914 On core ARM_Cortex-A9MP_0 (ID 0) S:0x80000914 ITTT CS Until it reports: Execution stopped in ABT mode at S:0x0000000C On core ARM_Cortex-A9MP_0 (ID 0) ERROR(CMD256-TAD10-NAL23): ! Unable to display contents at location "S:0x0000000C" ! Failed to read 4 bytes from address S:0x0000000C ! Memory read from model failed. ------------------------------------------------------------------------------------------------------------------------------------------------- And then I restart the platform and debug from the start. I follow the readme.html and set breakpoints: 1. on Secure world's main() with b main_secure.c::main 2. on Monitor initialization code in monitor.s with b monitorInit 3. on the function yield(). The project successfully go through the first two breakpoints, but it stop at the function “yield()”, the output is given as below: Execution stopped in SVC mode due to a breakpoint or watchpoint: S:0x800001E8 On core ARM_Cortex-A9MP_1 (ID 1) In main_secure.c S:0x800001E8 39,8 for (i = 0; i < 10; i++) ^^^^^^^ wait next Execution stopped in SVC mode at S:0x800001EC On core ARM_Cortex-A9MP_1 (ID 1) S:0x800001EC 41,5 printf("Hello from Secure world\n"); wait continue Execution stopped in SVC mode at S:0x80000B44 On core ARM_Cortex-A9MP_1 (ID 1) In _seterr (no debug info) S:0x80000B44 LDR r1,[r0,#0xc] wait continue Execution stopped in SVC mode at S:0x80000B44 On core ARM_Cortex-A9MP_1 (ID 1) S:0x80000B44 LDR r1,[r0,#0xc] wait continue Execution stopped in SVC mode at S:0x80000B44 On core ARM_Cortex-A9MP_1 (ID 1) S:0x80000B44 LDR r1,[r0,#0xc] wait continue Execution stopped in SVC mode at S:0x80000B44 On core ARM_Cortex-A9MP_1 (ID 1) S:0x80000B44 LDR r1,[r0,#0xc] wait continue Execution stopped in SVC mode at S:0x80000B44 On core ARM_Cortex-A9MP_1 (ID 1) S:0x80000B44 LDR r1,[r0,#0xc] wait continue Execution stopped in SVC mode at S:0x80000B44 On core ARM_Cortex-A9MP_1 (ID 1) S:0x80000B44 LDR r1,[r0,#0xc] wait continue Execution stopped in SVC mode at S:0x80000B44 On core ARM_Cortex-A9MP_1 (ID 1) S:0x80000B44 LDR r1,[r0,#0xc] wait continue Execution stopped in SVC mode at S:0x80000B44 On core ARM_Cortex-A9MP_1 (ID 1) S:0x80000B44 LDR r1,[r0,#0xc] wait continue Execution stopped in SVC mode at S:0x80000B44 On core ARM_Cortex-A9MP_1 (ID 1) S:0x80000B44 LDR r1,[r0,#0xc] wait continue Execution stopped in SVC mode at S:0x80000B44 On core ARM_Cortex-A9MP_1 (ID 1) S:0x80000B44 LDR r1,[r0,#0xc] wait continue Execution stopped in SVC mode at S:0x80000B44 On core ARM_Cortex-A9MP_1 (ID 1) S:0x80000B44 LDR r1,[r0,#0xc] wait continue Execution stopped in SVC mode at S:0x80000B44 On core ARM_Cortex-A9MP_1 (ID 1) S:0x80000B44 LDR r1,[r0,#0xc] wait continue Execution stopped in SVC mode at S:0x80000B44 On core ARM_Cortex-A9MP_1 (ID 1) S:0x80000B44 LDR r1,[r0,#0xc] wait continue Execution stopped in SVC mode at breakpoint 4: S:0x800001F4 On core ARM_Cortex-A9MP_3 (ID 3) In main_secure.c S:0x800001F4 42,5 yield(); wait continue Execution stopped in SVC mode at breakpoint 4: S:0x800001F4 On core ARM_Cortex-A9MP_0 (ID 0) S:0x800001F4 42,5 yield(); wait continue Execution stopped in ABT mode at S:0x0000000C On core ARM_Cortex-A9MP_0 (ID 0) ERROR(CMD256-TAD10-NAL23): ! Unable to display contents at location "S:0x0000000C" ! Failed to read 4 bytes from address S:0x0000000C ! Memory read from model failed.
It seems that the yield() function doesn’t work, which means the “SMC #0” doesn’t work. Can anyone help me with the problem and get the expected output (i.e. printf hello from secure world and non-secure world) in the readme.html?
Can you remove the breakpoint from yield() and see if you hit the same issue.
I want to rule out the possibility of system going into exception due to breakpoint at yield().