Skip to content

Instantly share code, notes, and snippets.

@alexandernst
Last active December 30, 2016 06:04
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save alexandernst/5228155 to your computer and use it in GitHub Desktop.
Save alexandernst/5228155 to your computer and use it in GitHub Desktop.
Cross-compiling applications for ARM
$ pwd
/home/alexandernst/tmp_arm_build
$ cat hello_world.c
#include <stdio.h>
int main(int argc, char **argv){
printf("Hello world!\n");
return 0;
}
$ gcc -o hello_world hello_world.c
$ file hello_world
hello_world: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=890ead80cd49432f62fdea2309329a4f42c22c61, not stripped
$ ./hello_world
Hello world!
$ sb2 gcc -o hello_world hello_world.c
$ file hello_world
hello_world: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.16, not stripped
$ qemu-arm -L /home/alexandernst/tmp_buildroot/buildroot-2013.02_clean/buildroot-2013.02/output/host/opt/ext-toolchain/arm-none-linux-gnueabi/libc/ ./hello_world
Hello world!
$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment