Hi,

On 02/14/15 12:28, Ludwig Ortmann wrote:
I created quick&dirty branches for both methods:

plain c:
https://github.com/LudwigOrtmann/RIOT/tree/wip/remove-main-application-init
macro magic:
https://github.com/LudwigOrtmann/RIOT/tree/wip/remove-main-make

Not sure which one I dislike better ;)
;)

I think we should come up with a method that enables inclusion of multiple application threads. Maybe we can even replace auto_init in the process.

We could have something like

struct _auto_thread {
        char* name;
        char* stack;
        int stacksize;
        ...
};

struct _auto_threads[] = {
  {"idle", idle_stack, STACKSIZE_IDLE, PRIORITY_IDLE, NULL },
  {"default", main_stack, STACKSIZE_MAIN, PRIORITY_MAIN, NULL },
  {"application", app_stack, ... }
};

The second struct we create during the build process and write it to a file that gets includes by kernel_init.c. There, we just traverse the list in order to start the threads.

For the makefiles we devise a way to declare these threads. Maybe something easily parsable like

THREADS += "(application;PRIORITY_MAIN+1;STACKSIZE_MAIN+STACKSIZE_PRINTF;dependency1,transceiver)"

... with a lot of sensible defaults so John Duino can just do

THREADS += my_app

We could also introduce some kind of "image build description" file that holds the necessary thread configuration:

E.g., defining one thread named "default" using a default stacksize, default function name (default_thread), with a dependency on transceiver:
----- examples/default/default.yaml:
default:
        depends: [ transceiver ]
-----

Defaults and modules:
----- modules.yaml:
_defaults:
        stacksize: STACKSIZE_MAIN

transceiver:
        depends: [ pkt_buf ]
        stacksize: INTERESTING_DEFINE

dumb_module:
        thread: false # this module doesn't have a thread
        init: true # we will call "dumb_module_init" on bootup
-----   

All that we parse and auto-generate the corresponding C code.

Not sure if we're entering a world of pain this way. ;)

Kaspar


_______________________________________________
devel mailing list
devel@riot-os.org
http://lists.riot-os.org/mailman/listinfo/devel

Reply via email to