Re: Ping: Re: [patch, avr] Add flash size to device info and make wrap around default
2016-11-30 18:09 GMT+03:00 Georg-Johann Lay: > On 30.11.2016 07:27, Pitchumani Sivanupandi wrote: >> >> On Tuesday 29 November 2016 10:06 PM, Denis Chertykov wrote: >>> >>> 2016-11-28 10:17 GMT+03:00 Pitchumani Sivanupandi >>> : On Saturday 26 November 2016 12:11 AM, Denis Chertykov wrote: > > I'm sorry for delay. > > I have a problem with the patch: > (Stripping trailing CRs from patch; use --binary to disable.) > patching file avr-arch.h > (Stripping trailing CRs from patch; use --binary to disable.) > patching file avr-devices.c > (Stripping trailing CRs from patch; use --binary to disable.) > patching file avr-mcus.def > Hunk #1 FAILED at 62. > 1 out of 1 hunk FAILED -- saving rejects to file avr-mcus.def.rej > (Stripping trailing CRs from patch; use --binary to disable.) > patching file gen-avr-mmcu-specs.c > Hunk #1 succeeded at 215 (offset 5 lines). > (Stripping trailing CRs from patch; use --binary to disable.) > patching file specs.h > Hunk #1 succeeded at 58 (offset 1 line). > Hunk #2 succeeded at 66 (offset 1 line). There are changes in avr-mcus.def after this patch is submitted. Now, I have incorporated the changes and attached the resolved patch. Regards, Pitchumani gcc/ChangeLog 2016-11-09 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. >>> >>> Committed. >> >> It looks like only avr-mcus.def and ChangeLog are committed. >> Without the other changes trunk build is broken. >> >> Regards, >> Pitchumani > > > Hi, I allowed me to commit the missing files. > > http://gcc.gnu.org/r243033 > Thank you.
Re: Ping: Re: [patch, avr] Add flash size to device info and make wrap around default
On 30.11.2016 07:27, Pitchumani Sivanupandi wrote: On Tuesday 29 November 2016 10:06 PM, Denis Chertykov wrote: 2016-11-28 10:17 GMT+03:00 Pitchumani Sivanupandi: On Saturday 26 November 2016 12:11 AM, Denis Chertykov wrote: I'm sorry for delay. I have a problem with the patch: (Stripping trailing CRs from patch; use --binary to disable.) patching file avr-arch.h (Stripping trailing CRs from patch; use --binary to disable.) patching file avr-devices.c (Stripping trailing CRs from patch; use --binary to disable.) patching file avr-mcus.def Hunk #1 FAILED at 62. 1 out of 1 hunk FAILED -- saving rejects to file avr-mcus.def.rej (Stripping trailing CRs from patch; use --binary to disable.) patching file gen-avr-mmcu-specs.c Hunk #1 succeeded at 215 (offset 5 lines). (Stripping trailing CRs from patch; use --binary to disable.) patching file specs.h Hunk #1 succeeded at 58 (offset 1 line). Hunk #2 succeeded at 66 (offset 1 line). There are changes in avr-mcus.def after this patch is submitted. Now, I have incorporated the changes and attached the resolved patch. Regards, Pitchumani gcc/ChangeLog 2016-11-09 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. Committed. It looks like only avr-mcus.def and ChangeLog are committed. Without the other changes trunk build is broken. Regards, Pitchumani Hi, I allowed me to commit the missing files. http://gcc.gnu.org/r243033 Johann
Re: Ping: Re: [patch, avr] Add flash size to device info and make wrap around default
On Tuesday 29 November 2016 10:06 PM, Denis Chertykov wrote: 2016-11-28 10:17 GMT+03:00 Pitchumani Sivanupandi: On Saturday 26 November 2016 12:11 AM, Denis Chertykov wrote: I'm sorry for delay. I have a problem with the patch: (Stripping trailing CRs from patch; use --binary to disable.) patching file avr-arch.h (Stripping trailing CRs from patch; use --binary to disable.) patching file avr-devices.c (Stripping trailing CRs from patch; use --binary to disable.) patching file avr-mcus.def Hunk #1 FAILED at 62. 1 out of 1 hunk FAILED -- saving rejects to file avr-mcus.def.rej (Stripping trailing CRs from patch; use --binary to disable.) patching file gen-avr-mmcu-specs.c Hunk #1 succeeded at 215 (offset 5 lines). (Stripping trailing CRs from patch; use --binary to disable.) patching file specs.h Hunk #1 succeeded at 58 (offset 1 line). Hunk #2 succeeded at 66 (offset 1 line). There are changes in avr-mcus.def after this patch is submitted. Now, I have incorporated the changes and attached the resolved patch. Regards, Pitchumani gcc/ChangeLog 2016-11-09 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. Committed. It looks like only avr-mcus.def and ChangeLog are committed. Without the other changes trunk build is broken. Regards, Pitchumani
Re: Ping: Re: [patch, avr] Add flash size to device info and make wrap around default
2016-11-28 10:17 GMT+03:00 Pitchumani Sivanupandi: > On Saturday 26 November 2016 12:11 AM, Denis Chertykov wrote: >> >> I'm sorry for delay. >> >> I have a problem with the patch: >> (Stripping trailing CRs from patch; use --binary to disable.) >> patching file avr-arch.h >> (Stripping trailing CRs from patch; use --binary to disable.) >> patching file avr-devices.c >> (Stripping trailing CRs from patch; use --binary to disable.) >> patching file avr-mcus.def >> Hunk #1 FAILED at 62. >> 1 out of 1 hunk FAILED -- saving rejects to file avr-mcus.def.rej >> (Stripping trailing CRs from patch; use --binary to disable.) >> patching file gen-avr-mmcu-specs.c >> Hunk #1 succeeded at 215 (offset 5 lines). >> (Stripping trailing CRs from patch; use --binary to disable.) >> patching file specs.h >> Hunk #1 succeeded at 58 (offset 1 line). >> Hunk #2 succeeded at 66 (offset 1 line). > > > There are changes in avr-mcus.def after this patch is submitted. > Now, I have incorporated the changes and attached the resolved patch. > > Regards, > Pitchumani > > gcc/ChangeLog > > 2016-11-09 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. Committed.
Re: Ping: Re: [patch, avr] Add flash size to device info and make wrap around default
On Saturday 26 November 2016 12:11 AM, Denis Chertykov wrote: I'm sorry for delay. I have a problem with the patch: (Stripping trailing CRs from patch; use --binary to disable.) patching file avr-arch.h (Stripping trailing CRs from patch; use --binary to disable.) patching file avr-devices.c (Stripping trailing CRs from patch; use --binary to disable.) patching file avr-mcus.def Hunk #1 FAILED at 62. 1 out of 1 hunk FAILED -- saving rejects to file avr-mcus.def.rej (Stripping trailing CRs from patch; use --binary to disable.) patching file gen-avr-mmcu-specs.c Hunk #1 succeeded at 215 (offset 5 lines). (Stripping trailing CRs from patch; use --binary to disable.) patching file specs.h Hunk #1 succeeded at 58 (offset 1 line). Hunk #2 succeeded at 66 (offset 1 line). There are changes in avr-mcus.def after this patch is submitted. Now, I have incorporated the changes and attached the resolved patch. Regards, Pitchumani gcc/ChangeLog 2016-11-09 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. diff --git a/gcc/config/avr/avr-arch.h b/gcc/config/avr/avr-arch.h index a740a15..e6a2d75 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 7d13ba4..cef3b9a 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/avr-mcus.def b/gcc/config/avr/avr-mcus.def index e5b4cda..4008741 100644 --- a/gcc/config/avr/avr-mcus.def +++ b/gcc/config/avr/avr-mcus.def @@ -62,295 +62,298 @@ N_FLASH Number of 64 KiB flash segments, rounded up. The default value for -mn-flash=. + FLASH_SIZEFlash size in bytes. + "avr2" must be first for the "0" default to work as intended. */ /* Classic, <= 8K. */ -AVR_MCU ("avr2", ARCH_AVR2, AVR_ERRATA_SKIP, NULL, 0x0060, 0x0, 6) -AVR_MCU ("at90s2313",ARCH_AVR2, AVR_SHORT_SP, "__AVR_AT90S2313__", 0x0060, 0x0, 1) -AVR_MCU ("at90s2323",ARCH_AVR2, AVR_SHORT_SP, "__AVR_AT90S2323__", 0x0060, 0x0, 1) -AVR_MCU ("at90s2333",ARCH_AVR2, AVR_SHORT_SP, "__AVR_AT90S2333__", 0x0060, 0x0, 1) -AVR_MCU ("at90s2343",ARCH_AVR2, AVR_SHORT_SP, "__AVR_AT90S2343__", 0x0060, 0x0, 1) -AVR_MCU ("attiny22", ARCH_AVR2, AVR_SHORT_SP, "__AVR_ATtiny22__", 0x0060, 0x0, 1) -AVR_MCU ("attiny26", ARCH_AVR2, AVR_SHORT_SP, "__AVR_ATtiny26__", 0x0060, 0x0, 1) -AVR_MCU ("at90s4414",ARCH_AVR2, AVR_ISA_NONE, "__AVR_AT90S4414__", 0x0060, 0x0, 1) -AVR_MCU ("at90s4433",ARCH_AVR2, AVR_SHORT_SP, "__AVR_AT90S4433__", 0x0060, 0x0, 1) -AVR_MCU ("at90s4434",ARCH_AVR2, AVR_ISA_NONE, "__AVR_AT90S4434__", 0x0060, 0x0, 1) -AVR_MCU ("at90s8515",ARCH_AVR2, AVR_ERRATA_SKIP, "__AVR_AT90S8515__", 0x0060, 0x0, 1) -AVR_MCU ("at90c8534",ARCH_AVR2, AVR_ISA_NONE, "__AVR_AT90C8534__", 0x0060, 0x0, 1) -AVR_MCU ("at90s8535",ARCH_AVR2, AVR_ISA_NONE, "__AVR_AT90S8535__", 0x0060, 0x0, 1) +AVR_MCU ("avr2", ARCH_AVR2, AVR_ERRATA_SKIP, NULL, 0x0060, 0x0, 6, 0x2000) + +AVR_MCU ("at90s2313",ARCH_AVR2, AVR_SHORT_SP, "__AVR_AT90S2313__", 0x0060, 0x0, 1, 0x800) +AVR_MCU ("at90s2323",ARCH_AVR2, AVR_SHORT_SP, "__AVR_AT90S2323__", 0x0060, 0x0, 1, 0x800) +AVR_MCU ("at90s2333",ARCH_AVR2, AVR_SHORT_SP, "__AVR_AT90S2333__", 0x0060, 0x0, 1, 0x800) +AVR_MCU ("at90s2343",ARCH_AVR2, AVR_SHORT_SP, "__AVR_AT90S2343__", 0x0060, 0x0, 1, 0x800) +AVR_MCU ("attiny22",
Re: Ping: Re: [patch, avr] Add flash size to device info and make wrap around default
I'm sorry for delay. I have a problem with the patch: (Stripping trailing CRs from patch; use --binary to disable.) patching file avr-arch.h (Stripping trailing CRs from patch; use --binary to disable.) patching file avr-devices.c (Stripping trailing CRs from patch; use --binary to disable.) patching file avr-mcus.def Hunk #1 FAILED at 62. 1 out of 1 hunk FAILED -- saving rejects to file avr-mcus.def.rej (Stripping trailing CRs from patch; use --binary to disable.) patching file gen-avr-mmcu-specs.c Hunk #1 succeeded at 215 (offset 5 lines). (Stripping trailing CRs from patch; use --binary to disable.) patching file specs.h Hunk #1 succeeded at 58 (offset 1 line). Hunk #2 succeeded at 66 (offset 1 line). 2016-11-22 23:27 GMT+03:00 Georg-Johann Lay: > Denis Chertykov schrieb: >> >> Do you have any objections, George ? > > > No, the last delta rev3 from 2016-11-10 looks fine to me. > > >> >> 2016-11-22 8:05 GMT+03:00 Pitchumani Sivanupandi >> : >>> >>> Ping! >>> >>> On Monday 14 November 2016 07:03 PM, Pitchumani Sivanupandi wrote: Ping! On Thursday 10 November 2016 01:53 PM, Pitchumani Sivanupandi wrote: > > On Wednesday 09 November 2016 08:05 PM, Georg-Johann Lay wrote: >> >> On 09.11.2016 10:14, Pitchumani Sivanupandi wrote: >>> >>> On Tuesday 08 November 2016 02:57 PM, Georg-Johann Lay wrote: On 08.11.2016 08:08, Pitchumani Sivanupandi wrote: > > I have updated patch to include the flash size as well. Took that > info from > device headers (it was fed into crt's device information note > section > also). >> >> >> The new option would render -mn-flash superfluous, but we should >> keep it for >> backward compatibility. > > Ok. >> >> Shouldn't link_pmem_wrap then be removed from link_relax, i.e. >> from >> LINK_RELAX_SPEC? And what happens if relaxation is off? > > Yes. Removed link_pmem_wrap from link_relax. > Disabling relaxation doesn't change -mpmem-wrap-around behavior. > > flashsize-and-wrap-around.patch > diff --git a/gcc/config/avr/avr-mcus.def > b/gcc/config/avr/avr-mcus.def > index 6bcc6ff..9d4aa1a 100644 > /* >>> >>> /* Classic, > 8K, <= 64K. */ >>> -AVR_MCU ("avr3", ARCH_AVR3, AVR_ISA_NONE, NULL, >>> 0x0060, 0x0, 1) >>> -AVR_MCU ("at43usb355", ARCH_AVR3, AVR_ISA_NONE, >>> "__AVR_AT43USB355__",0x0060, 0x0, 1) >>> -AVR_MCU ("at76c711", ARCH_AVR3, AVR_ISA_NONE, >>> "__AVR_AT76C711__", 0x0060, 0x0, 1) >>> +AVR_MCU ("avr3", ARCH_AVR3, AVR_ISA_NONE, NULL, >>> 0x0060, 0x0, 1, 0x6000) >>> +AVR_MCU ("at43usb355", ARCH_AVR3, AVR_ISA_NONE, >>> "__AVR_AT43USB355__",0x0060, 0x0, 1, 0x6000) >>> +AVR_MCU ("at76c711", ARCH_AVR3, AVR_ISA_NONE, >>> "__AVR_AT76C711__", 0x0060, 0x0, 1, 0x4000) >>> +AVR_MCU ("at43usb320", ARCH_AVR3, AVR_ISA_NONE, >>> "__AVR_AT43USB320__",0x0060, 0x0, 1, 0x1) >>> /* Classic, == 128K. */ >>> -AVR_MCU ("avr31",ARCH_AVR31, AVR_ERRATA_SKIP, NULL, >>> 0x0060, 0x0, 2) >>> -AVR_MCU ("atmega103",ARCH_AVR31, AVR_ERRATA_SKIP, >>> "__AVR_ATmega103__", 0x0060, 0x0, 2) >>> -AVR_MCU ("at43usb320", ARCH_AVR31, AVR_ISA_NONE, >>> "__AVR_AT43USB320__", 0x0060, 0x0, 2) >>> +AVR_MCU ("avr31",ARCH_AVR31, AVR_ERRATA_SKIP, NULL, >>> 0x0060, 0x0, 2, 0x2) >>> +AVR_MCU ("atmega103",ARCH_AVR31, AVR_ERRATA_SKIP, >>> "__AVR_ATmega103__", 0x0060, 0x0, 2, 0x2) >>> /* Classic + MOVW + JMP/CALL. */ >> >> >> If at43usb320 is in the wrong multilib, then this should be handled as >> separate issue / patch together with its own PR. Sorry for the >> confusion. I >> just noticed that some fields don't match... >> >> It is not even clear to me from the data sheet if avr3 is the correct >> multilib or perhaps avr35 (if it supports MOVW) or even avr5 (if it >> also has >> MUL) as there is no reference to the exact instruction set -- Atmochip >> will >> know. >> >> Moreover, such a change should be sync'ed with avr-libc as all >> multilib >> stuff is hand-wired there: no use of --print-foo meta information >> retrieval >> by avr-libc :-(( >> >> I filed PR78275 and https://savannah.nongnu.org/bugs/index.php?49565 >> for >> this one. >> > Thats better. I've attached the updated patch. If OK, could someone > commit please? > > I'll try if I could find some more info for AT43USB320. > > Regards, > Pitchumani > >> >
Re: Ping: Re: [patch, avr] Add flash size to device info and make wrap around default
Denis Chertykov schrieb: Do you have any objections, George ? No, the last delta rev3 from 2016-11-10 looks fine to me. 2016-11-22 8:05 GMT+03:00 Pitchumani Sivanupandi: Ping! On Monday 14 November 2016 07:03 PM, Pitchumani Sivanupandi wrote: Ping! On Thursday 10 November 2016 01:53 PM, Pitchumani Sivanupandi wrote: On Wednesday 09 November 2016 08:05 PM, Georg-Johann Lay wrote: On 09.11.2016 10:14, Pitchumani Sivanupandi wrote: On Tuesday 08 November 2016 02:57 PM, Georg-Johann Lay wrote: On 08.11.2016 08:08, Pitchumani Sivanupandi wrote: I have updated patch to include the flash size as well. Took that info from device headers (it was fed into crt's device information note section also). The new option would render -mn-flash superfluous, but we should keep it for backward compatibility. Ok. Shouldn't link_pmem_wrap then be removed from link_relax, i.e. from LINK_RELAX_SPEC? And what happens if relaxation is off? Yes. Removed link_pmem_wrap from link_relax. Disabling relaxation doesn't change -mpmem-wrap-around behavior. flashsize-and-wrap-around.patch diff --git a/gcc/config/avr/avr-mcus.def b/gcc/config/avr/avr-mcus.def index 6bcc6ff..9d4aa1a 100644 /* /* Classic, > 8K, <= 64K. */ -AVR_MCU ("avr3", ARCH_AVR3, AVR_ISA_NONE, NULL, 0x0060, 0x0, 1) -AVR_MCU ("at43usb355", ARCH_AVR3, AVR_ISA_NONE, "__AVR_AT43USB355__",0x0060, 0x0, 1) -AVR_MCU ("at76c711", ARCH_AVR3, AVR_ISA_NONE, "__AVR_AT76C711__", 0x0060, 0x0, 1) +AVR_MCU ("avr3", ARCH_AVR3, AVR_ISA_NONE, NULL, 0x0060, 0x0, 1, 0x6000) +AVR_MCU ("at43usb355", ARCH_AVR3, AVR_ISA_NONE, "__AVR_AT43USB355__",0x0060, 0x0, 1, 0x6000) +AVR_MCU ("at76c711", ARCH_AVR3, AVR_ISA_NONE, "__AVR_AT76C711__", 0x0060, 0x0, 1, 0x4000) +AVR_MCU ("at43usb320", ARCH_AVR3, AVR_ISA_NONE, "__AVR_AT43USB320__",0x0060, 0x0, 1, 0x1) /* Classic, == 128K. */ -AVR_MCU ("avr31",ARCH_AVR31, AVR_ERRATA_SKIP, NULL, 0x0060, 0x0, 2) -AVR_MCU ("atmega103",ARCH_AVR31, AVR_ERRATA_SKIP, "__AVR_ATmega103__", 0x0060, 0x0, 2) -AVR_MCU ("at43usb320", ARCH_AVR31, AVR_ISA_NONE, "__AVR_AT43USB320__", 0x0060, 0x0, 2) +AVR_MCU ("avr31",ARCH_AVR31, AVR_ERRATA_SKIP, NULL, 0x0060, 0x0, 2, 0x2) +AVR_MCU ("atmega103",ARCH_AVR31, AVR_ERRATA_SKIP, "__AVR_ATmega103__", 0x0060, 0x0, 2, 0x2) /* Classic + MOVW + JMP/CALL. */ If at43usb320 is in the wrong multilib, then this should be handled as separate issue / patch together with its own PR. Sorry for the confusion. I just noticed that some fields don't match... It is not even clear to me from the data sheet if avr3 is the correct multilib or perhaps avr35 (if it supports MOVW) or even avr5 (if it also has MUL) as there is no reference to the exact instruction set -- Atmochip will know. Moreover, such a change should be sync'ed with avr-libc as all multilib stuff is hand-wired there: no use of --print-foo meta information retrieval by avr-libc :-(( I filed PR78275 and https://savannah.nongnu.org/bugs/index.php?49565 for this one. Thats better. I've attached the updated patch. If OK, could someone commit please? I'll try if I could find some more info for AT43USB320. Regards, Pitchumani
Re: Ping: Re: [patch, avr] Add flash size to device info and make wrap around default
Do you have any objections, George ? 2016-11-22 8:05 GMT+03:00 Pitchumani Sivanupandi: > Ping! > > On Monday 14 November 2016 07:03 PM, Pitchumani Sivanupandi wrote: >> >> Ping! >> >> On Thursday 10 November 2016 01:53 PM, Pitchumani Sivanupandi wrote: >>> >>> On Wednesday 09 November 2016 08:05 PM, Georg-Johann Lay wrote: On 09.11.2016 10:14, Pitchumani Sivanupandi wrote: > > On Tuesday 08 November 2016 02:57 PM, Georg-Johann Lay wrote: >> >> On 08.11.2016 08:08, Pitchumani Sivanupandi wrote: >>> >>> I have updated patch to include the flash size as well. Took that >>> info from >>> device headers (it was fed into crt's device information note section >>> also). The new option would render -mn-flash superfluous, but we should keep it for backward compatibility. >>> >>> Ok. Shouldn't link_pmem_wrap then be removed from link_relax, i.e. from LINK_RELAX_SPEC? And what happens if relaxation is off? >>> >>> Yes. Removed link_pmem_wrap from link_relax. >>> Disabling relaxation doesn't change -mpmem-wrap-around behavior. >>> >>> flashsize-and-wrap-around.patch >> >> >>> diff --git a/gcc/config/avr/avr-mcus.def >>> b/gcc/config/avr/avr-mcus.def >>> index 6bcc6ff..9d4aa1a 100644 >> >> >>> /* >> >> > > /* Classic, > 8K, <= 64K. */ > -AVR_MCU ("avr3", ARCH_AVR3, AVR_ISA_NONE, NULL, > 0x0060, 0x0, 1) > -AVR_MCU ("at43usb355", ARCH_AVR3, AVR_ISA_NONE, > "__AVR_AT43USB355__",0x0060, 0x0, 1) > -AVR_MCU ("at76c711", ARCH_AVR3, AVR_ISA_NONE, > "__AVR_AT76C711__", 0x0060, 0x0, 1) > +AVR_MCU ("avr3", ARCH_AVR3, AVR_ISA_NONE, NULL, > 0x0060, 0x0, 1, 0x6000) > +AVR_MCU ("at43usb355", ARCH_AVR3, AVR_ISA_NONE, > "__AVR_AT43USB355__",0x0060, 0x0, 1, 0x6000) > +AVR_MCU ("at76c711", ARCH_AVR3, AVR_ISA_NONE, > "__AVR_AT76C711__", 0x0060, 0x0, 1, 0x4000) > +AVR_MCU ("at43usb320", ARCH_AVR3, AVR_ISA_NONE, > "__AVR_AT43USB320__",0x0060, 0x0, 1, 0x1) > /* Classic, == 128K. */ > -AVR_MCU ("avr31",ARCH_AVR31, AVR_ERRATA_SKIP, NULL, > 0x0060, 0x0, 2) > -AVR_MCU ("atmega103",ARCH_AVR31, AVR_ERRATA_SKIP, > "__AVR_ATmega103__", 0x0060, 0x0, 2) > -AVR_MCU ("at43usb320", ARCH_AVR31, AVR_ISA_NONE, > "__AVR_AT43USB320__", 0x0060, 0x0, 2) > +AVR_MCU ("avr31",ARCH_AVR31, AVR_ERRATA_SKIP, NULL, > 0x0060, 0x0, 2, 0x2) > +AVR_MCU ("atmega103",ARCH_AVR31, AVR_ERRATA_SKIP, > "__AVR_ATmega103__", 0x0060, 0x0, 2, 0x2) > /* Classic + MOVW + JMP/CALL. */ If at43usb320 is in the wrong multilib, then this should be handled as separate issue / patch together with its own PR. Sorry for the confusion. I just noticed that some fields don't match... It is not even clear to me from the data sheet if avr3 is the correct multilib or perhaps avr35 (if it supports MOVW) or even avr5 (if it also has MUL) as there is no reference to the exact instruction set -- Atmochip will know. Moreover, such a change should be sync'ed with avr-libc as all multilib stuff is hand-wired there: no use of --print-foo meta information retrieval by avr-libc :-(( I filed PR78275 and https://savannah.nongnu.org/bugs/index.php?49565 for this one. >>> Thats better. I've attached the updated patch. If OK, could someone >>> commit please? >>> >>> I'll try if I could find some more info for AT43USB320. >>> >>> Regards, >>> Pitchumani >>> >> >
Ping: Re: [patch, avr] Add flash size to device info and make wrap around default
Ping! On Monday 14 November 2016 07:03 PM, Pitchumani Sivanupandi wrote: Ping! On Thursday 10 November 2016 01:53 PM, Pitchumani Sivanupandi wrote: On Wednesday 09 November 2016 08:05 PM, Georg-Johann Lay wrote: On 09.11.2016 10:14, Pitchumani Sivanupandi wrote: On Tuesday 08 November 2016 02:57 PM, Georg-Johann Lay wrote: On 08.11.2016 08:08, Pitchumani Sivanupandi wrote: I have updated patch to include the flash size as well. Took that info from device headers (it was fed into crt's device information note section also). The new option would render -mn-flash superfluous, but we should keep it for backward compatibility. Ok. Shouldn't link_pmem_wrap then be removed from link_relax, i.e. from LINK_RELAX_SPEC? And what happens if relaxation is off? Yes. Removed link_pmem_wrap from link_relax. Disabling relaxation doesn't change -mpmem-wrap-around behavior. flashsize-and-wrap-around.patch diff --git a/gcc/config/avr/avr-mcus.def b/gcc/config/avr/avr-mcus.def index 6bcc6ff..9d4aa1a 100644 /* /* Classic, > 8K, <= 64K. */ -AVR_MCU ("avr3", ARCH_AVR3, AVR_ISA_NONE, NULL,0x0060, 0x0, 1) -AVR_MCU ("at43usb355", ARCH_AVR3, AVR_ISA_NONE, "__AVR_AT43USB355__",0x0060, 0x0, 1) -AVR_MCU ("at76c711", ARCH_AVR3, AVR_ISA_NONE, "__AVR_AT76C711__", 0x0060, 0x0, 1) +AVR_MCU ("avr3", ARCH_AVR3, AVR_ISA_NONE, NULL,0x0060, 0x0, 1, 0x6000) +AVR_MCU ("at43usb355", ARCH_AVR3, AVR_ISA_NONE, "__AVR_AT43USB355__",0x0060, 0x0, 1, 0x6000) +AVR_MCU ("at76c711", ARCH_AVR3, AVR_ISA_NONE, "__AVR_AT76C711__", 0x0060, 0x0, 1, 0x4000) +AVR_MCU ("at43usb320", ARCH_AVR3, AVR_ISA_NONE, "__AVR_AT43USB320__",0x0060, 0x0, 1, 0x1) /* Classic, == 128K. */ -AVR_MCU ("avr31",ARCH_AVR31, AVR_ERRATA_SKIP, NULL,0x0060, 0x0, 2) -AVR_MCU ("atmega103",ARCH_AVR31, AVR_ERRATA_SKIP, "__AVR_ATmega103__", 0x0060, 0x0, 2) -AVR_MCU ("at43usb320", ARCH_AVR31, AVR_ISA_NONE, "__AVR_AT43USB320__", 0x0060, 0x0, 2) +AVR_MCU ("avr31",ARCH_AVR31, AVR_ERRATA_SKIP, NULL,0x0060, 0x0, 2, 0x2) +AVR_MCU ("atmega103",ARCH_AVR31, AVR_ERRATA_SKIP, "__AVR_ATmega103__", 0x0060, 0x0, 2, 0x2) /* Classic + MOVW + JMP/CALL. */ If at43usb320 is in the wrong multilib, then this should be handled as separate issue / patch together with its own PR. Sorry for the confusion. I just noticed that some fields don't match... It is not even clear to me from the data sheet if avr3 is the correct multilib or perhaps avr35 (if it supports MOVW) or even avr5 (if it also has MUL) as there is no reference to the exact instruction set -- Atmochip will know. Moreover, such a change should be sync'ed with avr-libc as all multilib stuff is hand-wired there: no use of --print-foo meta information retrieval by avr-libc :-(( I filed PR78275 and https://savannah.nongnu.org/bugs/index.php?49565 for this one. Thats better. I've attached the updated patch. If OK, could someone commit please? I'll try if I could find some more info for AT43USB320. Regards, Pitchumani
Re: [patch, avr] Add flash size to device info and make wrap around default
Ping! On Thursday 10 November 2016 01:53 PM, Pitchumani Sivanupandi wrote: On Wednesday 09 November 2016 08:05 PM, Georg-Johann Lay wrote: On 09.11.2016 10:14, Pitchumani Sivanupandi wrote: On Tuesday 08 November 2016 02:57 PM, Georg-Johann Lay wrote: On 08.11.2016 08:08, Pitchumani Sivanupandi wrote: I have updated patch to include the flash size as well. Took that info from device headers (it was fed into crt's device information note section also). The new option would render -mn-flash superfluous, but we should keep it for backward compatibility. Ok. Shouldn't link_pmem_wrap then be removed from link_relax, i.e. from LINK_RELAX_SPEC? And what happens if relaxation is off? Yes. Removed link_pmem_wrap from link_relax. Disabling relaxation doesn't change -mpmem-wrap-around behavior. flashsize-and-wrap-around.patch diff --git a/gcc/config/avr/avr-mcus.def b/gcc/config/avr/avr-mcus.def index 6bcc6ff..9d4aa1a 100644 /* /* Classic, > 8K, <= 64K. */ -AVR_MCU ("avr3", ARCH_AVR3, AVR_ISA_NONE, NULL,0x0060, 0x0, 1) -AVR_MCU ("at43usb355", ARCH_AVR3, AVR_ISA_NONE, "__AVR_AT43USB355__",0x0060, 0x0, 1) -AVR_MCU ("at76c711", ARCH_AVR3, AVR_ISA_NONE, "__AVR_AT76C711__", 0x0060, 0x0, 1) +AVR_MCU ("avr3", ARCH_AVR3, AVR_ISA_NONE, NULL,0x0060, 0x0, 1, 0x6000) +AVR_MCU ("at43usb355", ARCH_AVR3, AVR_ISA_NONE, "__AVR_AT43USB355__",0x0060, 0x0, 1, 0x6000) +AVR_MCU ("at76c711", ARCH_AVR3, AVR_ISA_NONE, "__AVR_AT76C711__", 0x0060, 0x0, 1, 0x4000) +AVR_MCU ("at43usb320", ARCH_AVR3, AVR_ISA_NONE, "__AVR_AT43USB320__",0x0060, 0x0, 1, 0x1) /* Classic, == 128K. */ -AVR_MCU ("avr31",ARCH_AVR31, AVR_ERRATA_SKIP, NULL,0x0060, 0x0, 2) -AVR_MCU ("atmega103",ARCH_AVR31, AVR_ERRATA_SKIP, "__AVR_ATmega103__", 0x0060, 0x0, 2) -AVR_MCU ("at43usb320", ARCH_AVR31, AVR_ISA_NONE, "__AVR_AT43USB320__", 0x0060, 0x0, 2) +AVR_MCU ("avr31",ARCH_AVR31, AVR_ERRATA_SKIP, NULL,0x0060, 0x0, 2, 0x2) +AVR_MCU ("atmega103",ARCH_AVR31, AVR_ERRATA_SKIP, "__AVR_ATmega103__", 0x0060, 0x0, 2, 0x2) /* Classic + MOVW + JMP/CALL. */ If at43usb320 is in the wrong multilib, then this should be handled as separate issue / patch together with its own PR. Sorry for the confusion. I just noticed that some fields don't match... It is not even clear to me from the data sheet if avr3 is the correct multilib or perhaps avr35 (if it supports MOVW) or even avr5 (if it also has MUL) as there is no reference to the exact instruction set -- Atmochip will know. Moreover, such a change should be sync'ed with avr-libc as all multilib stuff is hand-wired there: no use of --print-foo meta information retrieval by avr-libc :-(( I filed PR78275 and https://savannah.nongnu.org/bugs/index.php?49565 for this one. Thats better. I've attached the updated patch. If OK, could someone commit please? I'll try if I could find some more info for AT43USB320. Regards, Pitchumani
Re: [patch, avr] Add flash size to device info and make wrap around default
On Wednesday 09 November 2016 08:05 PM, Georg-Johann Lay wrote: On 09.11.2016 10:14, Pitchumani Sivanupandi wrote: On Tuesday 08 November 2016 02:57 PM, Georg-Johann Lay wrote: On 08.11.2016 08:08, Pitchumani Sivanupandi wrote: I have updated patch to include the flash size as well. Took that info from device headers (it was fed into crt's device information note section also). The new option would render -mn-flash superfluous, but we should keep it for backward compatibility. Ok. Shouldn't link_pmem_wrap then be removed from link_relax, i.e. from LINK_RELAX_SPEC? And what happens if relaxation is off? Yes. Removed link_pmem_wrap from link_relax. Disabling relaxation doesn't change -mpmem-wrap-around behavior. flashsize-and-wrap-around.patch diff --git a/gcc/config/avr/avr-mcus.def b/gcc/config/avr/avr-mcus.def index 6bcc6ff..9d4aa1a 100644 /* /* Classic, > 8K, <= 64K. */ -AVR_MCU ("avr3", ARCH_AVR3, AVR_ISA_NONE, NULL,0x0060, 0x0, 1) -AVR_MCU ("at43usb355", ARCH_AVR3, AVR_ISA_NONE, "__AVR_AT43USB355__",0x0060, 0x0, 1) -AVR_MCU ("at76c711", ARCH_AVR3, AVR_ISA_NONE, "__AVR_AT76C711__", 0x0060, 0x0, 1) +AVR_MCU ("avr3", ARCH_AVR3, AVR_ISA_NONE, NULL,0x0060, 0x0, 1, 0x6000) +AVR_MCU ("at43usb355", ARCH_AVR3, AVR_ISA_NONE, "__AVR_AT43USB355__",0x0060, 0x0, 1, 0x6000) +AVR_MCU ("at76c711", ARCH_AVR3, AVR_ISA_NONE, "__AVR_AT76C711__", 0x0060, 0x0, 1, 0x4000) +AVR_MCU ("at43usb320", ARCH_AVR3, AVR_ISA_NONE, "__AVR_AT43USB320__",0x0060, 0x0, 1, 0x1) /* Classic, == 128K. */ -AVR_MCU ("avr31",ARCH_AVR31, AVR_ERRATA_SKIP, NULL,0x0060, 0x0, 2) -AVR_MCU ("atmega103",ARCH_AVR31, AVR_ERRATA_SKIP, "__AVR_ATmega103__", 0x0060, 0x0, 2) -AVR_MCU ("at43usb320", ARCH_AVR31, AVR_ISA_NONE, "__AVR_AT43USB320__", 0x0060, 0x0, 2) +AVR_MCU ("avr31",ARCH_AVR31, AVR_ERRATA_SKIP, NULL,0x0060, 0x0, 2, 0x2) +AVR_MCU ("atmega103",ARCH_AVR31, AVR_ERRATA_SKIP, "__AVR_ATmega103__", 0x0060, 0x0, 2, 0x2) /* Classic + MOVW + JMP/CALL. */ If at43usb320 is in the wrong multilib, then this should be handled as separate issue / patch together with its own PR. Sorry for the confusion. I just noticed that some fields don't match... It is not even clear to me from the data sheet if avr3 is the correct multilib or perhaps avr35 (if it supports MOVW) or even avr5 (if it also has MUL) as there is no reference to the exact instruction set -- Atmochip will know. Moreover, such a change should be sync'ed with avr-libc as all multilib stuff is hand-wired there: no use of --print-foo meta information retrieval by avr-libc :-(( I filed PR78275 and https://savannah.nongnu.org/bugs/index.php?49565 for this one. Thats better. I've attached the updated patch. If OK, could someone commit please? I'll try if I could find some more info for AT43USB320. Regards, Pitchumani diff --git a/gcc/config/avr/avr-arch.h b/gcc/config/avr/avr-arch.h index 42eaee5..e0961d4 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 7d13ba4..cef3b9a 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/avr-mcus.def b/gcc/config/avr/avr-mcus.def index 6bcc6ff..6e51c2e 100644 --- a/gcc/config/avr/avr-mcus.def +++ b/gcc/config/avr/avr-mcus.def @@ -62,295 +62,297 @@ N_FLASH Number of 64 KiB flash segments, rounded up. The default value for -mn-flash=. + FLASH_SIZEFlash size in bytes. + "avr2" must be first for the "0" default to work as intended. */ /* Classic, <= 8K. */ -AVR_MCU ("avr2", ARCH_AVR2, AVR_ERRATA_SKIP, NULL, 0x0060, 0x0, 6) -AVR_MCU ("at90s2313",ARCH_AVR2, AVR_SHORT_SP, "__AVR_AT90S2313__", 0x0060, 0x0, 1) -AVR_MCU ("at90s2323",ARCH_AVR2, AVR_SHORT_SP, "__AVR_AT90S2323__", 0x0060, 0x0, 1) -AVR_MCU
Re: [patch, avr] Add flash size to device info and make wrap around default
On 09.11.2016 10:14, Pitchumani Sivanupandi wrote: On Tuesday 08 November 2016 02:57 PM, Georg-Johann Lay wrote: On 08.11.2016 08:08, Pitchumani Sivanupandi wrote: I have updated patch to include the flash size as well. Took that info from device headers (it was fed into crt's device information note section also). The new option would render -mn-flash superfluous, but we should keep it for backward compatibility. Ok. Shouldn't link_pmem_wrap then be removed from link_relax, i.e. from LINK_RELAX_SPEC? And what happens if relaxation is off? Yes. Removed link_pmem_wrap from link_relax. Disabling relaxation doesn't change -mpmem-wrap-around behavior. Now, wrap around behavior is changed as follows: For 8K flash devices: Device specs adds --pmem-wrap-around=8k linker option if -mno-pmem-wrap-around is NOT enabled. It makes the --pmem-wrap-around=8k linker option default for 8k flash devices. For 16/32/64K flash devices: Spec string 'link_pmem_wrap' added to all 16/32/64k flash devices specs. Other wise no changes i.e. It adds --pmem-wrap-around=16/32/64k option if -mpmem-wrap-around option is enabled. For other devices, no changes in device specs. Reg tested with default and -mrelax options enabled. No issues. Regards, Pitchumani gcc/ChangeLog 2016-11-08 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. flashsize-and-wrap-around.patch diff --git a/gcc/config/avr/avr-mcus.def b/gcc/config/avr/avr-mcus.def index 6bcc6ff..9d4aa1a 100644 /* Classic, == 128K. */ -AVR_MCU ("avr31",ARCH_AVR31, AVR_ERRATA_SKIP, NULL,0x0060, 0x0, 2) -AVR_MCU ("atmega103",ARCH_AVR31, AVR_ERRATA_SKIP, "__AVR_ATmega103__", 0x0060, 0x0, 2) -AVR_MCU ("at43usb320", ARCH_AVR31, AVR_ISA_NONE, "__AVR_AT43USB320__", 0x0060, 0x0, 2) +AVR_MCU ("avr31",ARCH_AVR31, AVR_ERRATA_SKIP, NULL,0x0060, 0x0, 2, 0x2) +AVR_MCU ("atmega103",ARCH_AVR31, AVR_ERRATA_SKIP, "__AVR_ATmega103__", 0x0060, 0x0, 2, 0x2) +AVR_MCU ("at43usb320", ARCH_AVR31, AVR_ISA_NONE, "__AVR_AT43USB320__", 0x0060, 0x0, 2, 0x1) This looks incorrect: either .flash_size should be 0x2 or n_flash be 1. As you draw the information from internal hardware descriptions, I'd guess that the new information is more reliable? ...as this also determines whether AT43USB320supports ELPM this also means that the device is in the wrong multilib set? I couldn't find the data sheet at atmel.com, and the one I found on the net only mentions 64KiB program memory. It mentions LPM on pp. 9 but has no reference to the supported instruction set. From the manual I would conclude that this device should be avr3, not avr31? Yes. I couldn't find any other source other than the datasheet in net. This device do not have internal program memory. Flash size is set to 64K as the device could address only 64K. No RAMPZ register, so no ELPM. Moved device to AVR3 architecture. /* Classic, > 8K, <= 64K. */ -AVR_MCU ("avr3", ARCH_AVR3, AVR_ISA_NONE, NULL, 0x0060, 0x0, 1) -AVR_MCU ("at43usb355", ARCH_AVR3, AVR_ISA_NONE, "__AVR_AT43USB355__", 0x0060, 0x0, 1) -AVR_MCU ("at76c711", ARCH_AVR3, AVR_ISA_NONE, "__AVR_AT76C711__", 0x0060, 0x0, 1) +AVR_MCU ("avr3", ARCH_AVR3, AVR_ISA_NONE, NULL, 0x0060, 0x0, 1, 0x6000) +AVR_MCU ("at43usb355", ARCH_AVR3, AVR_ISA_NONE, "__AVR_AT43USB355__", 0x0060, 0x0, 1, 0x6000) +AVR_MCU ("at76c711", ARCH_AVR3, AVR_ISA_NONE, "__AVR_AT76C711__", 0x0060, 0x0, 1, 0x4000) +AVR_MCU ("at43usb320", ARCH_AVR3, AVR_ISA_NONE, "__AVR_AT43USB320__", 0x0060, 0x0, 1, 0x1) /* Classic, == 128K. */ -AVR_MCU ("avr31",ARCH_AVR31, AVR_ERRATA_SKIP, NULL, 0x0060, 0x0, 2) -AVR_MCU ("atmega103",ARCH_AVR31, AVR_ERRATA_SKIP, "__AVR_ATmega103__", 0x0060, 0x0, 2) -AVR_MCU ("at43usb320", ARCH_AVR31, AVR_ISA_NONE, "__AVR_AT43USB320__", 0x0060, 0x0, 2) +AVR_MCU ("avr31",ARCH_AVR31, AVR_ERRATA_SKIP, NULL, 0x0060, 0x0, 2, 0x2) +AVR_MCU ("atmega103",ARCH_AVR31, AVR_ERRATA_SKIP, "__AVR_ATmega103__", 0x0060, 0x0, 2, 0x2) /* Classic + MOVW + JMP/CALL. */ If at43usb320 is in the wrong multilib, then this should be handled as separate issue / patch together with its own PR. Sorry for the confusion.
Re: [patch, avr] Add flash size to device info and make wrap around default
On 08.11.2016 08:08, Pitchumani Sivanupandi wrote: I have updated patch to include the flash size as well. Took that info from device headers (it was fed into crt's device information note section also). The new option would render -mn-flash superfluous, but we should keep it for backward compatibility. Ok. Shouldn't link_pmem_wrap then be removed from link_relax, i.e. from LINK_RELAX_SPEC? And what happens if relaxation is off? Yes. Removed link_pmem_wrap from link_relax. Disabling relaxation doesn't change -mpmem-wrap-around behavior. Now, wrap around behavior is changed as follows: For 8K flash devices: Device specs adds --pmem-wrap-around=8k linker option if -mno-pmem-wrap-around is NOT enabled. It makes the --pmem-wrap-around=8k linker option default for 8k flash devices. For 16/32/64K flash devices: Spec string 'link_pmem_wrap' added to all 16/32/64k flash devices specs. Other wise no changes i.e. It adds --pmem-wrap-around=16/32/64k option if -mpmem-wrap-around option is enabled. For other devices, no changes in device specs. Reg tested with default and -mrelax options enabled. No issues. Regards, Pitchumani gcc/ChangeLog 2016-11-08 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. flashsize-and-wrap-around.patch diff --git a/gcc/config/avr/avr-mcus.def b/gcc/config/avr/avr-mcus.def index 6bcc6ff..9d4aa1a 100644 /* Classic, == 128K. */ -AVR_MCU ("avr31",ARCH_AVR31, AVR_ERRATA_SKIP, NULL, 0x0060, 0x0, 2) -AVR_MCU ("atmega103",ARCH_AVR31, AVR_ERRATA_SKIP, "__AVR_ATmega103__", 0x0060, 0x0, 2) -AVR_MCU ("at43usb320", ARCH_AVR31, AVR_ISA_NONE, "__AVR_AT43USB320__", 0x0060, 0x0, 2) +AVR_MCU ("avr31",ARCH_AVR31, AVR_ERRATA_SKIP, NULL, 0x0060, 0x0, 2, 0x2) +AVR_MCU ("atmega103",ARCH_AVR31, AVR_ERRATA_SKIP, "__AVR_ATmega103__", 0x0060, 0x0, 2, 0x2) +AVR_MCU ("at43usb320", ARCH_AVR31, AVR_ISA_NONE, "__AVR_AT43USB320__", 0x0060, 0x0, 2, 0x1) This looks incorrect: either .flash_size should be 0x2 or n_flash be 1. As you draw the information from internal hardware descriptions, I'd guess that the new information is more reliable? ...as this also determines whether AT43USB320supports ELPM this also means that the device is in the wrong multilib set? I couldn't find the data sheet at atmel.com, and the one I found on the net only mentions 64KiB program memory. It mentions LPM on pp. 9 but has no reference to the supported instruction set. From the manual I would conclude that this device should be avr3, not avr31? +AVR_MCU ("atxmega384c3", ARCH_AVRXMEGA6, AVR_ISA_RMW, "__AVR_ATxmega384C3__", 0x2000, 0x0, 6, 0x62000) +AVR_MCU ("atxmega384d3", ARCH_AVRXMEGA6, AVR_ISA_NONE, "__AVR_ATxmega384D3__", 0x2000, 0x0, 6, 0x62000) /* Xmega, 128K < Flash, RAM > 64K RAM. */ Two more glitches; presumably, .n_flash should be 7 here? Or even better, we can drop .n_flash field in the future and use the more reliable, finer grained information from .flash_size instead? Johann
[patch, avr] Add flash size to device info and make wrap around default (was: Re: [patch, avr] Make pmem-wrap-around option as default)
On Thursday 03 November 2016 06:19 PM, Georg-Johann Lay wrote: On 03.11.2016 08:58, Pitchumani Sivanupandi wrote: Most of the AVR's 8k memorydevices have only rjmp instruction, not jmp. So, it is important to wrap around jump destination to check if it can reach backwards. Currently link specs passes --pmem-wrap-around=xxK when mrelax and mpmem-wrap-around options are enabled. Attached patch changes the specs so that option --pmem-wrap-around=8K is passed for 8k memory devices if -mno-pmem-wrap-around is not enabled. If OK, could someone commit please? Note: Currently 8k devices are identified based on name prefix. We are working on alternative method to incorporate flash memory size. Currently, "at90usb8" this the only prefix that results in wrap_k = 8, so without adding knowledge about flash sizes to the compiler, the change makes not much sense... (but does not do harm either). There are ~40 devices with 8K flash. Current checks are out-dated. The right place for flash size info would be avr-mcus.def together with a new command option to specify the flash size and draw conclusions from it. When I asked Atmel about a mapping of Device to flash size, the support told me to check the data sheets -- not really practical for ~300 devices in avr-mcus.def :-) Atmel *must* have information about this... I have updated patch to include the flash size as well. Took that info from device headers (it was fed into crt's device information note section also). The new option would render -mn-flash superfluous, but we should keep it for backward compatibility. Ok. Shouldn't link_pmem_wrap then be removed from link_relax, i.e. from LINK_RELAX_SPEC? And what happens if relaxation is off? Yes. Removed link_pmem_wrap from link_relax. Disabling relaxation doesn't change -mpmem-wrap-around behavior. Now, wrap around behavior is changed as follows: For 8K flash devices: Device specs adds --pmem-wrap-around=8k linker option if -mno-pmem-wrap-around is NOT enabled. It makes the --pmem-wrap-around=8k linker option default for 8k flash devices. For 16/32/64K flash devices: Spec string 'link_pmem_wrap' added to all 16/32/64k flash devices specs. Other wise no changes i.e. It adds --pmem-wrap-around=16/32/64k option if -mpmem-wrap-around option is enabled. For other devices, no changes in device specs. Reg tested with default and -mrelax options enabled. No issues. If OK, could someone commit please? Regards, Pitchumani gcc/ChangeLog 2016-11-08 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. diff --git a/gcc/config/avr/avr-arch.h b/gcc/config/avr/avr-arch.h index 42eaee5..e0961d4 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 7d13ba4..cef3b9a 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/avr-mcus.def b/gcc/config/avr/avr-mcus.def index 6bcc6ff..9d4aa1a 100644 --- a/gcc/config/avr/avr-mcus.def +++ b/gcc/config/avr/avr-mcus.def @@ -62,295 +62,297 @@ N_FLASH Number of 64 KiB flash segments, rounded up. The default value for -mn-flash=. + FLASH_SIZEFlash size in bytes. + "avr2" must be first for the "0" default to work as intended. */ /* Classic, <= 8K. */ -AVR_MCU ("avr2", ARCH_AVR2, AVR_ERRATA_SKIP, NULL, 0x0060, 0x0, 6) -AVR_MCU ("at90s2313",ARCH_AVR2, AVR_SHORT_SP, "__AVR_AT90S2313__", 0x0060, 0x0, 1) -AVR_MCU ("at90s2323",ARCH_AVR2, AVR_SHORT_SP, "__AVR_AT90S2323__", 0x0060, 0x0, 1) -AVR_MCU ("at90s2333",