X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;ds=sidebyside;f=boards%2Fat91sam7x-ek%2Fbenchmark%2Fkernel_footprint_coop%2Fmain.c;fp=boards%2Fat91sam7x-ek%2Fbenchmark%2Fkernel_footprint_coop%2Fmain.c;h=661bb54b2d41d277f147ff2d7b6f6696c7824aff;hb=cf0e85cf28635514f0e0956929605df8c2566882;hp=0000000000000000000000000000000000000000;hpb=ea12a07185cfa16b2a37d39ec7bdaf988b283c0c;p=bertos.git diff --git a/boards/at91sam7x-ek/benchmark/kernel_footprint_coop/main.c b/boards/at91sam7x-ek/benchmark/kernel_footprint_coop/main.c new file mode 100644 index 00000000..661bb54b --- /dev/null +++ b/boards/at91sam7x-ek/benchmark/kernel_footprint_coop/main.c @@ -0,0 +1,91 @@ +/** + * \file + * + * + * \author Luca Ottaviano + * \author Andrea Righi + * \author Daniele Basile + * + * \brief Kernel Cooperative footprint benchmark. + * This simple application show you the kernel footprint for a typical use. Genereally + * in the application that we want use the kernel, we use a process, send ad recv message + * from process or using signals. + * Compile this application and see the size of the bin file generated, typically, whitout + * any compile optimization, the size shold be about 4Kbyte (whit arm-2009q3 toolchain), if + * we optimize the compilation for size using the -Os gcc flag the image size result about + * 2Kbyte. + * + * Note: by default this project compile without any compile optimization, so if we + * want to try to change it go to kernel_footprint_coop_user.mk, and add the flag + * in the section kernel_footprint_coop_USER_CPPFLAGS. + * To see the effect optimization flag you shoul clean the project and rebuild it. + */ + +#include +#include +#include +#include + +MsgPort in_port; + +static void init(void) +{ + IRQ_ENABLE; + proc_init(); +} + +static PROC_DEFINE_STACK(proc1_stack, KERN_MINSTACKSIZE); + +static void proc1_main(void) +{ + +} + +int main(void) +{ + init(); + // generate code for process + struct Process *p = proc_new(proc1_main, 0, sizeof(proc1_stack), proc1_stack); + proc_setPri(p, 5); + proc_yield(); + // generate code for msg + Msg msg; + msg_initPort(&in_port, event_createSignal(p, SIG_USER1)); + msg_put(&in_port, &msg); + msg_peek(&in_port); + Msg *msg_re = msg_get(&in_port); + msg_reply(msg_re); + // generate code for signals + sig_send(p, SIG_USER0); + sig_wait(SIG_USER0); + + return 0; +}