wiki:HelloWorld

Hello World

Hello world is the basic useless example. It tends to prove you have a complete working setup.

This example will print "Hello world !" message infinitely repeated (due tu DsxTasks).

Task

First we will create our task and declare it.

hello.c:

#include <srl.h>
#include "hello_proto.h"

FUNC(hello) {
    srl_log_printf(NONE, "Hello world!\n");
}

Task description in dsx's API:

hello_task = TaskModel(
        'hello',
        impl = [
        SwTask('hello', stack_size = 128, sources = ['hello.c'])
        ] )

Test under Posix

Let's create a task graph containing only this one.

tcg = Tcg( Task('hello', hello_task)
         )

And let's create Posix test application (and also a TopMakefile):

px = Posix()

tcg.generate(px)
TopMakefile(px)

Now we can compile and launch it.

$ make
[...]
$ ./exe.posix
Hello world!
Hello world!
Hello world!
Hello world!
Hello world!
Hello world!
Hello world!
Hello world!
^C
$ 

It works !

Last modified 16 years ago Last modified on Feb 20, 2008, 9:15:47 AM