Hello,
I'm stuck by a weird problem. I built a simple HelloWorld axf with GNU toolchain gcc-arm-8.3-2019.03-x86_64-aarch64-elf , and tried to run it on the simulation model Base_RevC_AEMv8A. But I always got an exception when "mov w4, #3" was fetched an run from address 0x80000D24. When the exception occurred, the value of ESR_EL3 is 0x96000061 (Alignment fault). In DS-5 debugger, I stopped the program at the entry point, and set the PC to 0x80000D24 directly, then ran it, I still got the exception, but the value of ESR_EL3 is 0x96000040 (address size fault).
This is the steps to reproduce the issue:
1. In DS-5 debugger (Eclipse IDE), create a Debug configuration, targeting FVP_Base_RevC_2xAEMv8A, bare metal debug, with model parameters "-C bp.secure_memory=false"
2. Select the built hello.axf file, and check "Debug from entry point"
3. Apply the changes, and Debug, the program stops at 0x80000000.
4. Change PC to 0x80000D24, where the instruction is "mov w4, #3".
5. Step over the instruction. The execution jumps to 0x00000200, which should be Abort exception handler location, check the value of register ESR_EL3.
It seems any instruction at 0x80000D24 can lead to the exception, not specific to mov. But instructions at either 0x80000D20 ro 0x80000D28 can run without any problem.
It's much appreciated if you can shed me some light on this. My code and makefile are listed below.
The C code:
#include <stdio.h> const char *dStr="Hello, 64-bit world\n"; int main(int argc, char *argv[]) { puts(dStr); while(1); return 0; }
And the makefile:
all: hello.axf clean: rm -f hello.axf hello.o hello.axf: hello.c aarch64-elf-gcc -march=armv8-a+nofp -mtune=cortex-a53 \ -specs=rdimon.specs -mstrict-align -mlittle-endian \ -g -O0 -T ./build/script.lnk -o $@ $<
The link script script.lnk:
ENTRY(_start); SECTIONS { . = 0x80000000; .text : { *(.text) } . = ALIGN(16); .data : { *(.data) } . = ALIGN(16); .bss : { __bss_start__ = .; *(.bss) . = ALIGN(4); __bss_end__ = .; } . = ALIGN(16); PROVIDE ( end = . ); PROVIDE ( _end = . ); PROVIDE ( __end__ = . ); }