This post is intended to the Systems Science students taking the Embedded Systems course at IIT Jodhpur.
The Keil IDE is inefficient to do normal programming for the ARM platform, and setting up a virtual machine on an ARM processor is too hectic. But it turns out QEMU can run the binaries using the host OS itself, so its dead simple to set up an ARM system on your Linux.
I will be using the Ubuntu distro for the same.
Install the following packages from the Terminal.
$ sudo apt-get install gcc-4.6-arm-linux-gnueabi libc6-dev-armel-cross qemu-user-static
Write some assembly in your text editor. There are some differences from the syntax taught in class.
There is no AREA and ENTRY directive. Instead to define an entry point for your program use a label _start. Then on top add
to signify that it is the global start for your program. Also any label needs to be followed by a :.
Here is a sample program that calculates the factorial of 10.[gist 343ccc4f48020f656c14]
To assemble this execute:
$ arm-linux-gnueabi-as -o factorial.o factorial.s
To create an executable file:
$ arm-linux-gnueabi-ld -o factorial factorial.o
Just to verify that the files you created are for the ARM platform, you can do:
$ file factorial factorial: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, not stripped
Finally to execute:
Hence, we have a fully functional ARM build from our host Linux system itself.