1 /* run front end support for H8/500
2 Copyright (C) 1987, 1992 Free Software Foundation, Inc.
4 This file is part of H8300 SIM
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)
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.
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. */
33 bfd_vma start_address;
39 for (i = 1; i < ac; i++)
41 if (strcmp (av[i], "-v") == 0)
45 else if (strcmp (av[i], "-t") == 0)
49 else if (strcmp (av[i], "-p") == 0)
51 sim_set_profile(atoi(av[i+1]));
55 else if (strcmp (av[i], "-s") == 0)
57 sim_set_profile_size(atoi(av[i+1]));
60 else if (strcmp (av[i], "-m") == 0)
62 sim_size(atoi(av[i+1]));
72 printf ("run %s\n", name);
74 abfd = bfd_openr (name, "coff-sh");
78 if (bfd_check_format (abfd, bfd_object))
81 for (s = abfd->sections; s; s = s->next)
83 unsigned char *buffer = malloc (bfd_section_size (abfd, s));
84 bfd_get_section_contents (abfd,
88 bfd_section_size (abfd, s));
89 sim_write (s->vma, buffer, bfd_section_size (abfd, s));
92 start_address = bfd_get_start_address (abfd);
93 sim_set_pc (start_address);