This is the mail archive of the gcc-patches@gcc.gnu.org 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]

[Patch,AVR]: Auto-generate all -mmcu= options in documentation.


This patch adds a new file ./gcc/doc/avr-mmcu.texi that lists all valid
-mmcu= settings and replaces the respective text in invoke.texi by
@include avr-mmcu.texi

Up to now, there is no complete list of -mmcu= options, and a list is
hard to maintain by hand because it contains more than 180 devices.

If, during the build of avr-gcc, a change of ./gcc/doc/avr-mmcu.texi
is detected, the build aborts with a message that nags the user to
copy the new content of avr-mmcu.texi to ./gcc/doc/avr-mmcu.texi.

The error message's text is:

*** Verify that you have permission to grant a
*** GFDL license for all new text in
*** avr-mmcu.texi, then copy it to $(srcdir)/doc/avr-mmcu.texi

./gcc/doc/avr-mmcu.texi is auto-generated, but there is no rule to
automatically update it during the build process.

Documents (HTML, PDF, ...) build fine.

Ok for trunk?

If it's appropriate for 4.7, I'd change invoke.texi accordingly by
copy-pasting the auto-generated texi code into that file, i.e.
into section "AVR Options".

Johann

	* Makefile.in (TEXI_GCC_FILES): Add avr-mmcu.texi.

	* doc/avr-mmcu.texi: New auto-generated file.
	* doc/invoke.texi (AVR Options): Include avr-mmcu.texi in order
	to document all valid -mmcu= arguments.

	* config/avr/avr.h (arch_info_s): New struct definition.
	* config/avr/avr-devices.c (avr_texinfo): New variable.
	* config/avr/gen-avr-mmcu-texi.c: New file.
	* config/avr/t-avr: New rules and dependencies to build	avr-mmcu.texi.
Index: doc/avr-mmcu.texi
===================================================================
--- doc/avr-mmcu.texi	(revision 0)
+++ doc/avr-mmcu.texi	(revision 0)
@@ -0,0 +1,74 @@
+@c Copyright (C) 2012 Free Software Foundation, Inc.
+@c This is part of the GCC manual.
+@c For copying conditions, see the file gcc/doc/include/fdl.texi.
+
+@c This file is generated automatically using
+@c gcc/config/avr/gen-avr-mmcu-texi.c from:
+@c    gcc/config/avr/avr-devices.c
+@c    gcc/config/avr/avr-mcus.def
+
+@c Please do not edit manually.
+
+@table @code
+
+@item avr2
+``Classic'' devices with up to 8@tie{}KiB of program memory.
+@*@var{mcu}@tie{}= @code{at90s2313}, @code{at90s2323}, @code{at90s2333}, @code{at90s2343}, @code{attiny22}, @code{attiny26}, @code{at90s4414}, @code{at90s4433}, @code{at90s4434}, @code{at90s8515}, @code{at90c8534}, @code{at90s8535}.
+
+@item avr25
+``Classic'' devices with up to 8@tie{}KiB of program memory and with the @code{MOVW} instruction.
+@*@var{mcu}@tie{}= @code{ata6289}, @code{attiny13}, @code{attiny13a}, @code{attiny2313}, @code{attiny2313a}, @code{attiny24}, @code{attiny24a}, @code{attiny4313}, @code{attiny44}, @code{attiny44a}, @code{attiny84}, @code{attiny84a}, @code{attiny25}, @code{attiny45}, @code{attiny85}, @code{attiny261}, @code{attiny261a}, @code{attiny461}, @code{attiny461a}, @code{attiny861}, @code{attiny861a}, @code{attiny43u}, @code{attiny87}, @code{attiny48}, @code{attiny88}, @code{at86rf401}.
+
+@item avr3
+``Classic'' devices with 16@tie{}KiB up to 64@tie{}KiB of  program memory.
+@*@var{mcu}@tie{}= @code{at43usb355}, @code{at76c711}.
+
+@item avr31
+``Classic'' devices with 128@tie{}KiB of program memory.
+@*@var{mcu}@tie{}= @code{atmega103}, @code{at43usb320}.
+
+@item avr35
+``Classic'' devices with 16@tie{}KiB up to 64@tie{}KiB of program memory and with the @code{MOVW} instruction.
+@*@var{mcu}@tie{}= @code{at90usb82}, @code{at90usb162}, @code{atmega8u2}, @code{atmega16u2}, @code{atmega32u2}, @code{attiny167}.
+
+@item avr4
+``Enhanced'' devices with up to 8@tie{}KiB of program memory.
+@*@var{mcu}@tie{}= @code{atmega8}, @code{atmega48}, @code{atmega48a}, @code{atmega48p}, @code{atmega88}, @code{atmega88a}, @code{atmega88p}, @code{atmega88pa}, @code{atmega8515}, @code{atmega8535}, @code{atmega8hva}, @code{at90pwm1}, @code{at90pwm2}, @code{at90pwm2b}, @code{at90pwm3}, @code{at90pwm3b}, @code{at90pwm81}.
+
+@item avr5
+``Enhanced'' devices with 16@tie{}KiB up to 64@tie{}KiB of program memory.
+@*@var{mcu}@tie{}= @code{atmega16}, @code{atmega16a}, @code{atmega161}, @code{atmega162}, @code{atmega163}, @code{atmega164a}, @code{atmega164p}, @code{atmega165}, @code{atmega165a}, @code{atmega165p}, @code{atmega168}, @code{atmega168a}, @code{atmega168p}, @code{atmega169}, @code{atmega169a}, @code{atmega169p}, @code{atmega169pa}, @code{atmega32}, @code{atmega323}, @code{atmega324a}, @code{atmega324p}, @code{atmega324pa}, @code{atmega325}, @code{atmega325a}, @code{atmega325p}, @code{atmega3250}, @code{atmega3250a}, @code{atmega3250p}, @code{atmega328}, @code{atmega328p}, @code{atmega329}, @code{atmega329a}, @code{atmega329p}, @code{atmega329pa}, @code{atmega3290}, @code{atmega3290a}, @code{atmega3290p}, @code{atmega406}, @code{atmega64}, @code{atmega640}, @code{atmega644}, @code{atmega644a}, @code{atmega644p}, @code{atmega644pa}, @code{atmega645}, @code{atmega645a}, @code{atmega645p}, @code{atmega6450}, @code{atmega6450a}, @code{atmega6450p}, @code{atmega649}, @code{atmega649a}, @code{atmega649p}, @code{atmega6490}, @code{atmega16hva}, @code{atmega16hva2}, @code{atmega16hvb}, @code{atmega32hvb}, @code{atmega64hve}, @code{at90can32}, @code{at90can64}, @code{at90pwm216}, @code{at90pwm316}, @code{atmega32c1}, @code{atmega64c1}, @code{atmega16m1}, @code{atmega32m1}, @code{atmega64m1}, @code{atmega16u4}, @code{atmega32u4}, @code{atmega32u6}, @code{at90scr100}, @code{at90usb646}, @code{at90usb647}, @code{at94k}, @code{m3000}.
+
+@item avr51
+``Enhanced'' devices with 128@tie{}KiB of program memory.
+@*@var{mcu}@tie{}= @code{atmega128}, @code{atmega1280}, @code{atmega1281}, @code{atmega1284p}, @code{atmega128rfa1}, @code{at90can128}, @code{at90usb1286}, @code{at90usb1287}.
+
+@item avr6
+``Enhanced'' devices with 3-byte PC, i.e.@: with more than 128@tie{}KiB of program memory.
+@*@var{mcu}@tie{}= @code{atmega2560}, @code{atmega2561}.
+
+@item avrxmega2
+``XMEGA'' devices with more than 8@tie{}KiB and up to 64@tie{}KiB of program memory.
+@*@var{mcu}@tie{}= @code{atxmega16a4}, @code{atxmega16d4}, @code{atxmega16x1}, @code{atxmega32a4}, @code{atxmega32d4}, @code{atxmega32x1}.
+
+@item avrxmega4
+``XMEGA'' devices with more than 64@tie{}KiB and up to 128@tie{}KiB of program memory.
+@*@var{mcu}@tie{}= @code{atxmega64a3}, @code{atxmega64d3}.
+
+@item avrxmega5
+``XMEGA'' devices with more than 64@tie{}KiB and up to 128@tie{}KiB of program memory and more than 64@tie{}KiB of RAM.
+@*@var{mcu}@tie{}= @code{atxmega64a1}, @code{atxmega64a1u}.
+
+@item avrxmega6
+``XMEGA'' devices with more than 128@tie{}KiB of program memory.
+@*@var{mcu}@tie{}= @code{atxmega128a3}, @code{atxmega128d3}, @code{atxmega192a3}, @code{atxmega192d3}, @code{atxmega256a3}, @code{atxmega256a3b}, @code{atxmega256a3bu}, @code{atxmega256d3}.
+
+@item avrxmega7
+``XMEGA'' devices with more than 128@tie{}KiB of program memory and more than 64@tie{}KiB of RAM.
+@*@var{mcu}@tie{}= @code{atxmega128a1}, @code{atxmega128a1u}.
+
+@item avr1
+This ISA is implemented by the minimal AVR core and supported for assembler only.
+@*@var{mcu}@tie{}= @code{at90s1200}, @code{attiny11}, @code{attiny12}, @code{attiny15}, @code{attiny28}.
+
+@end table
Index: doc/invoke.texi
===================================================================
--- doc/invoke.texi	(revision 186488)
+++ doc/invoke.texi	(working copy)
@@ -10981,88 +10981,7 @@ The default for this option is@tie{}@cod
 
 GCC supports the following AVR devices and ISAs:
 
-@table @code
-
-@item avr1
-This ISA is implemented by the minimal AVR core and supported
-for assembler only.
-@*@var{mcu}@tie{}= @code{at90s1200},
-@code{attiny10}, @code{attiny11}, @code{attiny12}, @code{attiny15},
-@code{attiny28}.
-
-@item avr2
-``Classic'' devices with up to 8@tie{}KiB of program memory.
-@*@var{mcu}@tie{}= @code{at90s2313}, @code{attiny26}, @code{at90c8534},
-@dots{}
-
-@item avr25
-``Classic'' devices with up to 8@tie{}KiB of program memory and with
-the @code{MOVW} instruction.
-@*@var{mcu}@tie{}= @code{attiny2313}, @code{attiny261}, @code{attiny24},
-@dots{}
-
-@item avr3
-``Classic'' devices with 16@tie{}KiB up to 64@tie{}KiB of program memory.
-@*@var{mcu}@tie{}= @code{at43usb355}, @code{at76c711}.
-
-@item avr31
-``Classic'' devices with 128@tie{}KiB of program memory.
-@*@var{mcu}@tie{}= @code{atmega103}, @code{at43usb320}.
-
-@item avr35
-``Classic'' devices with 16@tie{}KiB up to 64@tie{}KiB of program
-memory and with the @code{MOVW} instruction.
-@*@var{mcu}@tie{}= @code{at90usb162}, @code{atmega8u2},
-@code{attiny167}, @dots{}
-
-@item avr4
-``Enhanced'' devices with up to 8@tie{}KiB of program memory.
-@*@var{mcu}@tie{}= @code{atmega8}, @code{atmega88}, @code{at90pwm81},
-@dots{}
-
-@item avr5
-``Enhanced'' devices with 16@tie{}KiB up to 64@tie{}KiB of program memory.
-@*@var{mcu}@tie{}= @code{atmega16}, @code{atmega6490}, @code{at90can64},
-@dots{}
-
-@item avr51
-``Enhanced'' devices with 128@tie{}KiB of program memory.
-@*@var{mcu}@tie{}= @code{atmega128}, @code{at90can128}, @code{at90usb1287},
-@dots{}
-
-@item avr6
-``Enhanced'' devices with 3-byte PC, i.e.@: with at least 256@tie{}KiB
-of program memory.
-@*@var{mcu}@tie{}= @code{atmega2560}, @code{atmega2561}.
-
-@item avrxmega2
-``XMEGA'' devices with more than 8@tie{}KiB and up to 64@tie{}KiB
-of program memory.
-@*@var{mcu}@tie{}= @code{atxmega16a4}, @code{atxmega16d4},
-@dots{}
-
-@item avrxmega4
-``XMEGA'' devices with more than 64@tie{}KiB and up to 128@tie{}KiB
-of program memory.
-@*@var{mcu}@tie{}= @code{atxmega64a3}, @code{atxmega64d3}.
-
-@item avrxmega5
-``XMEGA'' devices with more than 64@tie{}KiB and up to 128@tie{}KiB
-of program memory and more than 64@tie{}KiB of RAM.
-@*@var{mcu}@tie{}= @code{atxmega64a1}, @code{atxmega64a1u}.
-
-@item avrxmega6
-``XMEGA'' devices with more than 128@tie{}KiB of program memory.
-@*@var{mcu}@tie{}= @code{atxmega128a3}, @code{atxmega192d3},
-@dots{}
-
-@item avrxmega7
-``XMEGA'' devices with more than 128@tie{}KiB of program memory and
-more than 64@tie{}KiB of RAM.
-@*@var{mcu}@tie{}= @code{atxmega128a1}, @code{atxmega128a1u}.
-
-@end table
-
+@include avr-mmcu.texi
 
 @item -maccumulate-args
 @opindex maccumulate-args
Index: config/avr/gen-avr-mmcu-texi.c
===================================================================
--- config/avr/gen-avr-mmcu-texi.c	(revision 0)
+++ config/avr/gen-avr-mmcu-texi.c	(revision 0)
@@ -0,0 +1,73 @@
+/* Copyright (C) 2012
+   Free Software Foundation, Inc.
+   Contributed by Georg-Johann Lay (avr@gjlay.de)
+
+   This file is part of GCC.
+
+   GCC is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3, or (at your option)
+   any later version.
+   
+   GCC is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+   
+   You should have received a copy of the GNU General Public License
+   along with GCC; see the file COPYING3.  If not see
+   <http://www.gnu.org/licenses/>.  */
+
+#include "avr-devices.c"
+
+int main (void)
+{
+  enum avr_arch arch = 0;
+  unsigned i, first = 1;
+  const struct mcu_type_s *mcu;
+
+  printf ("@c Copyright (C) 2012 Free Software Foundation, Inc.\n");
+  printf ("@c This is part of the GCC manual.\n");
+  printf ("@c For copying conditions, see the file "
+          "gcc/doc/include/fdl.texi.\n\n");
+
+  printf ("@c This file is generated automatically using\n");
+  printf ("@c gcc/config/avr/gen-avr-mmcu-texi.c from:\n");
+  printf ("@c    gcc/config/avr/avr-devices.c\n");
+  printf ("@c    gcc/config/avr/avr-mcus.def\n\n");
+
+  printf ("@c Please do not edit manually.\n\n");
+
+  printf ("@table @code\n\n");
+
+  for (mcu = avr_mcu_types; mcu->name; mcu++)
+    {
+      if (mcu->macro == NULL)
+        {
+          arch = mcu->arch;
+
+          for (i = 0; i < sizeof (avr_texinfo) / sizeof (*avr_texinfo); i++)
+            {
+              if (arch == avr_texinfo[i].arch)
+                {
+                  if (mcu != avr_mcu_types)
+                    printf (".\n\n");
+                  printf ("@item %s\n%s\n", mcu->name, avr_texinfo[i].texinfo);
+                  printf ("@*@var{mcu}@tie{}=");
+                  first = 1;
+                  break;
+                }
+            }
+        }
+      else if (arch == (enum avr_arch) mcu->arch)
+        {
+          printf ("%s @code{%s}", first ? "" : ",", mcu->name);
+          first = 0;
+        }
+    }
+
+  printf (".\n\n");
+  printf ("@end table\n");
+
+  return EXIT_SUCCESS;
+}
Index: config/avr/avr-devices.c
===================================================================
--- config/avr/avr-devices.c	(revision 186488)
+++ config/avr/avr-devices.c	(working copy)
@@ -55,6 +55,51 @@ avr_arch_types[] =
   { 0, 1, 1, 1, 1, 1, 1, 1, 1, 0x2000,  0, "107", "avrxmega7" }
 };
 
