title: ARM LPC3250 execute instructions from external RAM
body: <p>I got trouble with making ARM execute instructions stored in the external RAM.</p>
  
  <p>I wrote a small program that can blink led based on LPC3250 architecture. The program run properly if I download it to the internal RAM of LPC3250 via IAR online-debug. But it cannot run if I put it in the external RAM.</p>
  
  <p><strong>The external RAM is a block of SRAM built in the SPARTAN-6(Xilinx FPGA)</strong>, DATA width is 32-bits, memory depth is 4096, means address width is 12-bits. This RAM can be initialized through a COE file.</p>
  
  <p>So I get the BIN file of the Program via IAR, then convert the BIN file into a COE file, which will be used to initialize the SRAM. <strong>But every time, the processor just execute the three E59FF018(LDR PC,(PC, #0X18)) instructions at the beginning of SRAM, cannot jump to the main().</strong> </p>
  
  <p>I cannot figure out why. <strong>As LPC3250 required, I add 4 bytes(0x13579BD2) to the beginning of BIN file via UltraEditor before generating the COE file.</strong> The UM of LPC3250 said it will start to execute the code at the address 0xE0000004 of external ram if the value in 0xE0000000 is 0x13579BD2. From the COE file I can see there are 5 same instructions(E59FF018) behind 0x13579BD2.</p>
  
  <p>Please tell me where I'm wrong and What I need to do exactly to make it right.</p>