Checkpoint for dje.
[deliverable/binutils-gdb.git] / sim / h8300 / run.c
1 /* front end to the simulator.
2
3 Written by Steve Chamberlain of Cygnus Support.
4 sac@cygnus.com
5
6 This file is part of H8/300 sim
7
8
9 THIS SOFTWARE IS NOT COPYRIGHTED
10
11 Cygnus offers the following for use in the public domain. Cygnus
12 makes no warranty with regard to the software or it's performance
13 and the user accepts the software "AS IS" with all faults.
14
15 CYGNUS DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED, WITH REGARD TO
16 THIS SOFTWARE INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
18
19 */
20
21 #include "bfd.h"
22 #include "sysdep.h"
23
24 int
25 main (ac, av)
26 int ac;
27 char **av;
28 {
29 bfd *abfd;
30 bfd_vma start_address;
31 asection *s;
32 int i;
33 int verbose = 0;
34 int trace = 0;
35 char *name = "";
36 for (i = 1; i < ac; i++)
37 {
38 if (strcmp(av[i],"-v") == 0)
39 verbose++;
40
41 else if (strcmp(av[i],"-t") == 0)
42 {
43 trace = 1;
44 }
45 else if (strcmp(av[i],"-c") == 0)
46 {
47 sim_csize(atoi(av[i+1]));
48 i++;
49 }
50
51 else
52
53 if (verbose)
54
55 {
56
57 name = av[i];
58
59 printf ("run %s\n", name);
60
61 }
62 abfd = bfd_openr (name, "coff-h8300");
63 if (abfd)
64 {
65 if (bfd_check_format(abfd, bfd_object))
66 {
67
68 for (s = abfd->sections; s; s=s->next)
69 {
70 char *buffer = malloc(bfd_section_size(abfd,s));
71 bfd_get_section_contents(abfd, s, buffer, 0, bfd_section_size(abfd,s));
72 sim_write(s->vma, buffer, bfd_section_size(abfd,s));
73 }
74
75 start_address = bfd_get_start_address(abfd);
76 sim_store_register(
77 9,start_address);
78 sim_resume(0,0);
79 if (verbose)
80 sim_info (verbose);
81 return 0;
82 }
83 }
84
85 }
86
87 return 1;
88 }
This page took 0.0324 seconds and 5 git commands to generate.