Undefined Instruction exception when executing an mcr instruction

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Undefined Instruction exception when executing an mcr instruction

1,188 Views
philippewicker
Contributor II

Hello all,

I'm getting an undefined instruction exception when I call enable_neon_fpu() (from the SDK 1.1: file sdk/core/src/CortexA9.s). The exception is triggered when the processor tries to execute the 3rd instruction in the following piece of code:

  .global enable_neon_fpu

  .func enable_neon_fpu

enable_neon_fpu:

  /* set NSACR, both Secure and Non-secure access are allowed to NEON */

  MRC p15, 0, r0, c1, c1, 2

  ORR r0, r0, #(0x3<<10) @ enable fpu/neon

  MCR p15, 0, r0, c1, c1, 2

  /* Set the CPACR for access to CP10 and CP11*/

  LDR r0, =0xF00000

  MCR p15, 0, r0, c1, c0, 2

  /* Set the FPEXC EN bit to enable the FPU */

  MOV r3, #0x40000000

  @VMSR FPEXC, r3

  MCR p10, 7, r3, c8, c0, 0

  .endfunc

The application is a bare-metal executable which first calls platform_init() (from the SDK 1.1: file apps/common/platform_init.c). enable_neon_fpu() is the first SDK routine called from platform_init(). The executable is loaded in the processor - an iMX6Q - using a Lauterbach USB probe and the TR32 debugger. The same binary works if I load it using an OCD compatible probe (Olimex). So I'd tend to believe that there may be an initialisation problem in the case of the Lauterbach probe. I've checked the CPSR when the exception triggers: its value is 0x600001D3 which means that the processor is in the supervisor mode.


Any idea of what could cause this exception?


Thanks


Philippe


2 Replies

698 Views
philippewicker
Contributor II

Replying to myself :smileywink:

With the help of the Lauterbach people, the exception has been fixed by clearing the NS bit in the SCR register (command register.set NS 0 in the TRACE32 start-up script). However I'm still a bit confused because the iMX6 processor is supposed to start in privileged and secure mode after a reset.

698 Views
marcocassol
Contributor I

you just solved my problem :smileyhappy:

0 Kudos