avr-libc-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-libc-commit] [2475] bug #44869: detect compiler version and install


From: Pitchumani
Subject: [avr-libc-commit] [2475] bug #44869: detect compiler version and install crt and device library in required directory
Date: Thu, 07 May 2015 06:45:48 +0000

Revision: 2475
          http://svn.sv.gnu.org/viewvc/?view=rev&root=avr-libc&revision=2475
Author:   pitchumani
Date:     2015-05-07 06:45:38 +0000 (Thu, 07 May 2015)
Log Message:
-----------
bug #44869: detect compiler version and install crt and device library in 
required directory

Ticket Links:
------------
    http://savannah.gnu.org/bugs/?44869

Modified Paths:
--------------
    trunk/avr-libc/ChangeLog
    trunk/avr-libc/NEWS
    trunk/avr-libc/configure.ac
    trunk/avr-libc/devtools/Device.am
    trunk/avr-libc/devtools/gen-avr-lib-tree.sh
    trunk/avr-libc/libc/Makefile.am
    trunk/avr-libc/libc/misc/Rules.am

Modified: trunk/avr-libc/ChangeLog
===================================================================
--- trunk/avr-libc/ChangeLog    2015-04-15 09:58:19 UTC (rev 2474)
+++ trunk/avr-libc/ChangeLog    2015-05-07 06:45:38 UTC (rev 2475)
@@ -1,3 +1,19 @@
+2015-05-07  Pitchumani Sivanupandi <address@hidden>
+
+       bug #44869: trunk doesn't work with gcc 5.1.0-RC-20150412
+       * configure.ac (HAS_GCC_5_1): Define if avr-gcc version is 5.1.0
+       (--enable-device-lib): Add configure option.
+       (HAS_DEV_LIB): Define if enabled by --enable-device-lib or avr-gcc
+       version is >= 5.1.0.
+       * devtools/Device.am (AVR_TARGET_CRT, AVR_INSTALL_DIR): Define
+       based on avr-gcc version.
+       (avr_LIBRARIES): Likewise.
+       * devtools/gen-avr-lib-tree.sh: Use old crt name.
+       * libc/Makefile.am: Include misc sub-directory if device library is
+       not enabled.
+       * libc/misc/Rules.am: Include eeprom function name mangling if device
+       library is not enabled.
+
 2015-04-15  Pitchumani Sivanupandi <address@hidden>
 
        bug #44574: Place device-specific libraries in their multilib directory.

