From bdc5f9370cf1ee5b83cacc29fc737e458d173f70 Mon Sep 17 00:00:00 2001 From: Pitchumani Sivanupandi Date: Wed, 30 Nov 2016 15:07:37 +0000 Subject: [PATCH] Commit files forgotten in r242966. 2016-11-30 Pitchumani Sivanupandi Commit files forgotten in r242966. * config/avr/avr-arch.h (avr_mcu_t) [flash_size]: New member. * config/avr/avr-devices.c (avr_mcu_types): Add flash size info. * config/avr/gen-avr-mmcu-specs.c (print_mcu): Remove hard-coded prefix check to find wrap-around value, instead use MCU flash size. For 8k flash devices, update link_pmem_wrap spec string to add --pmem-wrap-around=8k. * config/avr/specs.h (LINK_RELAX_SPEC): Move link_pmem_wrap from here... (LINK_SPEC): ...to here. From-SVN: r243033 --- gcc/ChangeLog | 24 +++++++++++++++--------- gcc/config/avr/avr-arch.h | 3 +++ gcc/config/avr/avr-devices.c | 6 +++--- gcc/config/avr/gen-avr-mmcu-specs.c | 15 +++++++-------- gcc/config/avr/specs.h | 3 ++- 5 files changed, 30 insertions(+), 21 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 378ffa484e1..80b1c90be61 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,17 @@ +2016-11-30 Pitchumani Sivanupandi + + Commit files forgotten in r242966. + + * config/avr/avr-arch.h (avr_mcu_t) [flash_size]: New member. + * config/avr/avr-devices.c (avr_mcu_types): Add flash size info. + * config/avr/gen-avr-mmcu-specs.c (print_mcu): Remove hard-coded + prefix check to find wrap-around value, instead use MCU flash size. + For 8k flash devices, update link_pmem_wrap spec string to + add --pmem-wrap-around=8k. + * config/avr/specs.h (LINK_RELAX_SPEC): Move link_pmem_wrap from + here... + (LINK_SPEC): ...to here. + 2016-11-30 David Malcolm PR c/78498 @@ -190,15 +204,7 @@ 2016-11-29 Pitchumani Sivanupandi - * config/avr/avr-arch.h (avr_mcu_t): Add flash_size member. - * config/avr/avr-devices.c(avr_mcu_types): Add flash size info. - * config/avr/avr-mcu.def: Likewise. - * config/avr/gen-avr-mmcu-specs.c (print_mcu): Remove hard-coded prefix - check to find wrap-around value, instead use MCU flash size. For 8k - flash devices, update link_pmem_wrap spec string to add - --pmem-wrap-around=8k. - * config/avr/specs.h: Remove link_pmem_wrap from LINK_RELAX_SPEC and - add to linker specs (LINK_SPEC) directly. + * config/avr/avr-mcu.def: (avr_mcu_types): Add flash size info. 2016-11-29 David Malcolm diff --git a/gcc/config/avr/avr-arch.h b/gcc/config/avr/avr-arch.h index a740a151105..e6a2d75c5fd 100644 --- a/gcc/config/avr/avr-arch.h +++ b/gcc/config/avr/avr-arch.h @@ -122,6 +122,9 @@ typedef struct /* Number of 64k segments in the flash. */ int n_flash; + + /* Flash size in bytes. */ + int flash_size; } avr_mcu_t; /* AVR device specific features. diff --git a/gcc/config/avr/avr-devices.c b/gcc/config/avr/avr-devices.c index 7d13ba4da66..cef3b9aa0a2 100644 --- a/gcc/config/avr/avr-devices.c +++ b/gcc/config/avr/avr-devices.c @@ -111,12 +111,12 @@ avr_texinfo[] = const avr_mcu_t avr_mcu_types[] = { -#define AVR_MCU(NAME, ARCH, DEV_ATTRIBUTE, MACRO, DATA_SEC, TEXT_SEC, N_FLASH)\ - { NAME, ARCH, DEV_ATTRIBUTE, MACRO, DATA_SEC, TEXT_SEC, N_FLASH }, +#define AVR_MCU(NAME, ARCH, DEV_ATTRIBUTE, MACRO, DATA_SEC, TEXT_SEC, N_FLASH, FLASH_SIZE)\ + { NAME, ARCH, DEV_ATTRIBUTE, MACRO, DATA_SEC, TEXT_SEC, N_FLASH, FLASH_SIZE }, #include "avr-mcus.def" #undef AVR_MCU /* End of list. */ - { NULL, ARCH_UNKNOWN, AVR_ISA_NONE, NULL, 0, 0, 0 } + { NULL, ARCH_UNKNOWN, AVR_ISA_NONE, NULL, 0, 0, 0, 0 } }; diff --git a/gcc/config/avr/gen-avr-mmcu-specs.c b/gcc/config/avr/gen-avr-mmcu-specs.c index 9ea987f6add..ee75b1eb8ec 100644 --- a/gcc/config/avr/gen-avr-mmcu-specs.c +++ b/gcc/config/avr/gen-avr-mmcu-specs.c @@ -215,17 +215,16 @@ print_mcu (const avr_mcu_t *mcu) // avr-specific specs for linking / the linker. int wrap_k = - str_prefix_p (mcu->name, "at90usb8") ? 8 - : str_prefix_p (mcu->name, "atmega16") ? 16 - : (str_prefix_p (mcu->name, "atmega32") - || str_prefix_p (mcu->name, "at90can32")) ? 32 - : (str_prefix_p (mcu->name, "atmega64") - || str_prefix_p (mcu->name, "at90can64") - || str_prefix_p (mcu->name, "at90usb64")) ? 64 + mcu->flash_size == 0x2000 ? 8 + : mcu->flash_size == 0x4000 ? 16 + : mcu->flash_size == 0x8000 ? 32 + : mcu->flash_size == 0x10000 ? 64 : 0; fprintf (f, "*link_pmem_wrap:\n"); - if (wrap_k) + if (wrap_k == 8) + fprintf (f, "\t%%{!mno-pmem-wrap-around: --pmem-wrap-around=8k}"); + else if (wrap_k > 8) fprintf (f, "\t%%{mpmem-wrap-around: --pmem-wrap-around=%dk}", wrap_k); fprintf (f, "\n\n"); diff --git a/gcc/config/avr/specs.h b/gcc/config/avr/specs.h index 222ad5badae..b5fef338e48 100644 --- a/gcc/config/avr/specs.h +++ b/gcc/config/avr/specs.h @@ -58,7 +58,7 @@ along with GCC; see the file COPYING3. If not see "%{mmcu=*:-m%*} " #define LINK_RELAX_SPEC \ - "%{mrelax:--relax %(link_pmem_wrap)} " + "%{mrelax:--relax} " #undef LINK_SPEC #define LINK_SPEC \ @@ -66,6 +66,7 @@ along with GCC; see the file COPYING3. If not see "%(link_data_start) " \ "%(link_text_start) " \ "%(link_relax) " \ + "%(link_pmem_wrap) " \ "%{shared:%eshared is not supported} " #undef LIB_SPEC -- 2.30.2