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]: New option for HCS12 support


Hi!

The 68HCS12 is similar to the 68HC12 except on the assembling of pc-relative mov instructions.
This patch adds a -m68hcs12 option which is passed to the assembler (already supported by binutils
main branch).

It is also necessary to specify the ABI (16/32-bit int, 32/64-bit float) when
assembling so that the elf abi flags are set correctly (and we can detect erroneous mixes of different abi).

I've committed this on 3_3 and mainline.

	Stephane

2003-01-15  Stephane Carrez  <stcarrez@nerim.fr>

	* config/m68hc11/m68hc11.h (ASM_SPEC): Handle -m68hcs12; Pass -mshort
	and -mshort-double to the assembler to specify the ABI.
	(LINK_SPEC): Likewise.
	(CPP_SPEC): Pass HCS12 specific define.
	(MASK_M68S12): New define.
	(TARGET_M68S12): Likewise.
	(TARGET_SWITCHES): New options -m68hcs12 and -m68S12.
	(TARGET_VERSION): Update.
	* config/m68hc11/m68hc12.h (CPP_SPEC): Pass HCS12 specific define.
	(LINK_SPEC): Update.
	(ASM_SPEC): Update.
	* config/m68hc11/m68hc11.c (m68hc11_asm_file_start): Update.
	* doc/invoke.texi (M68hc1x Options): Document -m68hcs12.
Index: doc/invoke.texi
===================================================================
RCS file: /cvs/gcc/gcc/gcc/doc/invoke.texi,v
retrieving revision 1.223
diff -u -p -r1.223 invoke.texi
--- doc/invoke.texi	10 Jan 2003 15:22:53 -0000	1.223
+++ doc/invoke.texi	15 Jan 2003 22:37:43 -0000
@@ -345,7 +345,7 @@ in the following sections.
 
 @emph{M68hc1x Options}
 @gccoptlist{
--m6811  -m6812  -m68hc11  -m68hc12 @gol
+-m6811  -m6812  -m68hc11  -m68hc12   -m68hcs12 @gol
 -mauto-incdec  -minmax  -mlong-calls  -mshort @gol
 -msoft-reg-count=@var{count}}
 
@@ -5504,6 +5504,12 @@ when the compiler is configured for 68HC
 @opindex m68hc12
 Generate output for a 68HC12.  This is the default
 when the compiler is configured for 68HC12-based systems.
+
+@item -m68S12
+@itemx -m68hcs12
+@opindex m68S12
+@opindex m68hcs12
+Generate output for a 68HCS12.  
 
 @item -mauto-incdec
 @opindex mauto-incdec
Index: config/m68hc11/m68hc11.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/m68hc11/m68hc11.c,v
retrieving revision 1.57
diff -u -p -r1.57 m68hc11.c
--- config/m68hc11/m68hc11.c	16 Dec 2002 18:21:29 -0000	1.57
+++ config/m68hc11/m68hc11.c	15 Jan 2003 22:37:46 -0000
@@ -1,5 +1,5 @@
 /* Subroutines for code generation on Motorola 68HC11 and 68HC12.
-   Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
    Contributed by Stephane Carrez (stcarrez@nerim.fr)
 
 This file is part of GNU CC.
@@ -5509,7 +5509,10 @@ m68hc11_asm_file_start (out, main_file)
      const char *main_file;
 {
   fprintf (out, ";;;-----------------------------------------\n");
-  fprintf (out, ";;; Start MC68HC11 gcc assembly output\n");
+  fprintf (out, ";;; Start %s gcc assembly output\n",
+           TARGET_M6811
+           ? "MC68HC11"
+           : TARGET_M68S12 ? "MC68HCS12" : "MC68HC12");
   fprintf (out, ";;; gcc compiler %s\n", version_string);
   print_options (out);
   fprintf (out, ";;;-----------------------------------------\n");
Index: config/m68hc11/m68hc11.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/m68hc11/m68hc11.h,v
retrieving revision 1.57
diff -u -p -r1.57 m68hc11.h
--- config/m68hc11/m68hc11.h	20 Dec 2002 04:30:50 -0000	1.57
+++ config/m68hc11/m68hc11.h	15 Jan 2003 22:37:47 -0000
@@ -1,6 +1,6 @@
 /* Definitions of target machine for GNU compiler.
    Motorola 68HC11 and 68HC12.
-   Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
    Contributed by Stephane Carrez (stcarrez@nerim.fr)
 
 This file is part of GNU CC.
@@ -43,13 +43,22 @@ Note:
 
 /* Compile and assemble for a 68hc11 unless there is a -m68hc12 option.  */
 #ifndef ASM_SPEC