Modified: trunk/avr-libc/NEWS
===================================================================
--- trunk/avr-libc/NEWS 2015-04-15 09:58:19 UTC (rev 2474)
+++ trunk/avr-libc/NEWS 2015-05-07 06:45:38 UTC (rev 2475)
@@ -9,6 +9,7 @@
   [#44140] wdt_disable() macro clobbers prescaller bits 
   [#44515] Wrong build option '-mtiny-stack' instead of '-msp8'
   [#44574] Place device-specific libraries in their multilib directory
+  [#44869] trunk doesn't work with gcc 5.1.0-RC-20150412
   [no-id] TC_EVACT_FRQ_gc was misspelled as TC_EVACT_FRW_gc in some Xmega
           header files
 

Modified: trunk/avr-libc/configure.ac
===================================================================
--- trunk/avr-libc/configure.ac 2015-04-15 09:58:19 UTC (rev 2474)
+++ trunk/avr-libc/configure.ac 2015-05-07 06:45:38 UTC (rev 2475)
@@ -170,6 +170,25 @@
 AC_PROG_LN_S
 AC_PROG_MAKE_SET
 
+dnl Check if avr-gcc >= 5.1.0 as they expect device library
+GCC_VER=`${CC} -dumpversion`
+AS_VERSION_COMPARE(${GCC_VER},"5.1.0",[DEV_LIB="no"],[DEV_LIB="yes"],[DEV_LIB="yes"])
+AM_CONDITIONAL(HAS_GCC_5_1, test "x${GCC_VER}" = "x5.1.0")
+
+dnl Enable device library when specified. If not specified and
+dnl gcc expects (e.g. >= 5) device lib then enable device library.
+AC_ARG_ENABLE(device-lib,
+[  --enable-device-lib     build separate device library],
+[enable_device_lib=true],
+[case "${DEV_LIB}" in
+  yes) enable_device_lib=true
+       AC_MSG_NOTICE(Enabled device library) ;;
+  *) ;;
+ esac])
+
+dnl define HAS_DEV_LIB if device library enabled
+AM_CONDITIONAL(HAS_DEV_LIB, [test x$enable_device_lib = xtrue])
+
 dnl TODO: Check for various tools used to build the documentation. If anything
 dnl is missing, don't build the docs by default.
 

Modified: trunk/avr-libc/devtools/Device.am
===================================================================
--- trunk/avr-libc/devtools/Device.am   2015-04-15 09:58:19 UTC (rev 2474)
+++ trunk/avr-libc/devtools/Device.am   2015-05-07 06:45:38 UTC (rev 2475)
@@ -29,15 +29,31 @@
 #
 
 AVR_TARGET          = <<dev>>
+if HAS_DEV_LIB
+if HAS_GCC_5_1
+# avr-gcc 5.1.0 expects crt file as crt1.o and 
+# device library in dev directory
+AVR_TARGET_CRT      = crt1.o
+AVR_INSTALL_DIR     = dev/<<dev>>
+else
+# avr-gcc > 5.1.0 expects crt file as crt<device name>.o and
+# device library in multi-lib directory itself
+AVR_TARGET_CRT      = crt<<dev>>.o
+AVR_INSTALL_DIR     = <<install_dir>>
+endif
+else
 AVR_TARGET_CRT      = <<crt>>
+AVR_INSTALL_DIR     = <<install_dir>>
+endif
 AVR_TARGET_DEFS     = <<crt_defs>>
 AVR_TARGET_CFLAGS   = <<crt_cflags>>
 AVR_TARGET_ASFLAGS  = <<crt_asflags>>
-AVR_INSTALL_DIR     = <<install_dir>>
 
 VPATH = $(top_srcdir)/crt1:$(top_srcdir)/libc/misc
 
+if HAS_DEV_LIB
 include $(top_srcdir)/libc/misc/Rules.am
+endif
 
 if HAS_<<dev>>
 
@@ -58,8 +74,18 @@
 
 noinst_LIBRARIES = libcrt.a
 nodist_libcrt_a_SOURCES = gcrt1.S
+
+if HAS_DEV_LIB
+if HAS_GCC_5_1
+# avr-gcc 5.1.0 expects device library as libdev.a
+avr_LIBRARIES = libdev.a
+libdev_a_SOURCES = $(eeprom_asm_sources)
+else
+# avr-gcc > 5.1.0 expects device library as lib<device name>.a
 avr_LIBRARIES = lib<<dev>>.a
 lib<<dev>>_a_SOURCES = $(eeprom_asm_sources)
+endif
+endif
 
 avr_DATA = $(AVR_TARGET_CRT)
 

Modified: trunk/avr-libc/devtools/gen-avr-lib-tree.sh
===================================================================
--- trunk/avr-libc/devtools/gen-avr-lib-tree.sh 2015-04-15 09:58:19 UTC (rev 
2474)
+++ trunk/avr-libc/devtools/gen-avr-lib-tree.sh 2015-05-07 06:45:38 UTC (rev 
2475)
@@ -431,7 +431,7 @@
        for dev_crt in $DEV_INFO
        do
                dev=`echo $dev_crt | cut -d ':' -f 1`
-               crt=crt`echo $dev_crt | cut -d ':' -f 1`.o
+               crt=`echo $dev_crt | cut -d ':' -f 2`
                crt_defs=`echo $dev_crt | cut -d ':' -f 3`
                crt_cflags=`echo $dev_crt | cut -d ':' -f 4`
                crt_asflags=`echo $dev_crt | cut -d ':' -f 5`

Modified: trunk/avr-libc/libc/Makefile.am
===================================================================
--- trunk/avr-libc/libc/Makefile.am     2015-04-15 09:58:19 UTC (rev 2474)
+++ trunk/avr-libc/libc/Makefile.am     2015-05-07 06:45:38 UTC (rev 2475)
@@ -29,5 +29,11 @@
 # $Id$
 #
 
-SUBDIRS = stdlib pmstring string misc stdio time
-DIST_SUBDIRS = stdlib pmstring string misc stdio time
+# do not include misc (eeprom) in libc if device library enabled
+if HAS_DEV_LIB
+MISC=
+else
+MISC=misc
+endif
+SUBDIRS = stdlib pmstring string ${MISC} stdio time
+DIST_SUBDIRS = stdlib pmstring string ${MISC} stdio time

Modified: trunk/avr-libc/libc/misc/Rules.am
===================================================================
--- trunk/avr-libc/libc/misc/Rules.am   2015-04-15 09:58:19 UTC (rev 2474)
+++ trunk/avr-libc/libc/misc/Rules.am   2015-05-07 06:45:38 UTC (rev 2475)
@@ -31,4 +31,44 @@
 
 include $(top_srcdir)/libc/misc/Files.am
 
+if !HAS_DEV_LIB
+# Example:
+#   eeprom_asm_sources --> eerd_byte.S eerd_word.S
+#   basename           --> eerd_byte eerd_word
+#   addsuffix          --> eerd_byte_ eerd_word_
+#   foreach            --> eerd_byte_atmega48 eerd_byte_atmega8
+#                          eerd_word_atmega48 eerd_word_atmega8
+#   addsuffix          --> eerd_byte_atmega48.o eerd_byte_atmega8.o
+#                          eerd_word_atmega48.o eerd_word_atmega8.o
+#
+eeprom_asm_basenames = $(basename $(eeprom_asm_sources))
+eeprom_asm_basenames2 = $(addsuffix _,$(eeprom_asm_basenames))
+eeprom_asm_baselist = $(foreach dev,$(AVRLIB_DEVLIST),\
+    $(addsuffix $(dev),$(eeprom_asm_basenames2)))
+eeprom_asm_objlist = $(addsuffix .o,$(eeprom_asm_baselist))
+
+misc_a_libadd = \
+       $(eeprom_asm_objlist)
+
+# Example of '-mmcu' arg generation:
+#   $@          --> eerd_byte_atmega48.o
+#   basename    --> eerd_byte_atmega48
+#   subst       --> eerd byte atmega48
+#   lastword    --> atmega48
+#
+# Example of source file generation:
+#   $@          --> eerd_byte_atmega48.o
+#   basename    --> eerd_byte_atmega48
+#   subst       --> eerd.byte.atmega48
+#   basename    --> eerd.byte
+#   subst       --> eerd_byte
+#   addsuffix   --> eerd_byte.S
+#
+$(eeprom_asm_objlist): $(eeprom_asm_sources)
+       $(filter-out -mmcu=%,$(COMPILE) $(AVRLIB_ASFLAGS)) -c -o $@     \
+           -mmcu=$(lastword $(subst _, ,$(basename $@)))               \
+           $(<D)/$(addsuffix .S,\
+                   $(subst .,_,$(basename $(subst _,.,$(basename $@)))))
+endif
+
 # vim: set ft=make:




reply via email to

[Prev in Thread] Current Thread [Next in Thread]