OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc2/] [gcc/] [config/] [avr/] [driver-avr.c] - Diff between revs 282 and 384

Only display areas with differences | Details | Blame | View Log

Rev 282 Rev 384
/* Subroutines for the gcc driver.
/* Subroutines for the gcc driver.
   Copyright (C) 2009 Free Software Foundation, Inc.
   Copyright (C) 2009 Free Software Foundation, Inc.
   Contributed by Anatoly Sokolov <aesok@post.ru>
   Contributed by Anatoly Sokolov <aesok@post.ru>
 
 
This file is part of GCC.
This file is part of GCC.
 
 
GCC is free software; you can redistribute it and/or modify
GCC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, or (at your option)
the Free Software Foundation; either version 3, or (at your option)
any later version.
any later version.
 
 
GCC is distributed in the hope that it will be useful,
GCC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.
GNU General Public License for more details.
 
 
You should have received a copy of the GNU General Public License
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3.  If not see
along with GCC; see the file COPYING3.  If not see
<http://www.gnu.org/licenses/>.  */
<http://www.gnu.org/licenses/>.  */
 
 
#include "config.h"
#include "config.h"
#include "system.h"
#include "system.h"
#include "coretypes.h"
#include "coretypes.h"
#include "tm.h"
#include "tm.h"
#include <stdlib.h>
#include <stdlib.h>
 
 
/* Current architecture.  */
/* Current architecture.  */
const struct base_arch_s *avr_current_arch = NULL;
const struct base_arch_s *avr_current_arch = NULL;
 
 
/* Current device.  */
/* Current device.  */
const struct mcu_type_s *avr_current_device = NULL;
const struct mcu_type_s *avr_current_device = NULL;
 
 
/* Initialize avr_current_arch and avr_current_device variables.  */
/* Initialize avr_current_arch and avr_current_device variables.  */
 
 
static void
static void
avr_set_current_device (const char *name)
avr_set_current_device (const char *name)
{
{
 
 
 if (NULL != avr_current_arch)
 if (NULL != avr_current_arch)
   return;
   return;
 
 
  for (avr_current_device = avr_mcu_types; avr_current_device->name;
  for (avr_current_device = avr_mcu_types; avr_current_device->name;
       avr_current_device++)
       avr_current_device++)
    {
    {
      if (strcmp (avr_current_device->name, name) == 0)
      if (strcmp (avr_current_device->name, name) == 0)
        break;
        break;
    }
    }
 
 
  avr_current_arch = &avr_arch_types[avr_current_device->arch];
  avr_current_arch = &avr_arch_types[avr_current_device->arch];
}
}
 
 
/* Returns command line parameters that describe the device architecture.  */
/* Returns command line parameters that describe the device architecture.  */
 
 
const char *
const char *
avr_device_to_arch (int argc, const char **argv)
avr_device_to_arch (int argc, const char **argv)
{
{
  if (0 == argc)
  if (0 == argc)
    return;
    return;
 
 
  avr_set_current_device (argv[0]);
  avr_set_current_device (argv[0]);
 
 
  return concat ("-m ", avr_current_arch->arch_name, NULL);
  return concat ("-m ", avr_current_arch->arch_name, NULL);
}
}
 
 
/* Returns command line parameters that describe start of date section.  */
/* Returns command line parameters that describe start of date section.  */
 
 
const char *
const char *
avr_device_to_data_start (int argc, const char **argv)
avr_device_to_data_start (int argc, const char **argv)
{
{
  unsigned long data_section_start;
  unsigned long data_section_start;
  char data_section_start_str[16];
  char data_section_start_str[16];
 
 
  if (0 == argc)
  if (0 == argc)
    return;
    return;
 
 
  avr_set_current_device (argv[0]);
  avr_set_current_device (argv[0]);
 
 
  if (avr_current_device->data_section_start
  if (avr_current_device->data_section_start
      == avr_current_arch->default_data_section_start)
      == avr_current_arch->default_data_section_start)
    return NULL;
    return NULL;
 
 
  data_section_start = 0x800000 + avr_current_device->data_section_start;
  data_section_start = 0x800000 + avr_current_device->data_section_start;
 
 
  snprintf (data_section_start_str, sizeof(data_section_start_str) - 1,
  snprintf (data_section_start_str, sizeof(data_section_start_str) - 1,
            "0x%lX", data_section_start);
            "0x%lX", data_section_start);
 
 
  return concat ("-Tdata ", data_section_start_str, NULL);
  return concat ("-Tdata ", data_section_start_str, NULL);
}
}
 
 
/* Returns command line parameters that describe the device startfile.  */
/* Returns command line parameters that describe the device startfile.  */
 
 
const char *
const char *
avr_device_to_startfiles (int argc, const char **argv)
avr_device_to_startfiles (int argc, const char **argv)
{
{
  if (0 == argc)
  if (0 == argc)
    return;
    return;
 
 
  avr_set_current_device (argv[0]);
  avr_set_current_device (argv[0]);
 
 
  return concat ("crt", avr_current_device->library_name, ".o%s", NULL);
  return concat ("crt", avr_current_device->library_name, ".o%s", NULL);
}
}
 
 
/* Returns command line parameters that describe the device library.  */
/* Returns command line parameters that describe the device library.  */
 
 
const char *
const char *
avr_device_to_devicelib (int argc, const char **argv)
avr_device_to_devicelib (int argc, const char **argv)
{
{
  if (0 == argc)
  if (0 == argc)
    return;
    return;
 
 
  avr_set_current_device (argv[0]);
  avr_set_current_device (argv[0]);
 
 
  return concat ("-l", avr_current_device->library_name, NULL);
  return concat ("-l", avr_current_device->library_name, NULL);
}
}
 
 
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.