* p1.c, p3.c, run.c, writecode.c: all used h8/300 opcodes in and
[deliverable/binutils-gdb.git] / sim / h8300 / run.c
1 /* run front end support for H8/300
2 Copyright (C) 1987, 1992 Free Software Foundation, Inc.
3
4 This file is part of H8300 SIM
5
6 GNU CC 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, or (at your option)
9 any later version.
10
11 GNU CC 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.
15
16 You should have received a copy of the GNU General Public License
17 along with GNU CC; see the file COPYING. If not, write to
18 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
19
20
21 /* Steve Chamberlain
22 sac@cygnus.com */
23
24 #include "bfd.h"
25 #include "sysdep.h"
26
27 int
28 main(ac,av)
29 int ac;
30 char **av;
31 {
32 bfd *abfd;
33 bfd_vma start_address;
34 asection *s;
35 int i;
36 int verbose = 0;
37 int trace = 0;
38 char *name = "";
39 for (i = 1; i < ac; i++)
40 {
41 if (strcmp(av[i],"-v") == 0)
42 {
43 verbose = 1;
44 }
45 else if (strcmp(av[i],"-t") == 0)
46 {
47 trace = 1;
48 }
49
50 else
51 {
52 name = av[i];
53 }
54 }
55 if (verbose)
56 {
57 printf("run %s\n", name);
58 }
59 abfd = bfd_openr(name,"coff-h8300");
60 if (abfd) {
61
62 if (bfd_check_format(abfd, bfd_object))
63 {
64
65 for (s = abfd->sections; s; s=s->next)
66 {
67 char *buffer = malloc(bfd_section_size(abfd,s));
68 bfd_get_section_contents(abfd, s, buffer, 0, bfd_section_size(abfd,s));
69 sim_write(s->vma, buffer, bfd_section_size(abfd,s));
70 }
71
72 start_address = bfd_get_start_address(abfd);
73 sim_store_register(
74 9,start_address);
75 sim_resume(0,0);
76 return 0;
77 }
78 }
79
80 return 1;
81 }
This page took 0.031093 seconds and 5 git commands to generate.