-
Notifications
You must be signed in to change notification settings - Fork 5
Hello World program for Embedded Platform
The SBC supplier provided us with an SD card image with a "Linaro" build. This is an ubuntu derivative so there should be no problems regarding the distribution choice. To be able to build and try out programs for the target platform OS without needing the hardware we provide a development package which should make this process as easy as possible. The goal is to be able to start now to show if there are problems building for the target platform, e.g. when using special x86 instructions or x86-only libraries, etc. Inside this package you find a README with instructions, a "hello world" example and a "chroot"-shell script using schroot to provide an emulated ARM-environment in a chroot (http://en.wikipedia.org/wiki/Chroot). Inside this chroot environment you should be able to build and execute any program that should also run on the target platform as long as no hardware access is tried.
- install qemu-arm-static (debian package qemu-user-static) and schroot (debian package schroot):
sudo apt-get install qemu-arm-static schroot
(Ubuntu 14.04) or
sudo apt-get install qemu-user-static schroot
(Ubuntu >= 16.04)
- download the latest version of Ubuntu image
https://github.com/Fraunhofer-IIS/ogre/releases
- the md5sum should be checked:
md5sum -c checksum.md5
- unpack the Ubuntu image:
tar -xvf ubuntu_14.04_arm_fhg_$(VERSION).tar.gz
- create an entry in /etc/schroot/schroot.conf (/PATH/TO/ROOTFS/DIRECTORY and USER_* have to be changed)
[ubuntu-arm]
type=directory
directory=/PATH/TO/ROOTFS/DIRECTORY
users=USER_1,USER_2,USER_3
Please check that users USER_* have the correct rights to access the directory specified.
- change to build environment
schroot -c ubuntu-arm
You can skip this, if you cannot find the example.
cd /PATH/TO/EXAMPLE
make
./hello_world
(ubuntu-arm)user@machine:~$ vi hello_world.c
(ubuntu-arm)user@machine:~$ gcc hello_world.c -o hello_world
(ubuntu-arm)user@machine:~$ ./hello_world