H8/300 example: source file main.c


 1  /*
 2  
 3  Main function for Bound-T test program tp_bro.
 4  
 5  This is the example program in the Bound-T brochure.
 6  
 7  This main() function contains mainly calls to functions.
 8  
 9  */
10  
11  /*
12  $RCSfile: main.html,v $
13  $Revision: 1.1 $
14  $Date: 2010-02-25 19:03:39 $
15  $Log: main.html,v $
15  Revision 1.1  2010-02-25 19:03:39  niklas
15  First version.
15
16  Revision 1.3  2006/02/05 20:26:24  niklas
17  Removed CR line-endings.
18  
19  Revision 1.2  2006/02/05 20:15:32  Niklas
20  Make main return int.
21  
22  Revision 1.1  2006/02/05 14:22:24  niklas
23  First version.
24  
25  */
26  
27  
28  #include "types.h"
29  #include "routines.h" 
30  
31  
32  int main (void)
33  {
34     uint x = 1;
35  
36     Count25 (&x);
37     /* This can be bounded automatically. */
38  
39     Foo7 (&x);
40     /* This can be bounded automatically because Foo7 calls */
41     /* Count with a static value for Count.u.               */
42  
43     Foo (6, &x);
44     /* This can be bounded automatically, because Foo.num = 6,  */
45     /* which makes Count.u = 9, which bounds the loop in Count. */
46  
47     Solve (&x);
48     /* The loop in Solve can be bounded automatically, but not */
49     /* the loop in Count when called from Solve.               */
50  
51     while (1) x++;
52     /* This is a simple eternal loop. Bound-T will report it */
53     /* and include one execution in the WCET.                */
54  
55  }