DS-5 eclipse debug stuck at waitForTargetToStop

0

First I follow the DS-5 start demo and can debug my code correctly on the ARM FVP -> VE_Coretex_A9x1.

Then I follow the link to enable NEON and it needs to set CPU target in the build, the axf file has been built correctly but the debugger stops to work. The CA9_FVP hangs after connected to board. It shows waitForTargetToStop.

Connected to stopped target ARM FVP (Installed with DS-5) - VE_Cortex_A9x1 Execution stopped at: S:0x00000000 loadfile "test.axf" S:0x00000000 DCI 0xe7ff0010 ; ? Undefined Loaded section ER_RO: S:0x80000000 ~ S:0x80002C0B (size 0x2C0C) Loaded section ER_RW: S:0x80002C0C ~ S:0x80002C1F (size 0x14) Entry point S:0x80000000 cd "Documents\DS-5 Workspace" Semihosting server socket created at port 8001 Semihosting enabled automatically due to semihosting symbol detected in image 'math_neon.axf' Working directory "Documents\DS-5 Workspace" set debug-from main start Starting target with image test.axf Running from entry point wait

As the results of debug from entry:

_fp_init
S:0x80002B88 : MOV      r0,#0x3000000
S:0x80002B8C : VMSR     FPSCR,r0                  --> this line will cause PC jump to 0x00000004 and them stuck

S:0x00000000 : DCI      0xe7ff0010 ; ? Undefined
S:0x00000004 : STMDA    r0,{r11,sp-pc}
S:0x00000008 : DCI      0xe7ff0010 ; ? Undefined
S:0x0000000C : STMDA    r0,{r11,sp-pc}
S:0x00000010 : DCI      0xe7ff0010 ; ? Undefined
S:0x00000014 : STMDA    r0,{r11,sp-pc}
eclipse
arm
ds-5
asked on Stack Overflow Oct 29, 2016 by Tmx • edited Oct 31, 2016 by Tmx

2 Answers

1

I ran into the same issue. What happens is that an exception is raised before it gets to the main() function. If you debug from the entry point (debug configuration config, debugger tab) and step through the asm code, you can see the exception being raised in the fp_init() function, when it tries to write to the FPSCR register. The reason is that full access needs to be enabled before the code can write to the FPSCR register.

One solution is to write your own fp_init() function. I wrote mine by copying the VFP/NEON activation code from the 'startup.s' file in the fireworks_A9-FVP_AC5 tutorial project that comes with DS-5. I wanted to stay with C files so I added a 'startup.c' file to my project, with the following contents. That did the trick for me.

__asm void _fp_init(void) {
  IF {TARGET_FEATURE_NEON} || {TARGET_FPU_VFP}

  ; Enable access to NEON/VFP by enabling access to Coprocessors 10 and 11.
  ; Enables Full Access i.e. in both privileged and non privileged modes
        MRC     p15, 0, r0, c1, c0, 2     ; Read Coprocessor Access Control Register (CPACR)
        ORR     r0, r0, #(0xF << 20)      ; Enable access to CP 10 & 11
        MCR     p15, 0, r0, c1, c0, 2     ; Write Coprocessor Access Control Register (CPACR)
        ISB

  ; Switch on the VFP and NEON hardware
        MOV     r0, #0x40000000
        VMSR    FPEXC, r0                   ; Write FPEXC register, EN bit set

  ENDIF
}
answered on Stack Overflow Oct 18, 2018 by fbcp
0

Go to Project Properties > C/C++ Build > Settings > Tool Settings > ARM Linker > Image Layout And Fill the Image entry point (--entry) as Vectors

Note: This is for DS5 running on Eclipse

answered on Stack Overflow Oct 16, 2018 by Jigyasu Tailor

User contributions licensed under CC BY-SA 3.0