This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch, avr] Fix mmcu to specs issues

On 26.07.2016 12:20, Pitchumani Sivanupandi wrote:
avr-gcc expected to find the device specs in the search paths specified. But
it doesn't work as expected when device specs in different place than the
installed location.

avr-gcc wrongly assumes the device specs will be in first identified
'device-specs' folder in prefix path. avr-gcc natively supports device
at90pwm1, but complains as it couldn't find the specs file in the first
'device-specs' directory in the search path.

$ avr-gcc test.c -mmcu=at90pwm1 -B /home/install/dev/atxmega128a1u/

avr-gcc: error: cannot access device-specs for _at90pwm1_ expected at

Are the "_"s literally? Then the spec file name should be "specs-_at90pwm1_".

avr-gcc: note: devices natively supported: ata5272 ata5505 ata5702m322 ata5782
ata5790 ata5790n ata5791 ata5795 ata5831 ata6285 ata6286 ata6289 ata6612c
ata6613c ata6614q ata6616c ata6617c ata664251 ata8210 ata8510 atmega103
atmega128 atmega128a atmega128rfa1 atmega128rfr2 atmega1280 atmega1281
atmega1284 atmega1284p atmega1284rfr2 atmega16 atmega16a atmega16hva
atmega16hva2 atmega16hvb atmega16hvbrevb atmega16m1 atmega16u2 atmega16u4
atmega161 atmega162 atmega163 atmega164a atmega164p atmega164pa atmega165
atmega165a atmega165p atmega165pa atmega168 atmega168a atmega168p atmega168pa
atmega168pb atmega169 atmega169a atmega169p atmega169pa atmega256rfr2
atmega2560 atmega2561 atmega2564rfr2 atmega32 atmega32a atmega32c1 atmega32hvb
atmega32hvbrevb atmega32m1 atmega32u2 atmega32u4 atmega32u6 atmega323
atmega324a atmega324p atmega324pa atmega325 atmega325a atmega325p atmega325pa
atmega3250 atmega3250a atmega3250p atmega3250pa atmega328 atmega328p
atmega328pb atmega329 atmega329a atmega329p atmega329pa atmega3290 atmega3290a
atmega3290p atmega3290pa atmega406 atmega48 atmega48a atmega48p atmega48pa
atmega48pb atmega64 atmega64a atmega64c1 atmega64hve atmega64hve2 atmega64m1
atmega64rfr2 atmega640 atmega644 atmega644a atmega644p atmega644pa
atmega644rfr2 atmega645 atmega645a atmega645p atmega6450 atmega6450a
atmega6450p atmega649 atmega649a atmega649p atmega6490 atmega6490a atmega6490p
atmega8 atmega8a atmega8hva atmega8u2 atmega8515 atmega8535 atmega88 atmega88a
atmega88p atmega88pa atmega88pb attiny10 attiny11 attiny12 attiny13 attiny13a
attiny15 attiny1634 attiny167 attiny20 attiny22 attiny2313 attiny2313a attiny24
attiny24a attiny25 attiny26 attiny261 attiny261a attiny28 attiny4 attiny40
attiny43u attiny4313 attiny44 attiny44a attiny441 attiny45 attiny461 attiny461a
attiny48 attiny5 attiny828 attiny84 attiny84a attiny841 attiny85 attiny861
attiny861a attiny87 attiny88 attiny9 atxmega128a1 atxmega128a1u atxmega128a3
atxmega128a3u atxmega128a4u atxmega128b1 atxmega128b3 atxmega128c3 atxmega128d3
atxmega128d4 atxmega16a4 atxmega16a4u atxmega16c4 atxmega16d4 atxmega16e5
atxmega192a3 atxmega192a3u atxmega192c3 atxmega192d3 atxmega256a3 atxmega256a3b
atxmega256a3bu atxmega256a3u atxmega256c3 atxmega256d3 atxmega32a4 atxmega32a4u
atxmega32c3 atxmega32c4 atxmega32d3 atxmega32d4 atxmega32e5 atxmega384c3
atxmega384d3 atxmega64a1 atxmega64a1u atxmega64a3 atxmega64a3u atxmega64a4u
atxmega64b1 atxmega64b3 atxmega64c3 atxmega64d3 atxmega64d4 atxmega8e5
at43usb320 at43usb355 at76c711 at86rf401 at90can128 at90can32 at90can64
at90c8534 at90pwm1 at90pwm161 at90pwm2 at90pwm2b at90pwm216 at90pwm3 at90pwm3b
at90pwm316 at90pwm81 at90scr100 at90s1200 at90s2313 at90s2323 at90s2333
at90s2343 at90s4414 at90s4433 at90s4434 at90s8515 at90s8535 at90usb1286
at90usb1287 at90usb162 at90usb646 at90usb647 at90usb82 at94k m3000
avr-gcc: note: supported core architectures: avr2 avr25 avr3 avr31 avr35 avr4
avr5 avr51 avr6 avrxmega2 avrxmega4 avrxmega5 avrxmega6 avrxmega7 avrtiny avr1
avr-gcc: note: you can provide your own specs files, see
<> for details

Similar issue happens when -flto option is enabled and device specs in custom
search path.

atxmega128a1u device specs in custom path and that is passed with -B option.
Architecture spec files such as specs-avrxmega7 will be in installed location.

$ avr-gcc test.c -mmcu=atxmega128a1u -flto -B /home/install/dev/atxmega128a1u/

avr-gcc: error: cannot access device-specs for _avrxmega7_ expected at
avr-gcc: note: supported core architectures: avr2 avr25 avr3 avr31 avr35 avr4
avr5 avr51 avr6 avrxmega2 avrxmega4 avrxmega5 avrxmega6 avrxmega7 avrtiny avr1
avr-gcc: note: you can provide your own specs files, see
<> for details
lto-wrapper: fatal error: avr-gcc returned 1 exit status
compilation terminated.
/home/avr-trunk/install/lib/gcc/avr/7.0.0/../../../../avr/bin/ld: error:
lto-wrapper failed
collect2: error: ld returned 1 exit status

Attached patch to address these issues.

Replace device-specs-file spec function with mmcu-to-device-specs. This will
not assume that specs files are in first identified device-specs directory.
Instead this spec function will let gcc identify the absolute path of specs file
using spec string "device-specs-file (device-specs/specs-<mcu>%s)".

IIUC this leads to problems with LTO and when the install path contains spaces which windows distros usually have. The problem is that the spec function cannot escape the spaces as it would need more than 1 escape level.

It might also be the case that -mmcu= is specified more than once (with the same MCU), but I don't remember exactly in which situations this happens... Doesn't this lead to inclusion of more than one specs-file?


New spec function for device-specs-file, that will check the access for device
specs file and issue diagnostics.

If Ok, could someone commit please? I do not have commit access.



2016-07-26  Pitchumani Sivanupandi  <>

    * config/avr/avr.h: Declare spec handle function avr_mmcu_to_devicespecs.
    (EXTRA_SPEC_FUNCTIONS): Add mmcu-to-device-specs spec function.
    (DRIVER_SELF_SPECS): Replace device-specs-file spec function with
    * config/avr/driver-avr.c (avr_diagnose_devicespecs_error): Remove.
    (avr_devicespecs_file): Implement it for device-specs-file spec function.
    Issue error if device specs file is not accessible.
    (avr_mmcu_to_devicespecs): Implement it for mmcu-to-device-specs spec
    function. Return device-specs-file spec string with deduced specs file.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]