On Sat, Feb 14, 2015 at 3:28 PM, Kaspar Schleiser <kas...@schleiser.de> wrote: > > 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 like the main-application-init version because it is still somewhat simple to follow. Perhaps it would be possible to still keep the trampoline but make it execute application_init instead of main and let auto_init() execute from the trampoline. This eliminates the need to modify the example applications. > > ;) > > 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. ;) This is a good looking solution for a large project with a clear and well-specified build environment etc. but I think in this case we will be over-complicating the build system. BR, Joakim Gebart www.eistec.se _______________________________________________ devel mailing list devel@riot-os.org http://lists.riot-os.org/mailman/listinfo/devel