-#define ASM_SPEC       "%{m68hc12:-m68hc12}%{!m68hc12:-m68hc11}"
+#define ASM_SPEC                                                \
+"%{m68hc12:-m68hc12}"                                           \
+"%{m68hcs12:-m68hcs12}"                                         \
+"%{!m68hc12:%{!m68hcs12:-m68hc11}} "                            \
+"%{mshort:-mshort}%{!mshort:-mlong} "                           \
+"%{fshort-double:-mshort-double}%{!fshort-double:-mlong-double}"
 #endif
 
 /* We need to tell the linker the target elf format.  Just pass an
    emulation option.  This can be overridden by -Wl option of gcc.  */
 #ifndef LINK_SPEC
-#define LINK_SPEC      "%{m68hc12:-m m68hc12elf}%{!m68hc12:-m m68hc11elf} %{mrelax:-relax}"
+#define LINK_SPEC                                               \
+"%{m68hc12:-m m68hc12elf}"                                      \
+"%{m68hcs12:-m m68hc12elf}"                                     \
+"%{!m68hc12:%{!m68hcs12:-m m68hc11elf}} "                       \
+"%{!mnorelax:%{!m68hc12:%{!m68hcs12:-relax}}}"
 #endif
 
 #ifndef LIB_SPEC
@@ -65,7 +74,8 @@ Note:
 "%{mshort:-D__HAVE_SHORT_INT__ -D__INT__=16}\
  %{!mshort:-D__INT__=32}\
  %{m68hc12:-Dmc6812 -DMC6812 -Dmc68hc12}\
- %{!m68hc12:-Dmc6811 -DMC6811 -Dmc68hc11}\
+ %{m68hcs12:-Dmc6812 -DMC6812 -Dmc68hcs12}\
+ %{!m68hc12:%{!m68hcs12:-Dmc6811 -DMC6811 -Dmc68hc11}}\
  %{fshort-double:-D__HAVE_SHORT_DOUBLE__}\
  %{mlong-calls:-D__USE_RTC__}"
 #endif
@@ -118,15 +128,16 @@ extern short *reg_renumber;	/* def in lo
 #define MASK_SHORT              0002	/* Compile with 16-bit `int' */
 #define MASK_AUTO_INC_DEC       0004
 #define MASK_M6811              0010
-#define MASK_M6812              0020
-#define MASK_NO_DIRECT_MODE     0040
-#define MASK_MIN_MAX            0100
-#define MASK_LONG_CALLS         0200
+#define MASK_M68S12             0040
+#define MASK_NO_DIRECT_MODE     0100
+#define MASK_MIN_MAX            0200
+#define MASK_LONG_CALLS         0400
 
 #define TARGET_OP_TIME		(optimize && optimize_size == 0)
 #define TARGET_SHORT            (target_flags & MASK_SHORT)
 #define TARGET_M6811            (target_flags & MASK_M6811)
 #define TARGET_M6812            (target_flags & MASK_M6812)
+#define TARGET_M68S12           (target_flags & MASK_M68S12)
 #define TARGET_AUTO_INC_DEC     (target_flags & MASK_AUTO_INC_DEC)
 #define TARGET_MIN_MAX          (target_flags & MASK_MIN_MAX)
 #define TARGET_NO_DIRECT_MODE   (target_flags & MASK_NO_DIRECT_MODE)
