我正在研究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
来源:https://github.com/shugaoye/bo/blob/master/c03/c03e1/c03e1.S
建筑物的输出如下:
$ 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
然后按如下方式运行android模拟器:
emulator -verbose -show-kernel -netfast -avd hd2 -shell -qemu -s -S –kernel gcc/c03e1.axf
接下来我用ddd连接:
ddd --debugger arm-none-eabi-gdb gcc/c03e1.axf
当我在ddd中打开机器代码窗口视图时,我看到以下错误:
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
我看过类似的帖子(例如android gdb error,"Cannot access memory at address"),但没有使用与我相同的代码或环境的帖子。
有什么想法吗?
注意: avd设置为: