2 * Copyright Droids Corporation, Microb Technology, Eirbot (2005)
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 * Revision : $Id: test_stack_size.c,v 1.3.4.2 2007-05-23 17:18:12 zer0 Exp $
27 #include <aversive/wait.h>
30 #include <diagnostic.h>
34 // this functions calls itself and consumes stack every time
35 // the stack space indication should decrement every time
36 // when the stack is all consumed, the processor can do crazy things.
37 // most time it will reset
38 void recursive_call(void)
40 volatile int stack_size; // volatile necessary to put variable on stack
42 // printing the stacck space
43 stack_size = min_stack_space_available();
44 printf("stack size : %i\n", stack_size);
49 // consuming stack space
55 int test_stack_size(void)
61 fdevopen(uart0_dev_send,NULL);
64 printf("\n\nhello, I just reset !\nperhaps a lack of stack space\n");
66 // the beginning of the loop