@@ -178,10 +189,14 @@ extern short *reg_renumber;	/* def in lo
     N_("Compile for a 68HC11")},				\
   { "68hc12", MASK_M6812,					\
     N_("Compile for a 68HC12")},				\
+  { "68hcs12", MASK_M6812 | MASK_M68S12,			\
+    N_("Compile for a 68HCS12")},				\
   { "6811",   MASK_M6811,					\
     N_("Compile for a 68HC11")},				\
   { "6812",   MASK_M6812,					\
     N_("Compile for a 68HC12")},				\
+  { "68S12",  MASK_M6812 | MASK_M68S12,				\
+    N_("Compile for a 68HCS12")},				\
   { "", TARGET_DEFAULT, 0 }}
 
 /* This macro is similar to `TARGET_SWITCHES' but defines names of
@@ -214,7 +229,7 @@ extern const char *m68hc11_soft_reg_coun
 #endif
 
 /* Print subsidiary information on the compiler version in use.  */
-#define TARGET_VERSION		fprintf (stderr, " (MC68HC11/MC68HC12)")
+#define TARGET_VERSION	fprintf (stderr, " (MC68HC11/MC68HC12/MC68HCS12)")
 
 /* Sometimes certain combinations of command options do not make
    sense on a particular target machine.  You can define a macro
Index: config/m68hc11/m68hc12.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/m68hc11/m68hc12.h,v
retrieving revision 1.5
diff -u -p -r1.5 m68hc12.h
--- config/m68hc11/m68hc12.h	20 Dec 2002 04:30:51 -0000	1.5
+++ config/m68hc11/m68hc12.h	15 Jan 2003 22:37:47 -0000
@@ -1,6 +1,6 @@
 /* Definitions of target machine for GNU compiler, for m68hc12.
-   Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
-   Contributed by Stephane Carrez (stcarrez@worldnet.fr).
+   Copyright (C) 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
+   Contributed by Stephane Carrez (stcarrez@nerim.fr).
 
 This file is part of GNU CC.
 
@@ -20,19 +20,26 @@ the Free Software Foundation, 59 Temple 
 Boston, MA 02111-1307, USA.  */
 
 /* Compile and assemble for a 68hc12 unless there is a -m68hc11 option.  */
-#define ASM_SPEC       "%{m68hc11:-m68hc11}%{!m68hc11:-m68hc12}"
+#define ASM_SPEC                                                \
+"%{m68hc11:-m68hc11}"                                           \
+"%{m68hcs12:-m68hcs12}"                                         \
+"%{!m68hc11:%{!m68hcs12:-m68hc12}}"
 #define LIB_SPEC       ""
 #define CC1_SPEC       ""
 
 /* We need to tell the linker the target elf format.  Just pass an
    emulation option.  This can be overridden by -Wl option of gcc.  */
-#define LINK_SPEC      "%{m68hc11:-m m68hc11elf}%{!m68hc11:-m m68hc12elf}"
+#define LINK_SPEC                                               \
+"%{m68hc11:-m m68hc11elf}"                                      \
+"%{m68hcs12:-m m68hc12elf}"                                     \
+"%{!m68hc11:%{!m68hcs12:-m m68hc11elf}} %{mrelax:-relax}"
 
 #define CPP_SPEC  \
 "%{mshort:-D__HAVE_SHORT_INT__ -D__INT__=16}\
  %{!mshort:-D__INT__=32}\
  %{m68hc11:-Dmc6811 -DMC6811 -Dmc68hc11}\
- %{!m68hc11:-Dmc6812 -DMC6812 -Dmc68hc12}\
+ %{!m68hc11:%{!m68hc12:-Dmc6812 -DMC6812 -Dmc68hc12}}\
+ %{m68hcs12:-Dmc6812 -DMC6812 -Dmc68hcs12}\
  %{fshort-double:-D__HAVE_SHORT_DOUBLE__}"
 
 /* Default target_flags if no switches specified.  */

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