« Previous - Version 8/10 (diff) - Next » - Current version
Sergey Smolov, 04/20/2017 11:05 am

Getting Started

In this chapter the main features of QEMU for ARMv8 tool are demonstrated. It is supposed that the following tools are successfully installed in your system:

- QEMU for ARMv8 (can be downloaded from here );
- Toolchain for Aarch64 assembler programs compilation, linking, etc. (can be downloaded from Linaro website or just below, installation instruction is here).

  1. First of all, let's write a simple Aarch64 program (it is called sample.s and is attached below) that does nothing but puts 0x10 value to X0 register and then halts. Here it is:
        .globl _start
        bl _start
        movz x1, #0x10, LSL #0
        hlt #57005
  2. To compile the Aarch64 assembler program called sample.s, do the following:
    aarch64-linux-gnu-as sample.s -o sample.o
    aarch64-linux-gnu-ld sample.o -o sample.elf
    aarch64-linux-gnu-objcopy -O binary sample.elf sample.bin
  3. Finally, run QEMU for ARMv8 emulator with enabled option of Tarmac logging:
    qemu-system-aarch64 -M virt -cpu cortex-a57 -bios sample.bin -d nochain,in_asm -singlestep -nographic -tarmac-log -D log-file.txt
  4. Wait for a while, then stop QEMU by hands (NOTE: sorry, but neither Ctrl-C nor Ctrl-Z works, use 'kill <process-id>' or 'killall qemu-system*', for example). The following log-file.txt Tarmac log file should be generated:
    0 clk IT (0) 0000000000000000 94000001 A svc_ns : bl #+0x4 (addr 0x4)
    1 clk IT (1) 0000000000000004 d2800201 A svc_ns : movz x1, #0x10, LSL #0
    2 clk IT (2) 0000000000000008 d45bd5a0 A svc_ns : hlt #57005

sample.s (70 Bytes) Sergey Smolov, 09/10/2015 05:17 pm

gcc-linaro-6.3.1-2017.02-x86_64_aarch64-linux-gnu.tar.xz (106 MB) Sergey Smolov, 05/30/2017 11:52 am