Hello World application

Let’s start with the Simba “Hello World” application. It examplifies what an application is and how to build and run it.

It consists of two files; main.c and Makefile.

main.c

main.c defines the application entry function main().

#include "simba.h"

int main()
{
    /* Start the system. */
    sys_start();

    std_printf(FSTR("Hello world!\n"));
}

Makefile

Makefile contains build configuration of the application.

NAME = hello_world
BOARD ?= linux

RUN_END_PATTERN = "Hello world!"
RUN_END_PATTERN_SUCCESS = "Hello world!"

SIMBA_ROOT = ../..
include $(SIMBA_ROOT)/make/app.mk

Build and run

Compile, link and run it by typing the commands below in a shell:

$ cd examples/hello_world
$ make -s run
<build system output>
Hello world!
$

Cross-compile, link and then run on an Arduino Due:

$ cd examples/hello_world
$ make -s BOARD=arduino_due run
<build system output>
Hello world!
$