+const struct arch_info_s
+avr_texinfo[] =
+{
+  { ARCH_AVR1,
+    "This ISA is implemented by the minimal AVR core and supported "
+    "for assembler only." },
+  { ARCH_AVR2,
+    "``Classic'' devices with up to 8@tie{}KiB of program memory." },
+  { ARCH_AVR25,
+    "``Classic'' devices with up to 8@tie{}KiB of program memory and with "
+    "the @code{MOVW} instruction." },
+  { ARCH_AVR3,
+    "``Classic'' devices with 16@tie{}KiB up to 64@tie{}KiB of "
+    " program memory." },
+  { ARCH_AVR31,
+    "``Classic'' devices with 128@tie{}KiB of program memory." },
+  { ARCH_AVR35,
+    "``Classic'' devices with 16@tie{}KiB up to 64@tie{}KiB of "
+    "program memory and with the @code{MOVW} instruction." },
+  { ARCH_AVR4,
+    "``Enhanced'' devices with up to 8@tie{}KiB of program memory." },
+  { ARCH_AVR5,
+    "``Enhanced'' devices with 16@tie{}KiB up to 64@tie{}KiB of "
+    "program memory." },
+  { ARCH_AVR51,
+    "``Enhanced'' devices with 128@tie{}KiB of program memory." },
+  { ARCH_AVR6,
+    "``Enhanced'' devices with 3-byte PC, i.e.@: with more than 128@tie{}KiB "
+    "of program memory." },
+  { ARCH_AVRXMEGA2,
+    "``XMEGA'' devices with more than 8@tie{}KiB and up to 64@tie{}KiB "
+    "of program memory." },
+  { ARCH_AVRXMEGA4,
+    "``XMEGA'' devices with more than 64@tie{}KiB and up to 128@tie{}KiB "
+    "of program memory." },
+  { ARCH_AVRXMEGA5,
+    "``XMEGA'' devices with more than 64@tie{}KiB and up to 128@tie{}KiB "
+    "of program memory and more than 64@tie{}KiB of RAM." },
+  { ARCH_AVRXMEGA6,
+    "``XMEGA'' devices with more than 128@tie{}KiB of program memory." },
+  { ARCH_AVRXMEGA7,
+    "``XMEGA'' devices with more than 128@tie{}KiB of program memory "
+    "and more than 64@tie{}KiB of RAM." }
+};
+
 const struct mcu_type_s avr_mcu_types[] = {
 #define AVR_MCU(NAME,ARCH,MACRO,SHORT_SP,ERRATA_SKIP,DATA_SEC,N_FLASH,LIB_NAME)\
   { NAME, ARCH, MACRO, SHORT_SP, ERRATA_SKIP, DATA_SEC, N_FLASH, LIB_NAME },
Index: config/avr/t-avr
===================================================================
--- config/avr/t-avr	(revision 186488)
+++ config/avr/t-avr	(working copy)
@@ -43,6 +43,26 @@ AVR_MCUS = $(srcdir)/config/avr/avr-mcus
 $(srcdir)/config/avr/avr-tables.opt: $(srcdir)/config/avr/genopt.sh $(AVR_MCUS)
 	$(SHELL) $< $(AVR_MCUS) > $@
 
+gen-avr-mmcu-texi$(build_exeext): $(srcdir)/config/avr/gen-avr-mmcu-texi.c \
+  $(TM_H) $(srcdir)/config/avr/avr-mcus.def $(srcdir)/config/avr/avr-devices.c
+	$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< -o $@
+
+avr-devices.o: s-avr-mmcu-texi
+
+s-avr-mmcu-texi: gen-avr-mmcu-texi$(build_exeext)
+	$(RUN_GEN) gen-avr-mmcu-texi$(build_exeext) > avr-mmcu.texi
+	@if cmp -s $(srcdir)/doc/avr-mmcu.texi avr-mmcu.texi; then \
+	  $(STAMP) $@;		\
+	else			\
+	  echo >&2 ;		\
+	  echo "***" >&2 ;	\
+	  echo "*** Verify that you have permission to grant a" >&2 ;	\
+	  echo "*** GFDL license for all new text in" >&2 ; 		\
+	  echo "*** avr-mmcu.texi, then copy it to $(srcdir)/doc/avr-mmcu.texi" >&2 ; \
+	  echo "***" >&2 ;	\
+	  false; 		\
+	fi
+
 # MULTILIB_OPTIONS
 # MULTILIB_DIRNAMES
 # MULTILIB_EXCEPTIONS
Index: config/avr/avr.h
===================================================================
--- config/avr/avr.h	(revision 186488)
+++ config/avr/avr.h	(working copy)
@@ -133,6 +133,14 @@ struct mcu_type_s {
   const char *const library_name; 
 };
 
+struct arch_info_s {
+  /* Architecture ID.  */
+  enum avr_arch arch;
+
+  /* textinfo source to describe the archtiecture.  */
+  const char *texinfo;
+};
+
 /* Preprocessor macros to define depending on MCU type.  */
 extern const char *avr_extra_arch_macro;
 extern const struct base_arch_s *avr_current_arch;
Index: Makefile.in
===================================================================
--- Makefile.in	(revision 186488)
+++ Makefile.in	(working copy)
@@ -4190,7 +4190,7 @@ TEXI_GCC_FILES = gcc.texi gcc-common.tex
 	 standards.texi invoke.texi extend.texi md.texi objc.texi	\
 	 gcov.texi trouble.texi bugreport.texi service.texi		\
 	 contribute.texi compat.texi funding.texi gnu.texi gpl_v3.texi	\
-	 fdl.texi contrib.texi cppenv.texi cppopts.texi			\
+	 fdl.texi contrib.texi cppenv.texi cppopts.texi avr-mmcu.texi	\
 	 implement-c.texi implement-cxx.texi arm-neon-intrinsics.texi
 
 # we explicitly use $(srcdir)/doc/tm.texi here to avoid confusion with

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