Atmel AVR example: source file main.c


 1  /*
 2  
 3  Main function for Bound-T test program tp_bro_int.
 4  
 5  This is the example program in the Bound-T brochure.
 6  
 7  This main() function contains mainly calls to functions.
 8  
 9  $Id: main.html,v 1.1 2010-02-27 09:52:18 niklas Exp $
10  */
11  
12  
13  #include "types.h"
14  #include "routines.h" 
15  
16  
17  int main (void)
18  {
19     uint x = 1;
20  
21     Count25 (&x);
22     /* This can be bounded automatically. */
23  
24     Foo7 (&x);
25     /* This can be bounded automatically because Foo7 calls */
26     /* Count with a static value for Count.u.               */
27  
28     Foo (6, &x);
29     /* This can be bounded automatically, because Foo.num = 6,  */
30     /* which makes Count.u = 9, which bounds the loop in Count. */
31  
32     Solve (&x);
33     /* The loop in Solve can be bounded automatically, but not */
34     /* the loop in Count when called from Solve.               */
35  
36     while (1) x++;
37     /* This is a simple eternal loop. Bound-T will report it */
38     /* and include one execution in the WCET.                */
39  
40  }