22.3. A “hello world” command

The creation of a simple command written in C is straightforward. The user needs the appropriate toolchain and library packages installed and a source file containing, at a minimum, a main function.

Example 22.1. Hello World command

The classic minimal example is the “hello world” program which simply outputs a simple test message.

#include <stdio.h>>

main(int argc, char**argv)
  printf("hello world\n");

This is may be compiled directly as: /opt/simtec/able/bin/arm-able-gcc -o hello hello.c

The hello program may now be copied to a location accessible by ABLE (for example a http or tftp server) and executed. It will produce the expected result.

hello world