aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/avr/avr-c.c
diff options
context:
space:
mode:
authorGeorg-Johann Lay <avr@gjlay.de>2015-03-10 09:50:41 +0000
committerGeorg-Johann Lay <gjl@gcc.gnu.org>2015-03-10 09:50:41 +0000
commit4a2caf6ced93a63e1703870ed67385d3f89da474 (patch)
treefa8390902e4ef79ccff88b2c2384679848448dc0 /gcc/config/avr/avr-c.c
parent768fbdd49e8535486ea71eebc507c3b813521a1b (diff)
downloadgcc-4a2caf6ced93a63e1703870ed67385d3f89da474.zip
gcc-4a2caf6ced93a63e1703870ed67385d3f89da474.tar.gz
gcc-4a2caf6ced93a63e1703870ed67385d3f89da474.tar.bz2
re PR target/65296 ([avr] fix various issues with specs file generation)
PR target/65296 * config.gcc (extra_options) [avr]: Remove. (extra_gcc_objs) [avr]: Use driver-avr.o, avr-devices.o. (tm_file) [avr]: Add avr/specs.h after avr/avr.h. (tm_defines) [avr-*-rtems*]: Add WITH_RTEMS. * config/avr/avr.opt (config/avr/avr-arch.h): Remove include. (-mmcu=): Add Var and MissingArgError properties. (-march=): Remove. * config/avr/genmultilib.awk: Use -mmcu= instead of -march=. * config/avr/t-multilib: Regenerate. * config/avr/specs.h: New file. * config/avr/driver-avr.c: New file. * config/avr/genopt.sh: Remove file. * config/avr/avr-tables.opt: Remove file. * config/avr/predicates.md (avr_current_arch): Rename to avr_arch. * config/avr/avr-c.c: Same. * avr-arch.h: Same. (avr_current_device): Remove proto. * config/avr/avr.h (avr_current_arch): Rename to avr_arch. (AVR_HAVE_8BIT_SP): Don't depend on avr_current_device. (EXTRA_SPEC_FUNCTIONS): Define. (avr_devicespecs_file): New specs function proto. (DRIVER_SELF_SPECS): Use device-specs-file spec function. * config/avr/avr.c (avr_current_arch): Rename to avr_arch. (avr_current_device): Remove definition and usage. (avr_set_core_architecture): New static function. (avr_option_override): Use it. * config/avr/avr-devices.c (diagnostic.h, avr-arch.h): Include them. (mcu_name): New static array. (comparator, avr_archs_str, avr_mcus_str): New static functions. (avr_inform_devices, avr_inform_core_architectures): New functions. * config/avr/gen-avr-mmcu-specs.c (avr-arch.h, specs.h): Include. (avrlibc.h) [WITH_AVRLIBC]: Include. (../rtems.h, rtems.h) [WITH_RTEMS]: Include. (print_mcu): Rewrite from scratch. * config/avr/avrlibc.h (LIB_SPEC, LIBGCC_SPEC, STARTFILE_SPEC): Forward to avr-specific specs defined in device-specs file. * config/avr/t-avr (driver-avr.o): New rule. (avr-devices.o): Depend on avr-arch.h. (avr-mcus): No more depend on avr-tables.opt. (avr-tables.opt): Remove rule. (install-device-specs): Use INSTALL_DATA, not INSTALL_PROGRAM. From-SVN: r221316
Diffstat (limited to 'gcc/config/avr/avr-c.c')
-rw-r--r--gcc/config/avr/avr-c.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/gcc/config/avr/avr-c.c b/gcc/config/avr/avr-c.c
index ffac50c..351982f 100644
--- a/gcc/config/avr/avr-c.c
+++ b/gcc/config/avr/avr-c.c
@@ -305,8 +305,11 @@ avr_cpu_cpp_builtins (struct cpp_reader *pfile)
builtin_define_std ("AVR");
- if (avr_current_arch->macro)
- cpp_define_formatted (pfile, "__AVR_ARCH__=%s", avr_current_arch->macro);
+ /* __AVR_DEVICE_NAME__ and avr_mcu_types[].macro like __AVR_ATmega8__
+ are defined by -D command option, see device-specs file. */
+
+ if (avr_arch->macro)
+ cpp_define_formatted (pfile, "__AVR_ARCH__=%s", avr_arch->macro);
if (AVR_HAVE_RAMPD) cpp_define (pfile, "__AVR_HAVE_RAMPD__");
if (AVR_HAVE_RAMPX) cpp_define (pfile, "__AVR_HAVE_RAMPX__");
if (AVR_HAVE_RAMPY) cpp_define (pfile, "__AVR_HAVE_RAMPY__");
@@ -316,14 +319,14 @@ avr_cpu_cpp_builtins (struct cpp_reader *pfile)
if (AVR_HAVE_MOVW) cpp_define (pfile, "__AVR_HAVE_MOVW__");
if (AVR_HAVE_LPMX) cpp_define (pfile, "__AVR_HAVE_LPMX__");
- if (avr_current_arch->asm_only)
+ if (avr_arch->asm_only)
cpp_define (pfile, "__AVR_ASM_ONLY__");
if (AVR_HAVE_MUL)
{
cpp_define (pfile, "__AVR_ENHANCED__");
cpp_define (pfile, "__AVR_HAVE_MUL__");
}
- if (avr_current_arch->have_jmp_call)
+ if (avr_arch->have_jmp_call)
{
cpp_define (pfile, "__AVR_MEGA__");
cpp_define (pfile, "__AVR_HAVE_JMP_CALL__");
@@ -347,7 +350,7 @@ avr_cpu_cpp_builtins (struct cpp_reader *pfile)
cpp_define (pfile, "__AVR_TINY_PM_BASE_ADDRESS__=0x4000");
}
- if (avr_current_arch->have_eijmp_eicall)
+ if (AVR_HAVE_EIJMP_EICALL)
{
cpp_define (pfile, "__AVR_HAVE_EIJMP_EICALL__");
cpp_define (pfile, "__AVR_3_BYTE_PC__");
@@ -362,11 +365,10 @@ avr_cpu_cpp_builtins (struct cpp_reader *pfile)
else
cpp_define (pfile, "__AVR_HAVE_16BIT_SP__");
- if (avr_sp8)
- cpp_define (pfile, "__AVR_SP8__");
-
if (AVR_HAVE_SPH)
cpp_define (pfile, "__AVR_HAVE_SPH__");
+ else
+ cpp_define (pfile, "__AVR_SP8__");
if (TARGET_NO_INTERRUPTS)
cpp_define (pfile, "__NO_INTERRUPTS__");
@@ -375,7 +377,7 @@ avr_cpu_cpp_builtins (struct cpp_reader *pfile)
{
cpp_define (pfile, "__AVR_ERRATA_SKIP__");
- if (avr_current_arch->have_jmp_call)
+ if (AVR_HAVE_JMP_CALL)
cpp_define (pfile, "__AVR_ERRATA_SKIP_JMP_CALL__");
}
@@ -383,7 +385,7 @@ avr_cpu_cpp_builtins (struct cpp_reader *pfile)
cpp_define (pfile, "__AVR_ISA_RMW__");
cpp_define_formatted (pfile, "__AVR_SFR_OFFSET__=0x%x",
- avr_current_arch->sfr_offset);
+ avr_arch->sfr_offset);
#ifdef WITH_AVRLIBC
cpp_define (pfile, "__WITH_AVRLIBC__");