title: ARM assembly access to C global variable
body: <p>According to <a href="http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0056d/Cihcciij.html" rel="noreferrer">http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0056d/Cihcciij.html</a>
  , if my ARM assembly code need to access a C global variable named <code>globvar</code>, I should use <code>import</code> and <code>load</code> instructions like that:</p>
  
  <pre><code>    AREA     globals,CODE,READONLY
      EXPORT    asmsubroutine
      IMPORT    globvar
  asmsubroutine
      LDR  r1, =globvar   ; read address of globvar into
                          ; r1 from literal pool
      LDR  r0, [r1]
      ADD  r0, r0, #2
      STR  r0, [r1]
      MOV  pc, lr
      END
  </code></pre>
  
  <p>, but when I use it in my code, there is an error as <code>"bad instruction</code>import globvar'"`.
  I'm using armv7-android-gcc compiler.  I also looked for the analogous problem in this forum, but I get no useful result, so could anybody help me out of this? Thanks a lot.</p>