Skip to content

Instantly share code, notes, and snippets.

@zonomasa
Created October 18, 2014 09:39
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zonomasa/921f14b77a2546f2054b to your computer and use it in GitHub Desktop.
Save zonomasa/921f14b77a2546f2054b to your computer and use it in GitHub Desktop.
QEMU でARM エミュレータ環境を作成する ref: http://qiita.com/zonomasa/items/b33fba457503e166967a
$ sudo apt-get install qemu-user-static
$ sudo apt-get install gcc-arm-linux-gnueabi
#include <stdio.h>
int
main(int argc, char *argv[])
{
int a = 100;
printf("Hello,World\n");
printf("a:%d, &a:%p\n",a,&a);
return 0;
}
$ arm-linux-gnueabi-gcc sample.c
$ arm-linux-gnueabi-readelf -h a.out
ELF Header:
Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00
Class: ELF32
Data: 2's complement, little endian
Version: 1 (current)
OS/ABI: UNIX - System V
ABI Version: 0
Type: EXEC (Executable file)
Machine: ARM
Version: 0x1
Entry point address: 0x833c
Start of program headers: 52 (bytes into file)
Start of section headers: 4536 (bytes into file)
Flags: 0x5000202, has entry point, Version5 EABI, soft-float ABI
Size of this header: 52 (bytes)
Size of program headers: 32 (bytes)
Number of program headers: 9
Size of section headers: 40 (bytes)
Number of section headers: 30
Section header string table index: 27
$ qemu-arm-static -L /usr/arm-linux-gnueabi a.out
Hello,World
a:100, &a:0xf6fff44c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment