title: How to repair segmentation fault?
body: <p>I need to read the Asynchronous External Memory Interface (<a href="http://www.ti.com/general/docs/litabsmultiplefilelist.tsp?literatureNumber=sprufi1c" rel="nofollow">AEMIF</a>) using a <a href="http://www.ti.com/product/tms320dm368" rel="nofollow">TMS320DM368</a> in an embedded linux environment on custom HW. 
  I don't actually have the hardware yet so I am testing the vala code (below) on a Leopardboard 368. 
  The 1st AEMIF is used by the bootloader to read nand flash.
  My code is trying to use the 2nd AEMIF to read SRAM that is not on the Leopardboard but will be on the custom HW. 
  I suspect the segmentation fault is caused by the fact that I am trying to access protected memory. 
  The actual custom HW will have several M of SRAM that needs to be read but I am trying to get this test code to read read 256 bytes.
  How can I fix the segmentation fault caused by the test code below? 
  Do I need to add a driver to the kernel?
  I'd rather not mess with the kernel if possible.
  Is there an embedded-linux method to configure or declare certain address ranges as unprotected?</p>
  
  <pre><code>uint8 * source = (uint8 *)0x04000000; // AEMIF Data (CE1)
  uint32 * pA2CR = (uint32 *)0x01D10014; // AEMIF 2 Config Reg (CS3 space)
  const uint32 READ_SETUP = 1; // Read setup: EMIF clock cycles - 1
  *pA2CR = (READ_SETUP &lt;&lt; 13);
  const size_t size = 256;
  var dest = new uint8[size];
  memset(dest, 0, size);
  memcpy(dest, source, size);
  </code></pre>