ARMv8 programs compilation

To compile ARMv8 assembler programs do the following:

  1. Download the toolchain either from this page (see below) or from here
  2. Unpack the gcc-linaro-...tar.xz archive into some "<toolchain>" folder
  3. Add "<toolchain>/bin" to the PATH environment variable.
  4. Supposing that you are compiling a sample.s ARMv8 assembler program, do the following:
aarch64-linux-gnu-as sample.s -march=armv8.2-a -o sample.o
aarch64-linux-gnu-ld --entry 0x0 sample.o -o sample.elf
aarch64-linux-gnu-objcopy -O binary sample.elf sample.bin

ARMv8 programs simulation

To simulate ARMv8 assembler programs do the following:

  1. Install the QEMU4V emulator.
  2. Supposing that you have compiled your sample program into sample.bin binary do the following:
qemu-system-aarch64 -M virt -cpu cortex-a57 -bios sample.bin -nographic

For every *.bin binary file it's own log file will be generated.
You may generate output log file in a Tarmac format by executing the QEMU4V emulator with the following parameters:

qemu-system-aarch64 -M virt -cpu cortex-a57 -bios sample.bin -d unimp,nochain,in_asm -singlestep -nographic -trace-log -D full-name-of-log-file.log

Updated by Alexander Protsenko about 1 year ago · 1 revisions