This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Why the TI Wiki code to enable Neon crashes?

Hello,

I have been trying to enable Neon to run Neon-VFP instructions. I have the in-line assembly ARM instructions to enable Neon :

-----------------------------------------------from TI Wiki-------------

     MRC p15, #0, r1, c1, c0, #2 ; r1 = Access Control Register
     ORR r1, r1, #(0xf << 20) ; enable full access for p10,11
     MCR p15, #0, r1, c1, c0, #2 ; Access Control Register = r1
     MOV r1, #0
     MCR p15, #0, r1, c7, c5, #4 ; flush prefetch buffer because of FMXR below
     ; and CP 10 & 11 were only just enabled
     ; Enable VFP itself
     MOV r0,#0x40000000
     FMXR FPEXC, r0 ; FPEXC = r0
------------------------------------------------

And I included it into my my code and compiled with TI CCS5, loaded into ARM A8 memory and run it with my BeagleBone White debug mode. But first instruction, "MRC p15, #0, r1, c1, c0, #2", actually crashes the ARM.


Just wondering if this register setting instruction can cause any watchdog related reset or some other exception? Or, anything I need to run before before the this register setting instruction?


Thank you,

xyin

  • More details about the problem (when trying to enable Neon in Cortex A8):

    Using beagleBone White board (support built-in JTAG debugging with CCS5). The two instructions (marked red color) below actually make the JTAG debug mode crash:

    -----------------------------------------------from TI Wiki-------------

         MRC p15, #0, r1, c1, c0, #2 ; r1 = Access Control Register
         ORR r1, r1, #(0xf << 20) ; enable full access for p10,11
         MCR p15, #0, r1, c1, c0, #2 ; Access Control Register = r1
         MOV r1, #0
         MCR p15, #0, r1, c7, c5, #4 ; flush prefetch buffer because of FMXR below
         ; and CP 10 & 11 were only just enabled
         ; Enable VFP itself
         MOV r0,#0x40000000
         FMXR FPEXC, r0 ; FPEXC = r0
    ------------------------------------------------

    Please let me know if anything I have missed before run above two instructions. Or if you know any other ways to enable Neon in Cortex A8 core, please let me know.

    Thank you,

    xyin

  • xyin,

    Despite this question is better suited to the Cortex A8 experts in the Sitara device forum, I would ask you to pay close attention to the device status bar at the bottom of the CCS screen and make sure it is in Supervisor mode (SPV). If not, your code will have to make sure it does not set it to user mode before this configuration.

    Also, what do you exactly mean by "crash"? Does it disconnect from the device entirely or simply goes to an unknown location in the device memory? If the latter, you should probably see "ABT" in the status bar, which indicates the core went to Abort mode. It may also show "EXC" or "UND" which, if I am not mistaken, indicates an exception or undefined state.

    Anyways, take a look at these details and see if the VFP can be enabled (it works for me).

    Regards,

    Rafael

  • Thanks Rafael,

    Good to have your help!!!.

    My status bar says "USR" (user mode). How I can make it a SPV?

    Also, the crash I meant is actually that the debug session runs to some unknown memory address, and never be able to step out of it. The board is still connected with CCS in this case. In this case I got "UND".

    Thank you,

    xyin

  • xyin,

    ARM cores boot in supervisor mode, therefore the initialization routine is setting it to user mode. Are you using TI's ARM compiler or GCC?

    If GCC, it stays on supervisor mode by default, unless you define the symbol USERMODE in your compiler options.

    If TI, it enters User mode at the very early stages of runtime initialization (at the boot.asm file). To make changes to that, check this forum thread.

    Hope this helps,

    Rafael

  • Rafael,

    I looked this forum thread. But still have more questions:

    Do I need to include a boot.asm file into my project as one regular file to compile with other files in my project? The boot.asm I found is in TI CCS folder "C:\ti\xdctools_3_25_03_72\packages\ti\targets\arm\rtsasm\boot.asm.

    Inside the file there are some lines of code to enable Neon and set to system-Mode. Should I bring this one in my project and compile it with my other project files?

    Thank you,

    xyin