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 defines the application entry function main().

#include "simba.h"

int main()
    /* Initialize modules and start the scheduler. */

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

    return (0);


Makefile contains build configuration of the application.

NAME = hello_world
BOARD ?= linux

RUN_END_PATTERN = "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!