I'm working through an example in the book Embedded Programming with Android:
/*****************************************************************************/
.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
Source: https://github.com/shugaoye/bo/blob/master/c03/c03e1/c03e1.S
The output from building is as follows:
$ 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
I then run the android emulator as follows:
emulator -verbose -show-kernel -netfast -avd hd2 -shell -qemu -s -S –kernel gcc/c03e1.axf
Next I connect with ddd:
ddd --debugger arm-none-eabi-gdb gcc/c03e1.axf
When I open the the machine code window view in ddd I see the following error:
Dump of assembler code from 0x10000 to 0x10100:
0x00010000 <ResetISR+0>: mov r0, #5
0x00010004 <ResetISR+4>: mov r1, #4
0x00010008 <ResetISR+8>: add r2, r1, r0
0x0001000c <ResetISR_STOP+0>: b 0x1000c <ResetISR_STOP>
0x00010010: Cannot access memory at address 0x10010
I've seen similar posts (e.g. android gdb error,"Cannot access memory at address"), but no posts using the same code or environment as me.
Any ideas?
NOTE: The avd is setup with:
- Target: Android 4.03
- CPU/API: armeabi-v7a