title: Compile problems with native raspberry pi
body: <p><strong>The problem</strong></p>
  
  <p>We are trying to compile the spi_slave code on a raspberry pi. We used the native gcc compiler and the compile runs without any errors.</p>
  
  <p>The problem is when I try to run the output:</p>
  
  <p>/home/pi/spi_slave# ./build/output.elf
  Segmentation fault</p>
  
  <p>/home/pi/spi_slave# ./build/kernel.img
  bash: ./build/kernel.img: cannot execute binary file</p>
  
  <p>Tried to download the arm-none-eabi compiler from cambridge but it wont run:
  /home/pi/spi_slave# ../arm-2008q3/bin/arm-none-eabi-gcc
  bash: ../arm-2008q3/bin/arm-none-eabi-gcc: cannot execute binary file</p>
  
  <p><strong>Sourcecode</strong></p>
  
  <p>The code we are trying to compile is: <a href="http://tylernichols.me/wp-content/uploads/2012/11/raspberry_pi_bare_metal_spi_slave.zip" rel="nofollow">http://tylernichols.me/wp-content/uploads/2012/11/raspberry_pi_bare_metal_spi_slave.zip</a></p>
  
  <p>The only change we did was in the makefile, added a # in front of the ARMGNU var</p>
  
  <pre><code>#ARMGNU = arm-none-eabi
  </code></pre>
  
  <p><strong>Environement</strong></p>
  
  <pre><code># uname -a
  Linux raspberrypi 3.6.11+ #371 PREEMPT Thu Feb 7 16:31:35 GMT 2013 armv6l GNU/Linux
  </code></pre>
  
  <p><strong>What am I doing wrong?</strong></p>
  
  <p>We have tried to find answers on google and stackoverflow for hours now without success. :/</p>