| Version 4 (modified by , 18 years ago) (diff) |
|---|
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, to put in hello.task:
TaskModel(
'hello_task_model',
impl = [
SwTask('hello', stack_size = 128, sources = ['hello.c'])
] )
Test under Posix
Let's create a task graph containing only this one, in tcg.py.
And let's generate Posix test application.
from dsx import *
tcg = Tcg( Task('hello', 'hello_task_model')
)
px = Posix()
tcg.generate(px)
Now we can launch it.
$ ./exe.posix Hello world! Hello world! Hello world! Hello world! Hello world! Hello world! Hello world! Hello world! ^C $
It works !
