title: Cross compiling - Error: selected processor does not support `fmrx r3,fpexc' in ARM mode - Beaglebone
body: <p>I'm trying to cross-compile a file to flash into the Beaglebone Black.
  All works fine, but if I try to enable the FPU with</p>
  
  <pre><code>#define set_en_bit_in_fpexc() do { \
      int dummy; \
      __asm__ __volatile__ ("fmrx %0,fpexc\n\t" \
                           "orr  %0,%0,#0x40000000\n\t" \
                           "fmxr fpexc,%0" : "=r" (dummy) : :); \
  } while (0)
  </code></pre>
  
  <p>I get the following error</p>
  
  <pre><code>Error: selected processor does not support `fmrx r3,fpexc' in ARM mode
  Error: selected processor does not support `fmxr fpexc,r3' in ARM mode
  </code></pre>
  
  <p>I also tried with <code>thumb mode</code>, but I get the same errors.
  Of course if I remove the part of the code that initialize the FPU it works fine.</p>
  
  <p>Why I get those errors?</p>
  
  <p><strong>Makefile</strong></p>
  
  <pre><code>[...]
  CROSSPATH?=/usr/bin
  CROSSPFX=$(CROSSPATH)/arm-none-eabi-
  CC=$(CROSSPFX)gcc
  AS=$(CROSSPFX)as
  LD=$(CROSSPFX)ld
  NM=$(CROSSPFX)nm
  OBJCOPY=$(CROSSPFX)objcopy
  OBJDUMP=$(CROSSPFX)objdump
  CFLAGS=-Wall -Wextra -O2 -ffreestanding
  ARCHFLAGS=-mcpu=cortex-a8 -march=armv7-a -mfpu=neon
  CCARCHFLAGS=$(ARCHFLAGS) -marm
  [...]
  </code></pre>
  
  <p>I'm on Arch, kernel 4.8.1</p>
  
  <p>P.S. My professor uses the <em>linaro cross-compiler</em> and it works just fine</p>