title: Embedded Android debugging - Cannot access memory at address 0x10010
body: <p>I'm working through an example in the book <a href="https://rads.stackoverflow.com/amzn/click/com/0134030001" rel="nofollow noreferrer" rel="nofollow noreferrer">Embedded Programming with Android</a>:</p>
  
  <pre><code>/*****************************************************************************/
      .syntax unified
      .cpu arm7tdmi
      .fpu softvfp
  
  /******************************************************************************
   *
   * This is the code that gets called when the processor first starts execution
   * following a reset event.
   *
  *******************************************************************************/
      .section    .text.ResetISR,"ax",%progbits
      .align  2
      .global ResetISR
      .type   ResetISR, %function
  ResetISR:
      mov   r0, #5         @ Load register r0 with the value 5
      mov   r1, #4         @ Load register r1 with the value 4
      add   r2, r1, r0     @ Add r0 and r1 and store in r2
  ResetISR_STOP:
      b   ResetISR_STOP    @ Infinite loop to stop execution
      .size   ResetISR, .-ResetISR
  </code></pre>
  
  <p>Source: <a href="https://github.com/shugaoye/bo/blob/master/c03/c03e1/c03e1.S" rel="nofollow noreferrer">https://github.com/shugaoye/bo/blob/master/c03/c03e1/c03e1.S</a></p>
  
  <p>The output from building is as follows:</p>
  
  <pre><code>$ make DEBUG=1 VERBOSE=1
  arm-none-eabi-gcc -marm -mno-thumb-interwork -mabi=aapcs-linux 
     -march=armv5te -fno-common -ffixed-r8 -msoft-float -fno-builtin 
     -ffreestanding -MD -g -D DEBUG -Dgcc -o gcc/c03e1.o -c c03e1.S
  
  arm-none-eabi-ld -T c03e1.ld --entry ResetISR 
     -o gcc/c03e1.axf gcc/c03e1.o /opt/ 
     arm-2012.03/bin/../lib/gcc/arm-none-eabi/4.6.3/../../../../arm-none-eabi/lib/  libm.a 
     /opt/arm-2012.03/bin/../lib/gcc/arm-none-eabi/4.6.3/../../../../arm-none- eabi/lib/libc.a
     /opt/arm-2012.03/bin/../lib/gcc/arm-none-eabi/4.6.3/libgcc.a
  </code></pre>
  
  <p>I then run the android emulator as follows:</p>
  
  <pre><code> emulator -verbose -show-kernel -netfast -avd hd2 -shell -qemu -s -S –kernel gcc/c03e1.axf
  </code></pre>
  
  <p>Next I connect with ddd:</p>
  
  <pre><code> ddd --debugger arm-none-eabi-gdb gcc/c03e1.axf
  </code></pre>
  
  <p>When I open the the machine code window view in ddd I see the following error:</p>
  
  <pre><code>Dump of assembler code from 0x10000 to 0x10100:
  0x00010000 &lt;ResetISR+0&gt;:     mov     r0, #5
  0x00010004 &lt;ResetISR+4&gt;:     mov     r1, #4
  0x00010008 &lt;ResetISR+8&gt;:     add     r2, r1, r0
  0x0001000c &lt;ResetISR_STOP+0&gt;:        b       0x1000c &lt;ResetISR_STOP&gt;
  0x00010010:  Cannot access memory at address 0x10010
  </code></pre>
  
  <p>I've seen similar posts (e.g. <a href="https://stackoverflow.com/questions/13188442/android-gdb-error-cannot-access-memory-at-address?rq=1">android gdb error,&quot;Cannot access memory at address&quot;</a>), but no posts using the same code or environment as me.</p>
  
  <p>Any ideas?</p>
  
  <hr>
  
  <p><strong>NOTE:</strong> The avd is setup with:</p>
  
  <ul>
  <li><strong>Target:</strong> Android 4.03</li>
  <li><strong>CPU/API:</strong> armeabi-v7a</li>
  </ul>