4 * This file is part of BeRTOS.
6 * Bertos is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 * As a special exception, you may use this file as part of a free software
21 * library without restriction. Specifically, if other files instantiate
22 * templates or use macros or inline functions from this file, or you compile
23 * this file and link it with other files to produce an executable, this
24 * file does not by itself cause the resulting executable to be covered by
25 * the GNU General Public License. This exception does not however
26 * invalidate any other reasons why the executable file might be covered by
27 * the GNU General Public License.
29 * Copyright 2010 Develer S.r.l. (http://www.develer.com/)
33 * \author Luca Ottaviano <lottaviano@develer.com>
34 * \author Andrea Righi <arighi@develer.com>
35 * \author Daniele Basile <asterix@develer.com>
37 * \brief Kernel Cooperative footprint benchmark.
38 * This simple application show you the kernel footprint for a typical use. Genereally
39 * in the application that we want use the kernel, we use a process, send ad recv message
40 * from process or using signals.
41 * Compile this application and see the size of the bin file generated, typically, whitout
42 * any compile optimization, the size shold be about 4Kbyte (whit arm-2009q3 toolchain), if
43 * we optimize the compilation for size using the -Os gcc flag the image size result about
46 * Note: by default this project compile without any compile optimization, so if we
47 * want to try to change it go to kernel_footprint_coop_user.mk, and add the flag
48 * in the section kernel_footprint_coop_USER_CPPFLAGS.
49 * To see the flag optimization effects you shoul clean the project and rebuild it.
53 #include <kern/proc.h>
54 #include <kern/signal.h>
59 static void init(void)
65 static PROC_DEFINE_STACK(proc1_stack, KERN_MINSTACKSIZE);
67 static void proc1_main(void)
75 // generate code for process
76 struct Process *p = proc_new(proc1_main, 0, sizeof(proc1_stack), proc1_stack);
79 // generate code for msg
81 msg_initPort(&in_port, event_createSignal(p, SIG_USER1));
82 msg_put(&in_port, &msg);
84 Msg *msg_re = msg_get(&in_port);
86 // generate code for signals
87 sig_send(p, SIG_USER0);