Statically Linked helloworld executable

/****helloworld.c begins/
#include <stdio.h>
#include <time.h>

#define SIZE 256

int main()
{
char buffer[SIZE];
time_t curtime;
struct tm *loctime;

/* Get the current time. */
curtime = time(NULL);

/* Convert it to local time representation. */
loctime = localtime(&curtime);

printf(“Nawab here from Sweden.\n”);

/* Print Date in a nice format. */
strftime(buffer,SIZE,“Today is %A, %B %d.\n”,loctime);
fputs(buffer,stdout);

return 0;
}
/helloworld.c ends*****/

/Readme.txt begins***********************/

helloworld.bin will be created as statically linked executable file.

Cross compiler for ARM to be intalled.

Install cross compiler for ARM
Run sudo apt-get install gcc-arm-linux-gnueabi’ to install.

Compile hellworld.c with the following command:-
arm-linux-gnueabi-gcc make -static -o hellobeagle.bin hellobeagle.c

Install qemu-user-static and run the executable
To install qemu-user-static, simply run ‘sudo apt-get install qemu-user-static’.

To invoke executable, run ‘qemu-arm-static ./hellobeagle.bin’

/Readme.txt ends**********/