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.
waitForTargetToStop
Connected to stopped target ARM FVP (Installed with DS-5) - VE_Cortex_A9x1 Execution stopped at: S:0x00000000 loadfile "S:\code\wireless\math_neon\Debug\math_neon.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 "C:\Users\fengxu\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 "C:\Users\fengxu\Documents\DS-5 Workspace" set debug-from main start Starting target with image S:\code\wireless\math_neon\Debug\math_neon.axf Running from entry point wait
arm - DS-5 eclipse debug stuck at waitForTargetToStop - Stack Overflow
Neon engine is disabled at reset, you need to enable it by yourself.
Enabling NEON requires 2 steps
1.Enable access to coprocessors 10 and 11 and allow Neon instructions
MRC p15, 0x0, r0, c1, c0, 2 ; Read CP15 CPACR
ORR r0, r0, #(0x0f << 20) ; Full access rights
MCR p15, 0x0, r0, c1, c0, 2 ; Write CP15 CPACR
ISB
2.Enable NEON and VFP
MOV r0, #0x40000000 ; Set bit 30
VMSR FPEXC, r0 ; Write r0 to Floating Point Exception Register
Thanks for your answer. However, as mentioned in the original post, the problem is not how to enable NEON support. That is explained in the ARM tutorial referenced in the original post. The project builds fine with NEON support. The problem is in loading the axf file onto the FVP debugger in Eclipse. That's where it hangs with the waitForTargetToStop message.
In fact the problem doesn't seem to be specifically related to NEON support. As soon as one chooses the Cortex-A9 as the target CPU in the Eclipse IDE, the debugger has the same issue when one tries to load the resulting .axf file.
Kaiyou Wang I owe you an apology for not understanding your answer correctly. After more debugging from the entry point, I have found that the problem was due to an exception being raised before the main() function. More specifically in the fp_init() function that is automaically generated to initialise the floating-point unit when the Cortex-A9 is chosen as the target CPU. The solution was to write my own fp_init() function and add it to the project. I found the code for that in 'startup.s' file of the fireworks_A9-FVP_AC5 tutorial project that comes with DS-5. This code is identical to the code in your answer. So your answer was in fact correct, just not explicit enough for my entry-level understanding! Thank you for helping.
Hi touchebeboTo see where code execution is failing, in the DS-5 Debugger Debug Configuration, Debugger tab, change "Debug from symbol=main" to "Debug from entry point". Then you can single-step through the start up, from the entry point, to where it is failing.I suspect your executable image is failing inside the _fp_init() function inside the C library start up code. Try setting a breakpoint on _fp_init and running to it. When code is compiled for hardware floating point or NEON, the linker includes a version of _fp_init() that reads/writes the FPSCR. This will only succeed if the FPU/NEON unit has been explicitly turned on earlier. This requires the assembler code as described by Kaiyou Wang above. This assembler code must be executed before _fp_init is reached.I suggest you take a look at the ready-made fireworks_A9-FVP_AC6 example that comes with DS-5. This includes all the necessary FPU/NEON initialization code. You can then replace its main.c & fireworks.c with your own C code.