public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [MSP430][PATCH 0/2] Improve and extend MCU data handling
@ 2019-08-08 12:17 Jozef Lawrynowicz
  2019-08-08 12:24 ` [MSP430][PATCH 1/2] Consolidate handling of hard-coded MCU data Jozef Lawrynowicz
  2019-08-08 12:59 ` [MSP430][PATCH 2/2] Read MCU data from external file Jozef Lawrynowicz
  0 siblings, 2 replies; 7+ messages in thread
From: Jozef Lawrynowicz @ 2019-08-08 12:17 UTC (permalink / raw)
  To: gcc-patches

Each different MSP430 MCU has two properties that affect code generation, the
CPU ISA and the hardware multiply support. These can be manually specified with
the -mcpu= and -mhwmult= options, respectively.
The existing -mmcu= option takes an MCU name as an argument and uses the CPU
ISA and hardware multiply known to be supported for that MCU during code
generation, so the user does not have to provide the -mcpu and -mhwmult options.

The first patch improves the handling of MCU data by consolidating multiple
copies of hard-coded MCU data into a single location, and adds a new function
to be used as a single entry point for the extraction of MCU data for the
selected MCU.

The second patch extends the MCU data handling so that MCU data can be provided
in an external file (devices.csv). This means the compiler doesn't have to be
updated and rebuilt to support new devices when they are released.

Successfully regtested for msp430-elf on trunk.

Ok for trunk?

Thanks,
Jozef

Jozef Lawrynowicz (2):
  MSP430: Devices [1]: Consolidate handling of hard-coded MCU data
  MSP430: Devices [2]: Read MCU data from external devices.csv file, if
    it exists

 gcc/config.gcc                                |   3 +-
 gcc/config/msp430/driver-msp430.c             | 675 +-----------
 gcc/config/msp430/msp430-devices.c            | 971 ++++++++++++++++++
 gcc/config/msp430/msp430-devices.h            |  31 +
 gcc/config/msp430/msp430.c                    | 680 +-----------
 gcc/config/msp430/msp430.h                    |  18 +-
 gcc/config/msp430/msp430.opt                  |   9 +
 gcc/config/msp430/t-msp430                    | 236 +----
 gcc/doc/invoke.texi                           |  14 +-
 .../gcc.target/msp430/devices-main.c          |   6 +
 .../gcc.target/msp430/devices/README          |  17 +
 .../gcc.target/msp430/devices/bad-devices-1.c |   5 +
 .../msp430/devices/bad-devices-1.csv          |   3 +
 .../gcc.target/msp430/devices/bad-devices-2.c |   5 +
 .../msp430/devices/bad-devices-2.csv          |   3 +
 .../gcc.target/msp430/devices/bad-devices-3.c |   5 +
 .../msp430/devices/bad-devices-3.csv          |   3 +
 .../gcc.target/msp430/devices/bad-devices-4.c |   5 +
 .../msp430/devices/bad-devices-4.csv          |   3 +
 .../gcc.target/msp430/devices/bad-devices-5.c |   5 +
 .../msp430/devices/bad-devices-5.csv          |   3 +
 .../gcc.target/msp430/devices/bad-devices-6.c |   5 +
 .../msp430/devices/bad-devices-6.csv          |   3 +
 .../msp430/devices/csv-device-order.c         |  11 +
 .../gcc.target/msp430/devices/csv-msp430_00.c |   7 +
 .../gcc.target/msp430/devices/csv-msp430_01.c |   7 +
 .../gcc.target/msp430/devices/csv-msp430_02.c |   7 +
 .../gcc.target/msp430/devices/csv-msp430_04.c |   7 +
 .../gcc.target/msp430/devices/csv-msp430_08.c |   7 +
 .../gcc.target/msp430/devices/csv-msp430_10.c |   6 +
 .../gcc.target/msp430/devices/csv-msp430_11.c |   6 +
 .../gcc.target/msp430/devices/csv-msp430_12.c |   6 +
 .../gcc.target/msp430/devices/csv-msp430_14.c |   6 +
 .../gcc.target/msp430/devices/csv-msp430_18.c |   6 +
 .../gcc.target/msp430/devices/csv-msp430_20.c |   6 +
 .../gcc.target/msp430/devices/csv-msp430_21.c |   6 +
 .../gcc.target/msp430/devices/csv-msp430_22.c |   6 +
 .../gcc.target/msp430/devices/csv-msp430_24.c |   6 +
 .../gcc.target/msp430/devices/csv-msp430_28.c |   6 +
 .../msp430/devices/csv-msp430fr5969.c         |  11 +
 .../gcc.target/msp430/devices/devices.csv     |  22 +
 .../msp430/devices/hard-cc430f5123.c          |   7 +
 .../gcc.target/msp430/devices/hard-foo.c      |   6 +
 .../msp430/devices/hard-msp430afe253.c        |   8 +
 .../msp430/devices/hard-msp430cg4616.c        |   7 +
 .../msp430/devices/hard-msp430f4783.c         |   8 +
 .../msp430/devices/hard-rf430frl154h_rom.c    |   8 +
 gcc/testsuite/gcc.target/msp430/msp430.exp    |  96 +-
 48 files changed, 1476 insertions(+), 1511 deletions(-)
 create mode 100644 gcc/config/msp430/msp430-devices.c
 create mode 100644 gcc/config/msp430/msp430-devices.h
 create mode 100644 gcc/testsuite/gcc.target/msp430/devices-main.c
 create mode 100644 gcc/testsuite/gcc.target/msp430/devices/README
 create mode 100644 gcc/testsuite/gcc.target/msp430/devices/bad-devices-1.c
 create mode 100644 gcc/testsuite/gcc.target/msp430/devices/bad-devices-1.csv
 create mode 100644 gcc/testsuite/gcc.target/msp430/devices/bad-devices-2.c
 create mode 100644 gcc/testsuite/gcc.target/msp430/devices/bad-devices-2.csv
 create mode 100644 gcc/testsuite/gcc.target/msp430/devices/bad-devices-3.c
 create mode 100644 gcc/testsuite/gcc.target/msp430/devices/bad-devices-3.csv
 create mode 100644 gcc/testsuite/gcc.target/msp430/devices/bad-devices-4.c
 create mode 100644 gcc/testsuite/gcc.target/msp430/devices/bad-devices-4.csv
 create mode 100644 gcc/testsuite/gcc.target/msp430/devices/bad-devices-5.c
 create mode 100644 gcc/testsuite/gcc.target/msp430/devices/bad-devices-5.csv
 create mode 100644 gcc/testsuite/gcc.target/msp430/devices/bad-devices-6.c
 create mode 100644 gcc/testsuite/gcc.target/msp430/devices/bad-devices-6.csv
 create mode 100644 gcc/testsuite/gcc.target/msp430/devices/csv-device-order.c
 create mode 100644 gcc/testsuite/gcc.target/msp430/devices/csv-msp430_00.c
 create mode 100644 gcc/testsuite/gcc.target/msp430/devices/csv-msp430_01.c
 create mode 100644 gcc/testsuite/gcc.target/msp430/devices/csv-msp430_02.c
 create mode 100644 gcc/testsuite/gcc.target/msp430/devices/csv-msp430_04.c
 create mode 100644 gcc/testsuite/gcc.target/msp430/devices/csv-msp430_08.c
 create mode 100644 gcc/testsuite/gcc.target/msp430/devices/csv-msp430_10.c
 create mode 100644 gcc/testsuite/gcc.target/msp430/devices/csv-msp430_11.c
 create mode 100644 gcc/testsuite/gcc.target/msp430/devices/csv-msp430_12.c
 create mode 100644 gcc/testsuite/gcc.target/msp430/devices/csv-msp430_14.c
 create mode 100644 gcc/testsuite/gcc.target/msp430/devices/csv-msp430_18.c
 create mode 100644 gcc/testsuite/gcc.target/msp430/devices/csv-msp430_20.c
 create mode 100644 gcc/testsuite/gcc.target/msp430/devices/csv-msp430_21.c
 create mode 100644 gcc/testsuite/gcc.target/msp430/devices/csv-msp430_22.c
 create mode 100644 gcc/testsuite/gcc.target/msp430/devices/csv-msp430_24.c
 create mode 100644 gcc/testsuite/gcc.target/msp430/devices/csv-msp430_28.c
 create mode 100644 gcc/testsuite/gcc.target/msp430/devices/csv-msp430fr5969.c
 create mode 100644 gcc/testsuite/gcc.target/msp430/devices/devices.csv
 create mode 100644 gcc/testsuite/gcc.target/msp430/devices/hard-cc430f5123.c
 create mode 100644 gcc/testsuite/gcc.target/msp430/devices/hard-foo.c
 create mode 100644 gcc/testsuite/gcc.target/msp430/devices/hard-msp430afe253.c
 create mode 100644 gcc/testsuite/gcc.target/msp430/devices/hard-msp430cg4616.c
 create mode 100644 gcc/testsuite/gcc.target/msp430/devices/hard-msp430f4783.c
 create mode 100644
 gcc/testsuite/gcc.target/msp430/devices/hard-rf430frl154h_rom.c

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [MSP430][PATCH 1/2] Consolidate handling of hard-coded MCU data
  2019-08-08 12:17 [MSP430][PATCH 0/2] Improve and extend MCU data handling Jozef Lawrynowicz
@ 2019-08-08 12:24 ` Jozef Lawrynowicz
  2019-08-12 21:57   ` Jeff Law
  2019-08-08 12:59 ` [MSP430][PATCH 2/2] Read MCU data from external file Jozef Lawrynowicz
  1 sibling, 1 reply; 7+ messages in thread
From: Jozef Lawrynowicz @ 2019-08-08 12:24 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 890 bytes --]

This patch improves the handling of MCU data by consolidating multiple
copies of hard-coded MCU data into a single location, and adds a new function
to be used as a single entry point for the extraction of MCU data for the
selected MCU.

This ensures the data is only extracted once per invocation of the
driver/compiler, whilst previously, the data for the MCU is extracted each time
it is needed.

Some notes:
- The GNU assembler doesn't do anything with the -mmcu option beyond setting up
  the CPU ISA, so if the GCC driver passes it the -mcpu option, which it will
  always do if -mmcu is specified, then it is redundant to also pass it -mmcu.
- The indenting in some places (e.g. msp430_select_hwmult_lib) looks wrong in
  the patched file, but to make the diff a lot easier to read I have kept the
  indenting the same as it was before. I can fix this after the patch is
  accepted.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-MSP430-Devices-1-Consolidate-handling-of-hard-coded-.patch --]
[-- Type: text/x-patch, Size: 91044 bytes --]

From cd131b07e0447d104c99317e7ac37c2420c1bf6e Mon Sep 17 00:00:00 2001
From: Jozef Lawrynowicz <jozef.l@mittosystems.com>
Date: Wed, 31 Jul 2019 22:53:50 +0100
Subject: [PATCH 1/2] MSP430: Devices [1]: Consolidate handling of hard-coded
 MCU data

gcc/ChangeLog:

2019-08-XX  Jozef Lawrynowicz  <jozef.l@mittosystems.com>

	* gcc/config.gcc (msp430*-*-*): Add msp430-devices.o to extra_objs and
	extra_gcc_objs.
	* gcc/config/msp430/driver-msp430.c: Remove msp430_mcu_data.
	(msp430_select_cpu): New spec function.
	(msp430_select_hwmult_lib): Use msp430_extract_mcu_data to extract
	MCU data.
	* gcc/config/msp430/msp430-devices.c: New file.
	* gcc/config/msp430/msp430-devices.h: New file.
	* gcc/config/msp430/msp430.c: Remove msp430_mcu_data.
	(msp430_option_override): Use msp430_extract_mcu_data to extract
	MCU data.
	(msp430_use_f5_series_hwmult): Likewise.
	(use_32bit_hwmult): Likewise.
	(msp430_no_hwmult): Likewise.
	* gcc/config/msp430/msp430.h (ASM_SPEC): Don't pass -mmcu to the
	assembler.
	(DRIVER_SELF_SPECS): Call msp430_select_cpu if -mmcu is used without
	and -mcpu option.
	(EXTRA_SPEC_FUNCTIONS): Add msp430_select_cpu.
	* gcc/config/msp430/t-msp430: Add rule to build msp430-devices.o.
	Remove hard-coded MCU multilib data.

gcc/testsuite/ChangeLog:

2019-08-XX  Jozef Lawrynowicz  <jozef.l@mittosystems.com>

	* gcc.target/msp430/msp430.exp
	(check_effective_target_msp430_430_selected): New.
	(check_effective_target_msp430_430x_selected): New.
	(check_effective_target_msp430_mlarge_selected): New.
	(check_effective_target_msp430_hwmul_not_none): New.
	(check_effective_target_msp430_hwmul_not_16bit): New.
	(check_effective_target_msp430_hwmul_not_32bit): New.
	(check_effective_target_msp430_hwmul_not_f5): New.
	(msp430_get_opts): New.
	(msp430_device_permutations_runtest): New.
	* gcc.target/msp430/devices/README: New file.
	* gcc.target/msp430/devices-main.c: New test.
	* gcc.target/msp430/devices/hard-cc430f5123.c: Likewise.
	* gcc.target/msp430/devices/hard-foo.c: Likewise.
	* gcc.target/msp430/devices/hard-msp430afe253.c: Likewise.
	* gcc.target/msp430/devices/hard-msp430cg4616.c: Likewise.
	* gcc.target/msp430/devices/hard-msp430f4783.c: Likewise.
	* gcc.target/msp430/devices/hard-rf430frl154h_rom.c: Likewise.
---
 gcc/config.gcc                                |   3 +-
 gcc/config/msp430/driver-msp430.c             | 654 +---------------
 gcc/config/msp430/msp430-devices.c            | 697 ++++++++++++++++++
 gcc/config/msp430/msp430-devices.h            |  31 +
 gcc/config/msp430/msp430.c                    | 680 +----------------
 gcc/config/msp430/msp430.h                    |  10 +-
 gcc/config/msp430/t-msp430                    | 236 +-----
 .../gcc.target/msp430/devices-main.c          |   6 +
 .../gcc.target/msp430/devices/README          |  12 +
 .../msp430/devices/hard-cc430f5123.c          |   7 +
 .../gcc.target/msp430/devices/hard-foo.c      |   5 +
 .../msp430/devices/hard-msp430afe253.c        |   8 +
 .../msp430/devices/hard-msp430cg4616.c        |   7 +
 .../msp430/devices/hard-msp430f4783.c         |   8 +
 .../msp430/devices/hard-rf430frl154h_rom.c    |   8 +
 gcc/testsuite/gcc.target/msp430/msp430.exp    |  82 ++-
 16 files changed, 943 insertions(+), 1511 deletions(-)
 create mode 100644 gcc/config/msp430/msp430-devices.c
 create mode 100644 gcc/config/msp430/msp430-devices.h
 create mode 100644 gcc/testsuite/gcc.target/msp430/devices-main.c
 create mode 100644 gcc/testsuite/gcc.target/msp430/devices/README
 create mode 100644 gcc/testsuite/gcc.target/msp430/devices/hard-cc430f5123.c
 create mode 100644 gcc/testsuite/gcc.target/msp430/devices/hard-foo.c
 create mode 100644 gcc/testsuite/gcc.target/msp430/devices/hard-msp430afe253.c
 create mode 100644 gcc/testsuite/gcc.target/msp430/devices/hard-msp430cg4616.c
 create mode 100644 gcc/testsuite/gcc.target/msp430/devices/hard-msp430f4783.c
 create mode 100644 gcc/testsuite/gcc.target/msp430/devices/hard-rf430frl154h_rom.c

diff --git a/gcc/config.gcc b/gcc/config.gcc
index 291e2881f96..40cbc52dc99 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -2519,7 +2519,8 @@ msp430*-*-*)
 	c_target_objs="msp430-c.o"
 	cxx_target_objs="msp430-c.o"
 	tmake_file="${tmake_file} msp430/t-msp430"
-	extra_gcc_objs="driver-msp430.o"
+	extra_objs="${extra_objs} msp430-devices.o"
+	extra_gcc_objs="driver-msp430.o msp430-devices.o"
 	# Enable .init_array unless it has been explicitly disabled.
 	# The MSP430 EABI mandates the use of .init_array, and the Newlib CRT
 	# code since mid-2019 expects it.
diff --git a/gcc/config/msp430/driver-msp430.c b/gcc/config/msp430/driver-msp430.c
index 5583db6edf7..9ad05dca957 100644
--- a/gcc/config/msp430/driver-msp430.c
+++ b/gcc/config/msp430/driver-msp430.c
@@ -25,627 +25,34 @@
 #include "coretypes.h"
 #include "diagnostic.h"
 #include "tm.h"
+#include "msp430-devices.h"
 
-/* This is a copy of the same data structure found in gas/config/tc-msp430.c
-   Also another (sort-of) copy can be found in gcc/config/msp430/msp430.c
-   Keep these three structures in sync.
-   The data in this structure has been extracted from version 1.194 of the
-   devices.csv file released by TI in September 2016.  */
-
-struct msp430_mcu_data
+/* This spec function is called if the user has provided an -mmcu option without
+   an -mcpu option.  It will place the correct -mcpu option for the given -mmcu
+   onto the command line, to ensure the correct ISA multilib is selected.  */
+const char *
+msp430_select_cpu (int argc, const char ** argv)
 {
-  const char * name;
-  unsigned int revision; /* 0=> MSP430, 1=>MSP430X, 2=> MSP430Xv2.  */
-  unsigned int hwmpy;    /* 0=>none, 1=>16-bit, 2=>16-bit w/sign extend, 4=>32-bit, 8=> 32-bit (5xx).  */
+  if (argc == 0)
+    {
+      error ("expected an argument to %<msp430_select_cpu>%");
+      return NULL;
+    }
+  msp430_extract_mcu_data (argv[0]);
+  if (extracted_mcu_data.name != NULL)
+    {
+      switch (extracted_mcu_data.revision)
+	{
+	case 0: return "-mcpu=msp430";
+	case 1: return "-mcpu=msp430x";
+	case 2: return "-mcpu=msp430xv2";
+	default:
+		gcc_unreachable ();
+	}
+    }
+  /* MCU wasn't found, the compiler proper will warn about this.  */
+  return NULL;
 }
-msp430_mcu_data [] =
-{
-  { "cc430f5123",2,8 },
-  { "cc430f5125",2,8 },
-  { "cc430f5133",2,8 },
-  { "cc430f5135",2,8 },
-  { "cc430f5137",2,8 },
-  { "cc430f5143",2,8 },
-  { "cc430f5145",2,8 },
-  { "cc430f5147",2,8 },
-  { "cc430f6125",2,8 },
-  { "cc430f6126",2,8 },
-  { "cc430f6127",2,8 },
-  { "cc430f6135",2,8 },
-  { "cc430f6137",2,8 },
-  { "cc430f6143",2,8 },
-  { "cc430f6145",2,8 },
-  { "cc430f6147",2,8 },
-  { "msp430afe221",0,2 },
-  { "msp430afe222",0,2 },
-  { "msp430afe223",0,2 },
-  { "msp430afe231",0,2 },
-  { "msp430afe232",0,2 },
-  { "msp430afe233",0,2 },
-  { "msp430afe251",0,2 },
-  { "msp430afe252",0,2 },
-  { "msp430afe253",0,2 },
-  { "msp430bt5190",2,8 },
-  { "msp430c091",0,0 },
-  { "msp430c092",0,0 },
-  { "msp430c111",0,0 },
-  { "msp430c1111",0,0 },
-  { "msp430c112",0,0 },
-  { "msp430c1121",0,0 },
-  { "msp430c1331",0,0 },
-  { "msp430c1351",0,0 },
-  { "msp430c311s",0,0 },
-  { "msp430c312",0,0 },
-  { "msp430c313",0,0 },
-  { "msp430c314",0,0 },
-  { "msp430c315",0,0 },
-  { "msp430c323",0,0 },
-  { "msp430c325",0,0 },
-  { "msp430c336",0,1 },
-  { "msp430c337",0,1 },
-  { "msp430c412",0,0 },
-  { "msp430c413",0,0 },
-  { "msp430cg4616",1,1 },
-  { "msp430cg4617",1,1 },
-  { "msp430cg4618",1,1 },
-  { "msp430cg4619",1,1 },
-  { "msp430e112",0,0 },
-  { "msp430e313",0,0 },
-  { "msp430e315",0,0 },
-  { "msp430e325",0,0 },
-  { "msp430e337",0,1 },
-  { "msp430f110",0,0 },
-  { "msp430f1101",0,0 },
-  { "msp430f1101a",0,0 },
-  { "msp430f1111",0,0 },
-  { "msp430f1111a",0,0 },
-  { "msp430f112",0,0 },
-  { "msp430f1121",0,0 },
-  { "msp430f1121a",0,0 },
-  { "msp430f1122",0,0 },
-  { "msp430f1132",0,0 },
-  { "msp430f122",0,0 },
-  { "msp430f1222",0,0 },
-  { "msp430f123",0,0 },
-  { "msp430f1232",0,0 },
-  { "msp430f133",0,0 },
-  { "msp430f135",0,0 },
-  { "msp430f147",0,1 },
-  { "msp430f1471",0,1 },
-  { "msp430f148",0,1 },
-  { "msp430f1481",0,1 },
-  { "msp430f149",0,1 },
-  { "msp430f1491",0,1 },
-  { "msp430f155",0,0 },
-  { "msp430f156",0,0 },
-  { "msp430f157",0,0 },
-  { "msp430f1610",0,1 },
-  { "msp430f1611",0,1 },
-  { "msp430f1612",0,1 },
-  { "msp430f167",0,1 },
-  { "msp430f168",0,1 },
-  { "msp430f169",0,1 },
-  { "msp430f2001",0,0 },
-  { "msp430f2002",0,0 },
-  { "msp430f2003",0,0 },
-  { "msp430f2011",0,0 },
-  { "msp430f2012",0,0 },
-  { "msp430f2013",0,0 },
-  { "msp430f2101",0,0 },
-  { "msp430f2111",0,0 },
-  { "msp430f2112",0,0 },
-  { "msp430f2121",0,0 },
-  { "msp430f2122",0,0 },
-  { "msp430f2131",0,0 },
-  { "msp430f2132",0,0 },
-  { "msp430f2232",0,0 },
-  { "msp430f2234",0,0 },
-  { "msp430f2252",0,0 },
-  { "msp430f2254",0,0 },
-  { "msp430f2272",0,0 },
-  { "msp430f2274",0,0 },
-  { "msp430f233",0,2 },
-  { "msp430f2330",0,2 },
-  { "msp430f235",0,2 },
-  { "msp430f2350",0,2 },
-  { "msp430f2370",0,2 },
-  { "msp430f2410",0,2 },
-  { "msp430f2416",1,2 },
-  { "msp430f2417",1,2 },
-  { "msp430f2418",1,2 },
-  { "msp430f2419",1,2 },
-  { "msp430f247",0,2 },
-  { "msp430f2471",0,2 },
-  { "msp430f248",0,2 },
-  { "msp430f2481",0,2 },
-  { "msp430f249",0,2 },
-  { "msp430f2491",0,2 },
-  { "msp430f2616",1,2 },
-  { "msp430f2617",1,2 },
-  { "msp430f2618",1,2 },
-  { "msp430f2619",1,2 },
-  { "msp430f412",0,0 },
-  { "msp430f413",0,0 },
-  { "msp430f4132",0,0 },
-  { "msp430f415",0,0 },
-  { "msp430f4152",0,0 },
-  { "msp430f417",0,0 },
-  { "msp430f423",0,1 },
-  { "msp430f423a",0,1 },
-  { "msp430f425",0,1 },
-  { "msp430f4250",0,0 },
-  { "msp430f425a",0,1 },
-  { "msp430f4260",0,0 },
-  { "msp430f427",0,1 },
-  { "msp430f4270",0,0 },
-  { "msp430f427a",0,1 },
-  { "msp430f435",0,0 },
-  { "msp430f4351",0,0 },
-  { "msp430f436",0,0 },
-  { "msp430f4361",0,0 },
-  { "msp430f437",0,0 },
-  { "msp430f4371",0,0 },
-  { "msp430f438",0,0 },
-  { "msp430f439",0,0 },
-  { "msp430f447",0,1 },
-  { "msp430f448",0,1 },
-  { "msp430f4481",0,1 },
-  { "msp430f449",0,1 },
-  { "msp430f4491",0,1 },
-  { "msp430f4616",1,1 },
-  { "msp430f46161",1,1 },
-  { "msp430f4617",1,1 },
-  { "msp430f46171",1,1 },
-  { "msp430f4618",1,1 },
-  { "msp430f46181",1,1 },
-  { "msp430f4619",1,1 },
-  { "msp430f46191",1,1 },
-  { "msp430f47126",1,4 },
-  { "msp430f47127",1,4 },
-  { "msp430f47163",1,4 },
-  { "msp430f47166",1,4 },
-  { "msp430f47167",1,4 },
-  { "msp430f47173",1,4 },
-  { "msp430f47176",1,4 },
-  { "msp430f47177",1,4 },
-  { "msp430f47183",1,4 },
-  { "msp430f47186",1,4 },
-  { "msp430f47187",1,4 },
-  { "msp430f47193",1,4 },
-  { "msp430f47196",1,4 },
-  { "msp430f47197",1,4 },
-  { "msp430f477",0,0 },
-  { "msp430f478",0,0 },
-  { "msp430f4783",0,4 },
-  { "msp430f4784",0,4 },
-  { "msp430f479",0,0 },
-  { "msp430f4793",0,4 },
-  { "msp430f4794",0,4 },
-  { "msp430f5131",2,8 },
-  { "msp430f5132",2,8 },
-  { "msp430f5151",2,8 },
-  { "msp430f5152",2,8 },
-  { "msp430f5171",2,8 },
-  { "msp430f5172",2,8 },
-  { "msp430f5212",2,8 },
-  { "msp430f5213",2,8 },
-  { "msp430f5214",2,8 },
-  { "msp430f5217",2,8 },
-  { "msp430f5218",2,8 },
-  { "msp430f5219",2,8 },
-  { "msp430f5222",2,8 },
-  { "msp430f5223",2,8 },
-  { "msp430f5224",2,8 },
-  { "msp430f5227",2,8 },
-  { "msp430f5228",2,8 },
-  { "msp430f5229",2,8 },
-  { "msp430f5232",2,8 },
-  { "msp430f5234",2,8 },
-  { "msp430f5237",2,8 },
-  { "msp430f5239",2,8 },
-  { "msp430f5242",2,8 },
-  { "msp430f5244",2,8 },
-  { "msp430f5247",2,8 },
-  { "msp430f5249",2,8 },
-  { "msp430f5252",2,8 },
-  { "msp430f5253",2,8 },
-  { "msp430f5254",2,8 },
-  { "msp430f5255",2,8 },
-  { "msp430f5256",2,8 },
-  { "msp430f5257",2,8 },
-  { "msp430f5258",2,8 },
-  { "msp430f5259",2,8 },
-  { "msp430f5304",2,8 },
-  { "msp430f5308",2,8 },
-  { "msp430f5309",2,8 },
-  { "msp430f5310",2,8 },
-  { "msp430f5324",2,8 },
-  { "msp430f5325",2,8 },
-  { "msp430f5326",2,8 },
-  { "msp430f5327",2,8 },
-  { "msp430f5328",2,8 },
-  { "msp430f5329",2,8 },
-  { "msp430f5333",2,8 },
-  { "msp430f5335",2,8 },
-  { "msp430f5336",2,8 },
-  { "msp430f5338",2,8 },
-  { "msp430f5340",2,8 },
-  { "msp430f5341",2,8 },
-  { "msp430f5342",2,8 },
-  { "msp430f5358",2,8 },
-  { "msp430f5359",2,8 },
-  { "msp430f5418",2,8 },
-  { "msp430f5418a",2,8 },
-  { "msp430f5419",2,8 },
-  { "msp430f5419a",2,8 },
-  { "msp430f5435",2,8 },
-  { "msp430f5435a",2,8 },
-  { "msp430f5436",2,8 },
-  { "msp430f5436a",2,8 },
-  { "msp430f5437",2,8 },
-  { "msp430f5437a",2,8 },
-  { "msp430f5438",2,8 },
-  { "msp430f5438a",2,8 },
-  { "msp430f5500",2,8 },
-  { "msp430f5501",2,8 },
-  { "msp430f5502",2,8 },
-  { "msp430f5503",2,8 },
-  { "msp430f5504",2,8 },
-  { "msp430f5505",2,8 },
-  { "msp430f5506",2,8 },
-  { "msp430f5507",2,8 },
-  { "msp430f5508",2,8 },
-  { "msp430f5509",2,8 },
-  { "msp430f5510",2,8 },
-  { "msp430f5513",2,8 },
-  { "msp430f5514",2,8 },
-  { "msp430f5515",2,8 },
-  { "msp430f5517",2,8 },
-  { "msp430f5519",2,8 },
-  { "msp430f5521",2,8 },
-  { "msp430f5522",2,8 },
-  { "msp430f5524",2,8 },
-  { "msp430f5525",2,8 },
-  { "msp430f5526",2,8 },
-  { "msp430f5527",2,8 },
-  { "msp430f5528",2,8 },
-  { "msp430f5529",2,8 },
-  { "msp430f5630",2,8 },
-  { "msp430f5631",2,8 },
-  { "msp430f5632",2,8 },
-  { "msp430f5633",2,8 },
-  { "msp430f5634",2,8 },
-  { "msp430f5635",2,8 },
-  { "msp430f5636",2,8 },
-  { "msp430f5637",2,8 },
-  { "msp430f5638",2,8 },
-  { "msp430f5658",2,8 },
-  { "msp430f5659",2,8 },
-  { "msp430f5xx_6xxgeneric",2,8 },
-  { "msp430f6433",2,8 },
-  { "msp430f6435",2,8 },
-  { "msp430f6436",2,8 },
-  { "msp430f6438",2,8 },
-  { "msp430f6458",2,8 },
-  { "msp430f6459",2,8 },
-  { "msp430f6630",2,8 },
-  { "msp430f6631",2,8 },
-  { "msp430f6632",2,8 },
-  { "msp430f6633",2,8 },
-  { "msp430f6634",2,8 },
-  { "msp430f6635",2,8 },
-  { "msp430f6636",2,8 },
-  { "msp430f6637",2,8 },
-  { "msp430f6638",2,8 },
-  { "msp430f6658",2,8 },
-  { "msp430f6659",2,8 },
-  { "msp430f6720",2,8 },
-  { "msp430f6720a",2,8 },
-  { "msp430f6721",2,8 },
-  { "msp430f6721a",2,8 },
-  { "msp430f6723",2,8 },
-  { "msp430f6723a",2,8 },
-  { "msp430f6724",2,8 },
-  { "msp430f6724a",2,8 },
-  { "msp430f6725",2,8 },
-  { "msp430f6725a",2,8 },
-  { "msp430f6726",2,8 },
-  { "msp430f6726a",2,8 },
-  { "msp430f6730",2,8 },
-  { "msp430f6730a",2,8 },
-  { "msp430f6731",2,8 },
-  { "msp430f6731a",2,8 },
-  { "msp430f6733",2,8 },
-  { "msp430f6733a",2,8 },
-  { "msp430f6734",2,8 },
-  { "msp430f6734a",2,8 },
-  { "msp430f6735",2,8 },
-  { "msp430f6735a",2,8 },
-  { "msp430f6736",2,8 },
-  { "msp430f6736a",2,8 },
-  { "msp430f6745",2,8 },
-  { "msp430f67451",2,8 },
-  { "msp430f67451a",2,8 },
-  { "msp430f6745a",2,8 },
-  { "msp430f6746",2,8 },
-  { "msp430f67461",2,8 },
-  { "msp430f67461a",2,8 },
-  { "msp430f6746a",2,8 },
-  { "msp430f6747",2,8 },
-  { "msp430f67471",2,8 },
-  { "msp430f67471a",2,8 },
-  { "msp430f6747a",2,8 },
-  { "msp430f6748",2,8 },
-  { "msp430f67481",2,8 },
-  { "msp430f67481a",2,8 },
-  { "msp430f6748a",2,8 },
-  { "msp430f6749",2,8 },
-  { "msp430f67491",2,8 },
-  { "msp430f67491a",2,8 },
-  { "msp430f6749a",2,8 },
-  { "msp430f67621",2,8 },
-  { "msp430f67621a",2,8 },
-  { "msp430f67641",2,8 },
-  { "msp430f67641a",2,8 },
-  { "msp430f6765",2,8 },
-  { "msp430f67651",2,8 },
-  { "msp430f67651a",2,8 },
-  { "msp430f6765a",2,8 },
-  { "msp430f6766",2,8 },
-  { "msp430f67661",2,8 },
-  { "msp430f67661a",2,8 },
-  { "msp430f6766a",2,8 },
-  { "msp430f6767",2,8 },
-  { "msp430f67671",2,8 },
-  { "msp430f67671a",2,8 },
-  { "msp430f6767a",2,8 },
-  { "msp430f6768",2,8 },
-  { "msp430f67681",2,8 },
-  { "msp430f67681a",2,8 },
-  { "msp430f6768a",2,8 },
-  { "msp430f6769",2,8 },
-  { "msp430f67691",2,8 },
-  { "msp430f67691a",2,8 },
-  { "msp430f6769a",2,8 },
-  { "msp430f6775",2,8 },
-  { "msp430f67751",2,8 },
-  { "msp430f67751a",2,8 },
-  { "msp430f6775a",2,8 },
-  { "msp430f6776",2,8 },
-  { "msp430f67761",2,8 },
-  { "msp430f67761a",2,8 },
-  { "msp430f6776a",2,8 },
-  { "msp430f6777",2,8 },
-  { "msp430f67771",2,8 },
-  { "msp430f67771a",2,8 },
-  { "msp430f6777a",2,8 },
-  { "msp430f6778",2,8 },
-  { "msp430f67781",2,8 },
-  { "msp430f67781a",2,8 },
-  { "msp430f6778a",2,8 },
-  { "msp430f6779",2,8 },
-  { "msp430f67791",2,8 },
-  { "msp430f67791a",2,8 },
-  { "msp430f6779a",2,8 },
-  { "msp430fe423",0,0 },
-  { "msp430fe4232",0,0 },
-  { "msp430fe423a",0,0 },
-  { "msp430fe4242",0,0 },
-  { "msp430fe425",0,0 },
-  { "msp430fe4252",0,0 },
-  { "msp430fe425a",0,0 },
-  { "msp430fe427",0,0 },
-  { "msp430fe4272",0,0 },
-  { "msp430fe427a",0,0 },
-  { "msp430fg4250",0,0 },
-  { "msp430fg4260",0,0 },
-  { "msp430fg4270",0,0 },
-  { "msp430fg437",0,0 },
-  { "msp430fg438",0,0 },
-  { "msp430fg439",0,0 },
-  { "msp430fg4616",1,1 },
-  { "msp430fg4617",1,1 },
-  { "msp430fg4618",1,1 },
-  { "msp430fg4619",1,1 },
-  { "msp430fg477",0,0 },
-  { "msp430fg478",0,0 },
-  { "msp430fg479",0,0 },
-  { "msp430fg6425",2,8 },
-  { "msp430fg6426",2,8 },
-  { "msp430fg6625",2,8 },
-  { "msp430fg6626",2,8 },
-  { "msp430fr2032",2,0 },
-  { "msp430fr2033",2,0 },
-  { "msp430fr2110",2,0 },
-  { "msp430fr2111",2,0 },
-  { "msp430fr2310",2,0 },
-  { "msp430fr2311",2,0 },
-  { "msp430fr2433",2,8 },
-  { "msp430fr2532",2,8 },
-  { "msp430fr2533",2,8 },
-  { "msp430fr2632",2,8 },
-  { "msp430fr2633",2,8 },
-  { "msp430fr2xx_4xxgeneric",2,8 },
-  { "msp430fr4131",2,0 },
-  { "msp430fr4132",2,0 },
-  { "msp430fr4133",2,0 },
-  { "msp430fr5720",2,8 },
-  { "msp430fr5721",2,8 },
-  { "msp430fr5722",2,8 },
-  { "msp430fr5723",2,8 },
-  { "msp430fr5724",2,8 },
-  { "msp430fr5725",2,8 },
-  { "msp430fr5726",2,8 },
-  { "msp430fr5727",2,8 },
-  { "msp430fr5728",2,8 },
-  { "msp430fr5729",2,8 },
-  { "msp430fr5730",2,8 },
-  { "msp430fr5731",2,8 },
-  { "msp430fr5732",2,8 },
-  { "msp430fr5733",2,8 },
-  { "msp430fr5734",2,8 },
-  { "msp430fr5735",2,8 },
-  { "msp430fr5736",2,8 },
-  { "msp430fr5737",2,8 },
-  { "msp430fr5738",2,8 },
-  { "msp430fr5739",2,8 },
-  { "msp430fr57xxgeneric",2,8 },
-  { "msp430fr5847",2,8 },
-  { "msp430fr58471",2,8 },
-  { "msp430fr5848",2,8 },
-  { "msp430fr5849",2,8 },
-  { "msp430fr5857",2,8 },
-  { "msp430fr5858",2,8 },
-  { "msp430fr5859",2,8 },
-  { "msp430fr5867",2,8 },
-  { "msp430fr58671",2,8 },
-  { "msp430fr5868",2,8 },
-  { "msp430fr5869",2,8 },
-  { "msp430fr5870",2,8 },
-  { "msp430fr5872",2,8 },
-  { "msp430fr58721",2,8 },
-  { "msp430fr5887",2,8 },
-  { "msp430fr5888",2,8 },
-  { "msp430fr5889",2,8 },
-  { "msp430fr58891",2,8 },
-  { "msp430fr5922",2,8 },
-  { "msp430fr59221",2,8 },
-  { "msp430fr5947",2,8 },
-  { "msp430fr59471",2,8 },
-  { "msp430fr5948",2,8 },
-  { "msp430fr5949",2,8 },
-  { "msp430fr5957",2,8 },
-  { "msp430fr5958",2,8 },
-  { "msp430fr5959",2,8 },
-  { "msp430fr5962",2,8 },
-  { "msp430fr5964",2,8 },
-  { "msp430fr5967",2,8 },
-  { "msp430fr5968",2,8 },
-  { "msp430fr5969",2,8 },
-  { "msp430fr59691",2,8 },
-  { "msp430fr5970",2,8 },
-  { "msp430fr5972",2,8 },
-  { "msp430fr59721",2,8 },
-  { "msp430fr5986",2,8 },
-  { "msp430fr5987",2,8 },
-  { "msp430fr5988",2,8 },
-  { "msp430fr5989",2,8 },
-  { "msp430fr59891",2,8 },
-  { "msp430fr5992",2,8 },
-  { "msp430fr5994",2,8 },
-  { "msp430fr59941",2,8 },
-  { "msp430fr5xx_6xxgeneric",2,8 },
-  { "msp430fr6820",2,8 },
-  { "msp430fr6822",2,8 },
-  { "msp430fr68221",2,8 },
-  { "msp430fr6870",2,8 },
-  { "msp430fr6872",2,8 },
-  { "msp430fr68721",2,8 },
-  { "msp430fr6877",2,8 },
-  { "msp430fr6879",2,8 },
-  { "msp430fr68791",2,8 },
-  { "msp430fr6887",2,8 },
-  { "msp430fr6888",2,8 },
-  { "msp430fr6889",2,8 },
-  { "msp430fr68891",2,8 },
-  { "msp430fr6920",2,8 },
-  { "msp430fr6922",2,8 },
-  { "msp430fr69221",2,8 },
-  { "msp430fr6927",2,8 },
-  { "msp430fr69271",2,8 },
-  { "msp430fr6928",2,8 },
-  { "msp430fr6970",2,8 },
-  { "msp430fr6972",2,8 },
-  { "msp430fr69721",2,8 },
-  { "msp430fr6977",2,8 },
-  { "msp430fr6979",2,8 },
-  { "msp430fr69791",2,8 },
-  { "msp430fr6987",2,8 },
-  { "msp430fr6988",2,8 },
-  { "msp430fr6989",2,8 },
-  { "msp430fr69891",2,8 },
-  { "msp430fw423",0,0 },
-  { "msp430fw425",0,0 },
-  { "msp430fw427",0,0 },
-  { "msp430fw428",0,0 },
-  { "msp430fw429",0,0 },
-  { "msp430g2001",0,0 },
-  { "msp430g2101",0,0 },
-  { "msp430g2102",0,0 },
-  { "msp430g2111",0,0 },
-  { "msp430g2112",0,0 },
-  { "msp430g2113",0,0 },
-  { "msp430g2121",0,0 },
-  { "msp430g2131",0,0 },
-  { "msp430g2132",0,0 },
-  { "msp430g2152",0,0 },
-  { "msp430g2153",0,0 },
-  { "msp430g2201",0,0 },
-  { "msp430g2202",0,0 },
-  { "msp430g2203",0,0 },
-  { "msp430g2210",0,0 },
-  { "msp430g2211",0,0 },
-  { "msp430g2212",0,0 },
-  { "msp430g2213",0,0 },
-  { "msp430g2221",0,0 },
-  { "msp430g2230",0,0 },
-  { "msp430g2231",0,0 },
-  { "msp430g2232",0,0 },
-  { "msp430g2233",0,0 },
-  { "msp430g2252",0,0 },
-  { "msp430g2253",0,0 },
-  { "msp430g2302",0,0 },
-  { "msp430g2303",0,0 },
-  { "msp430g2312",0,0 },
-  { "msp430g2313",0,0 },
-  { "msp430g2332",0,0 },
-  { "msp430g2333",0,0 },
-  { "msp430g2352",0,0 },
-  { "msp430g2353",0,0 },
-  { "msp430g2402",0,0 },
-  { "msp430g2403",0,0 },
-  { "msp430g2412",0,0 },
-  { "msp430g2413",0,0 },
-  { "msp430g2432",0,0 },
-  { "msp430g2433",0,0 },
-  { "msp430g2444",0,0 },
-  { "msp430g2452",0,0 },
-  { "msp430g2453",0,0 },
-  { "msp430g2513",0,0 },
-  { "msp430g2533",0,0 },
-  { "msp430g2544",0,0 },
-  { "msp430g2553",0,0 },
-  { "msp430g2744",0,0 },
-  { "msp430g2755",0,0 },
-  { "msp430g2855",0,0 },
-  { "msp430g2955",0,0 },
-  { "msp430i2020",0,2 },
-  { "msp430i2021",0,2 },
-  { "msp430i2030",0,2 },
-  { "msp430i2031",0,2 },
-  { "msp430i2040",0,2 },
-  { "msp430i2041",0,2 },
-  { "msp430i2xxgeneric",0,2 },
-  { "msp430l092",0,0 },
-  { "msp430p112",0,0 },
-  { "msp430p313",0,0 },
-  { "msp430p315",0,0 },
-  { "msp430p315s",0,0 },
-  { "msp430p325",0,0 },
-  { "msp430p337",0,1 },
-  { "msp430sl5438a",2,8 },
-  { "msp430tch5e",0,0 },
-  { "msp430xgeneric",2,8 },
-  { "rf430f5144",2,8 },
-  { "rf430f5155",2,8 },
-  { "rf430f5175",2,8 },
-  { "rf430frl152h",0,0 },
-  { "rf430frl152h_rom",0,0 },
-  { "rf430frl153h",0,0 },
-  { "rf430frl153h_rom",0,0 },
-  { "rf430frl154h",0,0 },
-  { "rf430frl154h_rom",0,0 }
-};  
 
 /* Implement spec function `msp430_hwmult_lib´.  */
 
@@ -688,10 +95,10 @@ msp430_select_hwmult_lib (int argc ATTRIBUTE_UNUSED, const char ** argv ATTRIBUT
       }
     else if (strcasecmp (argv[0], "mcu") == 0)
       {
-	for (i = ARRAY_SIZE (msp430_mcu_data); i--;)
-	  if (strcasecmp (argv[argc - 1], msp430_mcu_data[i].name) == 0)
+	msp430_extract_mcu_data (argv[argc - 1]);
+	if (extracted_mcu_data.name != NULL)
 	    {
-	      switch (msp430_mcu_data[i].hwmpy)
+	      switch (extracted_mcu_data.hwmpy)
 		{
 		case 0: return "-lmul_none";
 		case 2:
@@ -699,8 +106,9 @@ msp430_select_hwmult_lib (int argc ATTRIBUTE_UNUSED, const char ** argv ATTRIBUT
 		case 4: return "-lmul_32";
 		case 8: return "-lmul_f5";
 		default:
-		  error ("unrecognized hwpy field in msp430_mcu_data[%d]: %d",
-			 i, msp430_mcu_data[i].hwmpy);
+			/* We have already checked the hwmpy values for
+			   validity in msp430_extract_mcu_data.  */
+			gcc_unreachable ();
 		  break;
 		}
 	    }
diff --git a/gcc/config/msp430/msp430-devices.c b/gcc/config/msp430/msp430-devices.c
new file mode 100644
index 00000000000..c5faff80487
--- /dev/null
+++ b/gcc/config/msp430/msp430-devices.c
@@ -0,0 +1,697 @@
+/* Subroutines used for reading MCU data on TI MSP430 processors.
+   Copyright (C) 2019 Free Software Foundation, Inc.
+   Contributed by Jozef Lawrynowicz  <jozef.l@mittosystems.com>.
+
+   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 "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "backend.h"
+#include "target.h"
+#include "tree.h"
+#include "memmodel.h"
+#include "diagnostic-core.h"
+#include "langhooks.h"
+#include "builtins.h"
+#include "intl.h"
+#include "msp430-devices.h"
+
+struct t_msp430_mcu_data extracted_mcu_data;
+/* Initialized at the bottom of this file.  */
+extern struct t_msp430_mcu_data hard_msp430_mcu_data[605];
+
+/* Main entry point to load the MCU data for the given -mmcu into
+   extracted_mcu_data.  hard_msp430_mcu_data (initialized at the bottom of this
+   file) is searched for the MCU name.
+   This function only needs to be executed once, but it can be first called
+   from a number of different locations.  */
+void
+msp430_extract_mcu_data (const char * mcu_name)
+{
+  static int executed = 0;
+  int i;
+  if (mcu_name == NULL || executed == 1)
+    return;
+  executed = 1;
+  /* FIXME: This array is alpha sorted - we could use a binary search.  */
+  for (i = ARRAY_SIZE (hard_msp430_mcu_data); i--;)
+    if (strcasecmp (mcu_name, hard_msp430_mcu_data[i].name) == 0)
+      {
+	extracted_mcu_data = hard_msp430_mcu_data[i];
+	break;
+      }
+  /* Validation checks.  */
+  if (extracted_mcu_data.name != NULL)
+    {
+      switch (extracted_mcu_data.hwmpy)
+	{
+	case 0:
+	case 1:
+	case 2:
+	case 4:
+	case 8: break;
+	default:
+		error ("unrecognized %<hwmpy%> field in "
+		       "%<hard_msp430_mcu_data[%d]%>: %qd", i,
+		       hard_msp430_mcu_data[i].hwmpy);
+		break;
+	}
+      switch (extracted_mcu_data.revision)
+	{
+	case 0:
+	case 1:
+	case 2: break;
+	default:
+		error ("unrecognized %<revision%> field in "
+		       "%<hard_msp430_mcu_data[%d]%>: %qd", i,
+		       hard_msp430_mcu_data[i].revision);
+	}
+    }
+}
+
+/* The data in this structure has been extracted from version 1.194 of the
+   devices.csv file released by TI in September 2016.  */
+
+struct t_msp430_mcu_data hard_msp430_mcu_data[605] =
+{
+  { "cc430f5123",2,8 },
+  { "cc430f5125",2,8 },
+  { "cc430f5133",2,8 },
+  { "cc430f5135",2,8 },
+  { "cc430f5137",2,8 },
+  { "cc430f5143",2,8 },
+  { "cc430f5145",2,8 },
+  { "cc430f5147",2,8 },
+  { "cc430f6125",2,8 },
+  { "cc430f6126",2,8 },
+  { "cc430f6127",2,8 },
+  { "cc430f6135",2,8 },
+  { "cc430f6137",2,8 },
+  { "cc430f6143",2,8 },
+  { "cc430f6145",2,8 },
+  { "cc430f6147",2,8 },
+  { "msp430afe221",0,2 },
+  { "msp430afe222",0,2 },
+  { "msp430afe223",0,2 },
+  { "msp430afe231",0,2 },
+  { "msp430afe232",0,2 },
+  { "msp430afe233",0,2 },
+  { "msp430afe251",0,2 },
+  { "msp430afe252",0,2 },
+  { "msp430afe253",0,2 },
+  { "msp430bt5190",2,8 },
+  { "msp430c091",0,0 },
+  { "msp430c092",0,0 },
+  { "msp430c111",0,0 },
+  { "msp430c1111",0,0 },
+  { "msp430c112",0,0 },
+  { "msp430c1121",0,0 },
+  { "msp430c1331",0,0 },
+  { "msp430c1351",0,0 },
+  { "msp430c311s",0,0 },
+  { "msp430c312",0,0 },
+  { "msp430c313",0,0 },
+  { "msp430c314",0,0 },
+  { "msp430c315",0,0 },
+  { "msp430c323",0,0 },
+  { "msp430c325",0,0 },
+  { "msp430c336",0,1 },
+  { "msp430c337",0,1 },
+  { "msp430c412",0,0 },
+  { "msp430c413",0,0 },
+  { "msp430cg4616",1,1 },
+  { "msp430cg4617",1,1 },
+  { "msp430cg4618",1,1 },
+  { "msp430cg4619",1,1 },
+  { "msp430e112",0,0 },
+  { "msp430e313",0,0 },
+  { "msp430e315",0,0 },
+  { "msp430e325",0,0 },
+  { "msp430e337",0,1 },
+  { "msp430f110",0,0 },
+  { "msp430f1101",0,0 },
+  { "msp430f1101a",0,0 },
+  { "msp430f1111",0,0 },
+  { "msp430f1111a",0,0 },
+  { "msp430f112",0,0 },
+  { "msp430f1121",0,0 },
+  { "msp430f1121a",0,0 },
+  { "msp430f1122",0,0 },
+  { "msp430f1132",0,0 },
+  { "msp430f122",0,0 },
+  { "msp430f1222",0,0 },
+  { "msp430f123",0,0 },
+  { "msp430f1232",0,0 },
+  { "msp430f133",0,0 },
+  { "msp430f135",0,0 },
+  { "msp430f147",0,1 },
+  { "msp430f1471",0,1 },
+  { "msp430f148",0,1 },
+  { "msp430f1481",0,1 },
+  { "msp430f149",0,1 },
+  { "msp430f1491",0,1 },
+  { "msp430f155",0,0 },
+  { "msp430f156",0,0 },
+  { "msp430f157",0,0 },
+  { "msp430f1610",0,1 },
+  { "msp430f1611",0,1 },
+  { "msp430f1612",0,1 },
+  { "msp430f167",0,1 },
+  { "msp430f168",0,1 },
+  { "msp430f169",0,1 },
+  { "msp430f2001",0,0 },
+  { "msp430f2002",0,0 },
+  { "msp430f2003",0,0 },
+  { "msp430f2011",0,0 },
+  { "msp430f2012",0,0 },
+  { "msp430f2013",0,0 },
+  { "msp430f2101",0,0 },
+  { "msp430f2111",0,0 },
+  { "msp430f2112",0,0 },
+  { "msp430f2121",0,0 },
+  { "msp430f2122",0,0 },
+  { "msp430f2131",0,0 },
+  { "msp430f2132",0,0 },
+  { "msp430f2232",0,0 },
+  { "msp430f2234",0,0 },
+  { "msp430f2252",0,0 },
+  { "msp430f2254",0,0 },
+  { "msp430f2272",0,0 },
+  { "msp430f2274",0,0 },
+  { "msp430f233",0,2 },
+  { "msp430f2330",0,2 },
+  { "msp430f235",0,2 },
+  { "msp430f2350",0,2 },
+  { "msp430f2370",0,2 },
+  { "msp430f2410",0,2 },
+  { "msp430f2416",1,2 },
+  { "msp430f2417",1,2 },
+  { "msp430f2418",1,2 },
+  { "msp430f2419",1,2 },
+  { "msp430f247",0,2 },
+  { "msp430f2471",0,2 },
+  { "msp430f248",0,2 },
+  { "msp430f2481",0,2 },
+  { "msp430f249",0,2 },
+  { "msp430f2491",0,2 },
+  { "msp430f2616",1,2 },
+  { "msp430f2617",1,2 },
+  { "msp430f2618",1,2 },
+  { "msp430f2619",1,2 },
+  { "msp430f412",0,0 },
+  { "msp430f413",0,0 },
+  { "msp430f4132",0,0 },
+  { "msp430f415",0,0 },
+  { "msp430f4152",0,0 },
+  { "msp430f417",0,0 },
+  { "msp430f423",0,1 },
+  { "msp430f423a",0,1 },
+  { "msp430f425",0,1 },
+  { "msp430f4250",0,0 },
+  { "msp430f425a",0,1 },
+  { "msp430f4260",0,0 },
+  { "msp430f427",0,1 },
+  { "msp430f4270",0,0 },
+  { "msp430f427a",0,1 },
+  { "msp430f435",0,0 },
+  { "msp430f4351",0,0 },
+  { "msp430f436",0,0 },
+  { "msp430f4361",0,0 },
+  { "msp430f437",0,0 },
+  { "msp430f4371",0,0 },
+  { "msp430f438",0,0 },
+  { "msp430f439",0,0 },
+  { "msp430f447",0,1 },
+  { "msp430f448",0,1 },
+  { "msp430f4481",0,1 },
+  { "msp430f449",0,1 },
+  { "msp430f4491",0,1 },
+  { "msp430f4616",1,1 },
+  { "msp430f46161",1,1 },
+  { "msp430f4617",1,1 },
+  { "msp430f46171",1,1 },
+  { "msp430f4618",1,1 },
+  { "msp430f46181",1,1 },
+  { "msp430f4619",1,1 },
+  { "msp430f46191",1,1 },
+  { "msp430f47126",1,4 },
+  { "msp430f47127",1,4 },
+  { "msp430f47163",1,4 },
+  { "msp430f47166",1,4 },
+  { "msp430f47167",1,4 },
+  { "msp430f47173",1,4 },
+  { "msp430f47176",1,4 },
+  { "msp430f47177",1,4 },
+  { "msp430f47183",1,4 },
+  { "msp430f47186",1,4 },
+  { "msp430f47187",1,4 },
+  { "msp430f47193",1,4 },
+  { "msp430f47196",1,4 },
+  { "msp430f47197",1,4 },
+  { "msp430f477",0,0 },
+  { "msp430f478",0,0 },
+  { "msp430f4783",0,4 },
+  { "msp430f4784",0,4 },
+  { "msp430f479",0,0 },
+  { "msp430f4793",0,4 },
+  { "msp430f4794",0,4 },
+  { "msp430f5131",2,8 },
+  { "msp430f5132",2,8 },
+  { "msp430f5151",2,8 },
+  { "msp430f5152",2,8 },
+  { "msp430f5171",2,8 },
+  { "msp430f5172",2,8 },
+  { "msp430f5212",2,8 },
+  { "msp430f5213",2,8 },
+  { "msp430f5214",2,8 },
+  { "msp430f5217",2,8 },
+  { "msp430f5218",2,8 },
+  { "msp430f5219",2,8 },
+  { "msp430f5222",2,8 },
+  { "msp430f5223",2,8 },
+  { "msp430f5224",2,8 },
+  { "msp430f5227",2,8 },
+  { "msp430f5228",2,8 },
+  { "msp430f5229",2,8 },
+  { "msp430f5232",2,8 },
+  { "msp430f5234",2,8 },
+  { "msp430f5237",2,8 },
+  { "msp430f5239",2,8 },
+  { "msp430f5242",2,8 },
+  { "msp430f5244",2,8 },
+  { "msp430f5247",2,8 },
+  { "msp430f5249",2,8 },
+  { "msp430f5252",2,8 },
+  { "msp430f5253",2,8 },
+  { "msp430f5254",2,8 },
+  { "msp430f5255",2,8 },
+  { "msp430f5256",2,8 },
+  { "msp430f5257",2,8 },
+  { "msp430f5258",2,8 },
+  { "msp430f5259",2,8 },
+  { "msp430f5304",2,8 },
+  { "msp430f5308",2,8 },
+  { "msp430f5309",2,8 },
+  { "msp430f5310",2,8 },
+  { "msp430f5324",2,8 },
+  { "msp430f5325",2,8 },
+  { "msp430f5326",2,8 },
+  { "msp430f5327",2,8 },
+  { "msp430f5328",2,8 },
+  { "msp430f5329",2,8 },
+  { "msp430f5333",2,8 },
+  { "msp430f5335",2,8 },
+  { "msp430f5336",2,8 },
+  { "msp430f5338",2,8 },
+  { "msp430f5340",2,8 },
+  { "msp430f5341",2,8 },
+  { "msp430f5342",2,8 },
+  { "msp430f5358",2,8 },
+  { "msp430f5359",2,8 },
+  { "msp430f5418",2,8 },
+  { "msp430f5418a",2,8 },
+  { "msp430f5419",2,8 },
+  { "msp430f5419a",2,8 },
+  { "msp430f5435",2,8 },
+  { "msp430f5435a",2,8 },
+  { "msp430f5436",2,8 },
+  { "msp430f5436a",2,8 },
+  { "msp430f5437",2,8 },
+  { "msp430f5437a",2,8 },
+  { "msp430f5438",2,8 },
+  { "msp430f5438a",2,8 },
+  { "msp430f5500",2,8 },
+  { "msp430f5501",2,8 },
+  { "msp430f5502",2,8 },
+  { "msp430f5503",2,8 },
+  { "msp430f5504",2,8 },
+  { "msp430f5505",2,8 },
+  { "msp430f5506",2,8 },
+  { "msp430f5507",2,8 },
+  { "msp430f5508",2,8 },
+  { "msp430f5509",2,8 },
+  { "msp430f5510",2,8 },
+  { "msp430f5513",2,8 },
+  { "msp430f5514",2,8 },
+  { "msp430f5515",2,8 },
+  { "msp430f5517",2,8 },
+  { "msp430f5519",2,8 },
+  { "msp430f5521",2,8 },
+  { "msp430f5522",2,8 },
+  { "msp430f5524",2,8 },
+  { "msp430f5525",2,8 },
+  { "msp430f5526",2,8 },
+  { "msp430f5527",2,8 },
+  { "msp430f5528",2,8 },
+  { "msp430f5529",2,8 },
+  { "msp430f5630",2,8 },
+  { "msp430f5631",2,8 },
+  { "msp430f5632",2,8 },
+  { "msp430f5633",2,8 },
+  { "msp430f5634",2,8 },
+  { "msp430f5635",2,8 },
+  { "msp430f5636",2,8 },
+  { "msp430f5637",2,8 },
+  { "msp430f5638",2,8 },
+  { "msp430f5658",2,8 },
+  { "msp430f5659",2,8 },
+  { "msp430f5xx_6xxgeneric",2,8 },
+  { "msp430f6433",2,8 },
+  { "msp430f6435",2,8 },
+  { "msp430f6436",2,8 },
+  { "msp430f6438",2,8 },
+  { "msp430f6458",2,8 },
+  { "msp430f6459",2,8 },
+  { "msp430f6630",2,8 },
+  { "msp430f6631",2,8 },
+  { "msp430f6632",2,8 },
+  { "msp430f6633",2,8 },
+  { "msp430f6634",2,8 },
+  { "msp430f6635",2,8 },
+  { "msp430f6636",2,8 },
+  { "msp430f6637",2,8 },
+  { "msp430f6638",2,8 },
+  { "msp430f6658",2,8 },
+  { "msp430f6659",2,8 },
+  { "msp430f6720",2,8 },
+  { "msp430f6720a",2,8 },
+  { "msp430f6721",2,8 },
+  { "msp430f6721a",2,8 },
+  { "msp430f6723",2,8 },
+  { "msp430f6723a",2,8 },
+  { "msp430f6724",2,8 },
+  { "msp430f6724a",2,8 },
+  { "msp430f6725",2,8 },
+  { "msp430f6725a",2,8 },
+  { "msp430f6726",2,8 },
+  { "msp430f6726a",2,8 },
+  { "msp430f6730",2,8 },
+  { "msp430f6730a",2,8 },
+  { "msp430f6731",2,8 },
+  { "msp430f6731a",2,8 },
+  { "msp430f6733",2,8 },
+  { "msp430f6733a",2,8 },
+  { "msp430f6734",2,8 },
+  { "msp430f6734a",2,8 },
+  { "msp430f6735",2,8 },
+  { "msp430f6735a",2,8 },
+  { "msp430f6736",2,8 },
+  { "msp430f6736a",2,8 },
+  { "msp430f6745",2,8 },
+  { "msp430f67451",2,8 },
+  { "msp430f67451a",2,8 },
+  { "msp430f6745a",2,8 },
+  { "msp430f6746",2,8 },
+  { "msp430f67461",2,8 },
+  { "msp430f67461a",2,8 },
+  { "msp430f6746a",2,8 },
+  { "msp430f6747",2,8 },
+  { "msp430f67471",2,8 },
+  { "msp430f67471a",2,8 },
+  { "msp430f6747a",2,8 },
+  { "msp430f6748",2,8 },
+  { "msp430f67481",2,8 },
+  { "msp430f67481a",2,8 },
+  { "msp430f6748a",2,8 },
+  { "msp430f6749",2,8 },
+  { "msp430f67491",2,8 },
+  { "msp430f67491a",2,8 },
+  { "msp430f6749a",2,8 },
+  { "msp430f67621",2,8 },
+  { "msp430f67621a",2,8 },
+  { "msp430f67641",2,8 },
+  { "msp430f67641a",2,8 },
+  { "msp430f6765",2,8 },
+  { "msp430f67651",2,8 },
+  { "msp430f67651a",2,8 },
+  { "msp430f6765a",2,8 },
+  { "msp430f6766",2,8 },
+  { "msp430f67661",2,8 },
+  { "msp430f67661a",2,8 },
+  { "msp430f6766a",2,8 },
+  { "msp430f6767",2,8 },
+  { "msp430f67671",2,8 },
+  { "msp430f67671a",2,8 },
+  { "msp430f6767a",2,8 },
+  { "msp430f6768",2,8 },
+  { "msp430f67681",2,8 },
+  { "msp430f67681a",2,8 },
+  { "msp430f6768a",2,8 },
+  { "msp430f6769",2,8 },
+  { "msp430f67691",2,8 },
+  { "msp430f67691a",2,8 },
+  { "msp430f6769a",2,8 },
+  { "msp430f6775",2,8 },
+  { "msp430f67751",2,8 },
+  { "msp430f67751a",2,8 },
+  { "msp430f6775a",2,8 },
+  { "msp430f6776",2,8 },
+  { "msp430f67761",2,8 },
+  { "msp430f67761a",2,8 },
+  { "msp430f6776a",2,8 },
+  { "msp430f6777",2,8 },
+  { "msp430f67771",2,8 },
+  { "msp430f67771a",2,8 },
+  { "msp430f6777a",2,8 },
+  { "msp430f6778",2,8 },
+  { "msp430f67781",2,8 },
+  { "msp430f67781a",2,8 },
+  { "msp430f6778a",2,8 },
+  { "msp430f6779",2,8 },
+  { "msp430f67791",2,8 },
+  { "msp430f67791a",2,8 },
+  { "msp430f6779a",2,8 },
+  { "msp430fe423",0,0 },
+  { "msp430fe4232",0,0 },
+  { "msp430fe423a",0,0 },
+  { "msp430fe4242",0,0 },
+  { "msp430fe425",0,0 },
+  { "msp430fe4252",0,0 },
+  { "msp430fe425a",0,0 },
+  { "msp430fe427",0,0 },
+  { "msp430fe4272",0,0 },
+  { "msp430fe427a",0,0 },
+  { "msp430fg4250",0,0 },
+  { "msp430fg4260",0,0 },
+  { "msp430fg4270",0,0 },
+  { "msp430fg437",0,0 },
+  { "msp430fg438",0,0 },
+  { "msp430fg439",0,0 },
+  { "msp430fg4616",1,1 },
+  { "msp430fg4617",1,1 },
+  { "msp430fg4618",1,1 },
+  { "msp430fg4619",1,1 },
+  { "msp430fg477",0,0 },
+  { "msp430fg478",0,0 },
+  { "msp430fg479",0,0 },
+  { "msp430fg6425",2,8 },
+  { "msp430fg6426",2,8 },
+  { "msp430fg6625",2,8 },
+  { "msp430fg6626",2,8 },
+  { "msp430fr2032",2,0 },
+  { "msp430fr2033",2,0 },
+  { "msp430fr2110",2,0 },
+  { "msp430fr2111",2,0 },
+  { "msp430fr2310",2,0 },
+  { "msp430fr2311",2,0 },
+  { "msp430fr2433",2,8 },
+  { "msp430fr2532",2,8 },
+  { "msp430fr2533",2,8 },
+  { "msp430fr2632",2,8 },
+  { "msp430fr2633",2,8 },
+  { "msp430fr2xx_4xxgeneric",2,8 },
+  { "msp430fr4131",2,0 },
+  { "msp430fr4132",2,0 },
+  { "msp430fr4133",2,0 },
+  { "msp430fr5720",2,8 },
+  { "msp430fr5721",2,8 },
+  { "msp430fr5722",2,8 },
+  { "msp430fr5723",2,8 },
+  { "msp430fr5724",2,8 },
+  { "msp430fr5725",2,8 },
+  { "msp430fr5726",2,8 },
+  { "msp430fr5727",2,8 },
+  { "msp430fr5728",2,8 },
+  { "msp430fr5729",2,8 },
+  { "msp430fr5730",2,8 },
+  { "msp430fr5731",2,8 },
+  { "msp430fr5732",2,8 },
+  { "msp430fr5733",2,8 },
+  { "msp430fr5734",2,8 },
+  { "msp430fr5735",2,8 },
+  { "msp430fr5736",2,8 },
+  { "msp430fr5737",2,8 },
+  { "msp430fr5738",2,8 },
+  { "msp430fr5739",2,8 },
+  { "msp430fr57xxgeneric",2,8 },
+  { "msp430fr5847",2,8 },
+  { "msp430fr58471",2,8 },
+  { "msp430fr5848",2,8 },
+  { "msp430fr5849",2,8 },
+  { "msp430fr5857",2,8 },
+  { "msp430fr5858",2,8 },
+  { "msp430fr5859",2,8 },
+  { "msp430fr5867",2,8 },
+  { "msp430fr58671",2,8 },
+  { "msp430fr5868",2,8 },
+  { "msp430fr5869",2,8 },
+  { "msp430fr5870",2,8 },
+  { "msp430fr5872",2,8 },
+  { "msp430fr58721",2,8 },
+  { "msp430fr5887",2,8 },
+  { "msp430fr5888",2,8 },
+  { "msp430fr5889",2,8 },
+  { "msp430fr58891",2,8 },
+  { "msp430fr5922",2,8 },
+  { "msp430fr59221",2,8 },
+  { "msp430fr5947",2,8 },
+  { "msp430fr59471",2,8 },
+  { "msp430fr5948",2,8 },
+  { "msp430fr5949",2,8 },
+  { "msp430fr5957",2,8 },
+  { "msp430fr5958",2,8 },
+  { "msp430fr5959",2,8 },
+  { "msp430fr5962",2,8 },
+  { "msp430fr5964",2,8 },
+  { "msp430fr5967",2,8 },
+  { "msp430fr5968",2,8 },
+  { "msp430fr5969",2,8 },
+  { "msp430fr59691",2,8 },
+  { "msp430fr5970",2,8 },
+  { "msp430fr5972",2,8 },
+  { "msp430fr59721",2,8 },
+  { "msp430fr5986",2,8 },
+  { "msp430fr5987",2,8 },
+  { "msp430fr5988",2,8 },
+  { "msp430fr5989",2,8 },
+  { "msp430fr59891",2,8 },
+  { "msp430fr5992",2,8 },
+  { "msp430fr5994",2,8 },
+  { "msp430fr59941",2,8 },
+  { "msp430fr5xx_6xxgeneric",2,8 },
+  { "msp430fr6820",2,8 },
+  { "msp430fr6822",2,8 },
+  { "msp430fr68221",2,8 },
+  { "msp430fr6870",2,8 },
+  { "msp430fr6872",2,8 },
+  { "msp430fr68721",2,8 },
+  { "msp430fr6877",2,8 },
+  { "msp430fr6879",2,8 },
+  { "msp430fr68791",2,8 },
+  { "msp430fr6887",2,8 },
+  { "msp430fr6888",2,8 },
+  { "msp430fr6889",2,8 },
+  { "msp430fr68891",2,8 },
+  { "msp430fr6920",2,8 },
+  { "msp430fr6922",2,8 },
+  { "msp430fr69221",2,8 },
+  { "msp430fr6927",2,8 },
+  { "msp430fr69271",2,8 },
+  { "msp430fr6928",2,8 },
+  { "msp430fr6970",2,8 },
+  { "msp430fr6972",2,8 },
+  { "msp430fr69721",2,8 },
+  { "msp430fr6977",2,8 },
+  { "msp430fr6979",2,8 },
+  { "msp430fr69791",2,8 },
+  { "msp430fr6987",2,8 },
+  { "msp430fr6988",2,8 },
+  { "msp430fr6989",2,8 },
+  { "msp430fr69891",2,8 },
+  { "msp430fw423",0,0 },
+  { "msp430fw425",0,0 },
+  { "msp430fw427",0,0 },
+  { "msp430fw428",0,0 },
+  { "msp430fw429",0,0 },
+  { "msp430g2001",0,0 },
+  { "msp430g2101",0,0 },
+  { "msp430g2102",0,0 },
+  { "msp430g2111",0,0 },
+  { "msp430g2112",0,0 },
+  { "msp430g2113",0,0 },
+  { "msp430g2121",0,0 },
+  { "msp430g2131",0,0 },
+  { "msp430g2132",0,0 },
+  { "msp430g2152",0,0 },
+  { "msp430g2153",0,0 },
+  { "msp430g2201",0,0 },
+  { "msp430g2202",0,0 },
+  { "msp430g2203",0,0 },
+  { "msp430g2210",0,0 },
+  { "msp430g2211",0,0 },
+  { "msp430g2212",0,0 },
+  { "msp430g2213",0,0 },
+  { "msp430g2221",0,0 },
+  { "msp430g2230",0,0 },
+  { "msp430g2231",0,0 },
+  { "msp430g2232",0,0 },
+  { "msp430g2233",0,0 },
+  { "msp430g2252",0,0 },
+  { "msp430g2253",0,0 },
+  { "msp430g2302",0,0 },
+  { "msp430g2303",0,0 },
+  { "msp430g2312",0,0 },
+  { "msp430g2313",0,0 },
+  { "msp430g2332",0,0 },
+  { "msp430g2333",0,0 },
+  { "msp430g2352",0,0 },
+  { "msp430g2353",0,0 },
+  { "msp430g2402",0,0 },
+  { "msp430g2403",0,0 },
+  { "msp430g2412",0,0 },
+  { "msp430g2413",0,0 },
+  { "msp430g2432",0,0 },
+  { "msp430g2433",0,0 },
+  { "msp430g2444",0,0 },
+  { "msp430g2452",0,0 },
+  { "msp430g2453",0,0 },
+  { "msp430g2513",0,0 },
+  { "msp430g2533",0,0 },
+  { "msp430g2544",0,0 },
+  { "msp430g2553",0,0 },
+  { "msp430g2744",0,0 },
+  { "msp430g2755",0,0 },
+  { "msp430g2855",0,0 },
+  { "msp430g2955",0,0 },
+  { "msp430i2020",0,2 },
+  { "msp430i2021",0,2 },
+  { "msp430i2030",0,2 },
+  { "msp430i2031",0,2 },
+  { "msp430i2040",0,2 },
+  { "msp430i2041",0,2 },
+  { "msp430i2xxgeneric",0,2 },
+  { "msp430l092",0,0 },
+  { "msp430p112",0,0 },
+  { "msp430p313",0,0 },
+  { "msp430p315",0,0 },
+  { "msp430p315s",0,0 },
+  { "msp430p325",0,0 },
+  { "msp430p337",0,1 },
+  { "msp430sl5438a",2,8 },
+  { "msp430tch5e",0,0 },
+  { "msp430xgeneric",2,8 },
+  { "rf430f5144",2,8 },
+  { "rf430f5155",2,8 },
+  { "rf430f5175",2,8 },
+  { "rf430frl152h",0,0 },
+  { "rf430frl152h_rom",0,0 },
+  { "rf430frl153h",0,0 },
+  { "rf430frl153h_rom",0,0 },
+  { "rf430frl154h",0,0 },
+  { "rf430frl154h_rom",0,0 }
+};
diff --git a/gcc/config/msp430/msp430-devices.h b/gcc/config/msp430/msp430-devices.h
new file mode 100644
index 00000000000..08ae1adf4ed
--- /dev/null
+++ b/gcc/config/msp430/msp430-devices.h
@@ -0,0 +1,31 @@
+/* Definitions of subroutines used for reading MCU data on TI MSP430 processors.
+   Copyright (C) 2019 Free Software Foundation, Inc.
+   Contributed by Jozef Lawrynowicz  <jozef.l@mittosystems.com>.
+
+   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/>.  */
+
+struct t_msp430_mcu_data
+{
+  const char * name;
+  unsigned int revision; /* 0=> MSP430, 1=>MSP430X, 2=> MSP430Xv2.  */
+  unsigned int hwmpy;    /* 0=>none, 1=>16-bit, 2=>16-bit w/sign extend.  */
+			 /* 4=>32-bit, 8=> 32-bit (5xx).  */
+};
+
+extern struct t_msp430_mcu_data extracted_mcu_data;
+
+void msp430_extract_mcu_data (const char * mcu_name);
diff --git a/gcc/config/msp430/msp430.c b/gcc/config/msp430/msp430.c
index c7b774e71a6..49fc26238a5 100644
--- a/gcc/config/msp430/msp430.c
+++ b/gcc/config/msp430/msp430.c
@@ -45,6 +45,7 @@
 #include "langhooks.h"
 #include "builtins.h"
 #include "intl.h"
+#include "msp430-devices.h"
 
 /* This file should be included last.  */
 #include "target-def.h"
@@ -95,627 +96,6 @@ msp430_init_machine_status (void)
 #undef  TARGET_OPTION_OVERRIDE
 #define TARGET_OPTION_OVERRIDE		msp430_option_override
 
-/* This is a copy of the same data structure found in gas/config/tc-msp430.c
-   Also another (sort-of) copy can be found in gcc/config/msp430/t-msp430
-   Keep these three structures in sync.
-   The data in this structure has been extracted from version 1.194 of the
-   devices.csv file released by TI in September 2016.  */
-
-struct msp430_mcu_data
-{
-  const char * name;
-  unsigned int revision; /* 0=> MSP430, 1=>MSP430X, 2=> MSP430Xv2.  */
-  unsigned int hwmpy;    /* 0=>none, 1=>16-bit, 2=>16-bit w/sign extend, 4=>32-bit, 8=> 32-bit (5xx).  */
-}
-msp430_mcu_data [] =
-{
-  { "cc430f5123",2,8 },
-  { "cc430f5125",2,8 },
-  { "cc430f5133",2,8 },
-  { "cc430f5135",2,8 },
-  { "cc430f5137",2,8 },
-  { "cc430f5143",2,8 },
-  { "cc430f5145",2,8 },
-  { "cc430f5147",2,8 },
-  { "cc430f6125",2,8 },
-  { "cc430f6126",2,8 },
-  { "cc430f6127",2,8 },
-  { "cc430f6135",2,8 },
-  { "cc430f6137",2,8 },
-  { "cc430f6143",2,8 },
-  { "cc430f6145",2,8 },
-  { "cc430f6147",2,8 },
-  { "msp430afe221",0,2 },
-  { "msp430afe222",0,2 },
-  { "msp430afe223",0,2 },
-  { "msp430afe231",0,2 },
-  { "msp430afe232",0,2 },
-  { "msp430afe233",0,2 },
-  { "msp430afe251",0,2 },
-  { "msp430afe252",0,2 },
-  { "msp430afe253",0,2 },
-  { "msp430bt5190",2,8 },
-  { "msp430c091",0,0 },
-  { "msp430c092",0,0 },
-  { "msp430c111",0,0 },
-  { "msp430c1111",0,0 },
-  { "msp430c112",0,0 },
-  { "msp430c1121",0,0 },
-  { "msp430c1331",0,0 },
-  { "msp430c1351",0,0 },
-  { "msp430c311s",0,0 },
-  { "msp430c312",0,0 },
-  { "msp430c313",0,0 },
-  { "msp430c314",0,0 },
-  { "msp430c315",0,0 },
-  { "msp430c323",0,0 },
-  { "msp430c325",0,0 },
-  { "msp430c336",0,1 },
-  { "msp430c337",0,1 },
-  { "msp430c412",0,0 },
-  { "msp430c413",0,0 },
-  { "msp430cg4616",1,1 },
-  { "msp430cg4617",1,1 },
-  { "msp430cg4618",1,1 },
-  { "msp430cg4619",1,1 },
-  { "msp430e112",0,0 },
-  { "msp430e313",0,0 },
-  { "msp430e315",0,0 },
-  { "msp430e325",0,0 },
-  { "msp430e337",0,1 },
-  { "msp430f110",0,0 },
-  { "msp430f1101",0,0 },
-  { "msp430f1101a",0,0 },
-  { "msp430f1111",0,0 },
-  { "msp430f1111a",0,0 },
-  { "msp430f112",0,0 },
-  { "msp430f1121",0,0 },
-  { "msp430f1121a",0,0 },
-  { "msp430f1122",0,0 },
-  { "msp430f1132",0,0 },
-  { "msp430f122",0,0 },
-  { "msp430f1222",0,0 },
-  { "msp430f123",0,0 },
-  { "msp430f1232",0,0 },
-  { "msp430f133",0,0 },
-  { "msp430f135",0,0 },
-  { "msp430f147",0,1 },
-  { "msp430f1471",0,1 },
-  { "msp430f148",0,1 },
-  { "msp430f1481",0,1 },
-  { "msp430f149",0,1 },
-  { "msp430f1491",0,1 },
-  { "msp430f155",0,0 },
-  { "msp430f156",0,0 },
-  { "msp430f157",0,0 },
-  { "msp430f1610",0,1 },
-  { "msp430f1611",0,1 },
-  { "msp430f1612",0,1 },
-  { "msp430f167",0,1 },
-  { "msp430f168",0,1 },
-  { "msp430f169",0,1 },
-  { "msp430f2001",0,0 },
-  { "msp430f2002",0,0 },
-  { "msp430f2003",0,0 },
-  { "msp430f2011",0,0 },
-  { "msp430f2012",0,0 },
-  { "msp430f2013",0,0 },
-  { "msp430f2101",0,0 },
-  { "msp430f2111",0,0 },
-  { "msp430f2112",0,0 },
-  { "msp430f2121",0,0 },
-  { "msp430f2122",0,0 },
-  { "msp430f2131",0,0 },
-  { "msp430f2132",0,0 },
-  { "msp430f2232",0,0 },
-  { "msp430f2234",0,0 },
-  { "msp430f2252",0,0 },
-  { "msp430f2254",0,0 },
-  { "msp430f2272",0,0 },
-  { "msp430f2274",0,0 },
-  { "msp430f233",0,2 },
-  { "msp430f2330",0,2 },
-  { "msp430f235",0,2 },
-  { "msp430f2350",0,2 },
-  { "msp430f2370",0,2 },
-  { "msp430f2410",0,2 },
-  { "msp430f2416",1,2 },
-  { "msp430f2417",1,2 },
-  { "msp430f2418",1,2 },
-  { "msp430f2419",1,2 },
-  { "msp430f247",0,2 },
-  { "msp430f2471",0,2 },
-  { "msp430f248",0,2 },
-  { "msp430f2481",0,2 },
-  { "msp430f249",0,2 },
-  { "msp430f2491",0,2 },
-  { "msp430f2616",1,2 },
-  { "msp430f2617",1,2 },
-  { "msp430f2618",1,2 },
-  { "msp430f2619",1,2 },
-  { "msp430f412",0,0 },
-  { "msp430f413",0,0 },
-  { "msp430f4132",0,0 },
-  { "msp430f415",0,0 },
-  { "msp430f4152",0,0 },
-  { "msp430f417",0,0 },
-  { "msp430f423",0,1 },
-  { "msp430f423a",0,1 },
-  { "msp430f425",0,1 },
-  { "msp430f4250",0,0 },
-  { "msp430f425a",0,1 },
-  { "msp430f4260",0,0 },
-  { "msp430f427",0,1 },
-  { "msp430f4270",0,0 },
-  { "msp430f427a",0,1 },
-  { "msp430f435",0,0 },
-  { "msp430f4351",0,0 },
-  { "msp430f436",0,0 },
-  { "msp430f4361",0,0 },
-  { "msp430f437",0,0 },
-  { "msp430f4371",0,0 },
-  { "msp430f438",0,0 },
-  { "msp430f439",0,0 },
-  { "msp430f447",0,1 },
-  { "msp430f448",0,1 },
-  { "msp430f4481",0,1 },
-  { "msp430f449",0,1 },
-  { "msp430f4491",0,1 },
-  { "msp430f4616",1,1 },
-  { "msp430f46161",1,1 },
-  { "msp430f4617",1,1 },
-  { "msp430f46171",1,1 },
-  { "msp430f4618",1,1 },
-  { "msp430f46181",1,1 },
-  { "msp430f4619",1,1 },
-  { "msp430f46191",1,1 },
-  { "msp430f47126",1,4 },
-  { "msp430f47127",1,4 },
-  { "msp430f47163",1,4 },
-  { "msp430f47166",1,4 },
-  { "msp430f47167",1,4 },
-  { "msp430f47173",1,4 },
-  { "msp430f47176",1,4 },
-  { "msp430f47177",1,4 },
-  { "msp430f47183",1,4 },
-  { "msp430f47186",1,4 },
-  { "msp430f47187",1,4 },
-  { "msp430f47193",1,4 },
-  { "msp430f47196",1,4 },
-  { "msp430f47197",1,4 },
-  { "msp430f477",0,0 },
-  { "msp430f478",0,0 },
-  { "msp430f4783",0,4 },
-  { "msp430f4784",0,4 },
-  { "msp430f479",0,0 },
-  { "msp430f4793",0,4 },
-  { "msp430f4794",0,4 },
-  { "msp430f5131",2,8 },
-  { "msp430f5132",2,8 },
-  { "msp430f5151",2,8 },
-  { "msp430f5152",2,8 },
-  { "msp430f5171",2,8 },
-  { "msp430f5172",2,8 },
-  { "msp430f5212",2,8 },
-  { "msp430f5213",2,8 },
-  { "msp430f5214",2,8 },
-  { "msp430f5217",2,8 },
-  { "msp430f5218",2,8 },
-  { "msp430f5219",2,8 },
-  { "msp430f5222",2,8 },
-  { "msp430f5223",2,8 },
-  { "msp430f5224",2,8 },
-  { "msp430f5227",2,8 },
-  { "msp430f5228",2,8 },
-  { "msp430f5229",2,8 },
-  { "msp430f5232",2,8 },
-  { "msp430f5234",2,8 },
-  { "msp430f5237",2,8 },
-  { "msp430f5239",2,8 },
-  { "msp430f5242",2,8 },
-  { "msp430f5244",2,8 },
-  { "msp430f5247",2,8 },
-  { "msp430f5249",2,8 },
-  { "msp430f5252",2,8 },
-  { "msp430f5253",2,8 },
-  { "msp430f5254",2,8 },
-  { "msp430f5255",2,8 },
-  { "msp430f5256",2,8 },
-  { "msp430f5257",2,8 },
-  { "msp430f5258",2,8 },
-  { "msp430f5259",2,8 },
-  { "msp430f5304",2,8 },
-  { "msp430f5308",2,8 },
-  { "msp430f5309",2,8 },
-  { "msp430f5310",2,8 },
-  { "msp430f5324",2,8 },
-  { "msp430f5325",2,8 },
-  { "msp430f5326",2,8 },
-  { "msp430f5327",2,8 },
-  { "msp430f5328",2,8 },
-  { "msp430f5329",2,8 },
-  { "msp430f5333",2,8 },
-  { "msp430f5335",2,8 },
-  { "msp430f5336",2,8 },
-  { "msp430f5338",2,8 },
-  { "msp430f5340",2,8 },
-  { "msp430f5341",2,8 },
-  { "msp430f5342",2,8 },
-  { "msp430f5358",2,8 },
-  { "msp430f5359",2,8 },
-  { "msp430f5418",2,8 },
-  { "msp430f5418a",2,8 },
-  { "msp430f5419",2,8 },
-  { "msp430f5419a",2,8 },
-  { "msp430f5435",2,8 },
-  { "msp430f5435a",2,8 },
-  { "msp430f5436",2,8 },
-  { "msp430f5436a",2,8 },
-  { "msp430f5437",2,8 },
-  { "msp430f5437a",2,8 },
-  { "msp430f5438",2,8 },
-  { "msp430f5438a",2,8 },
-  { "msp430f5500",2,8 },
-  { "msp430f5501",2,8 },
-  { "msp430f5502",2,8 },
-  { "msp430f5503",2,8 },
-  { "msp430f5504",2,8 },
-  { "msp430f5505",2,8 },
-  { "msp430f5506",2,8 },
-  { "msp430f5507",2,8 },
-  { "msp430f5508",2,8 },
-  { "msp430f5509",2,8 },
-  { "msp430f5510",2,8 },
-  { "msp430f5513",2,8 },
-  { "msp430f5514",2,8 },
-  { "msp430f5515",2,8 },
-  { "msp430f5517",2,8 },
-  { "msp430f5519",2,8 },
-  { "msp430f5521",2,8 },
-  { "msp430f5522",2,8 },
-  { "msp430f5524",2,8 },
-  { "msp430f5525",2,8 },
-  { "msp430f5526",2,8 },
-  { "msp430f5527",2,8 },
-  { "msp430f5528",2,8 },
-  { "msp430f5529",2,8 },
-  { "msp430f5630",2,8 },
-  { "msp430f5631",2,8 },
-  { "msp430f5632",2,8 },
-  { "msp430f5633",2,8 },
-  { "msp430f5634",2,8 },
-  { "msp430f5635",2,8 },
-  { "msp430f5636",2,8 },
-  { "msp430f5637",2,8 },
-  { "msp430f5638",2,8 },
-  { "msp430f5658",2,8 },
-  { "msp430f5659",2,8 },
-  { "msp430f5xx_6xxgeneric",2,8 },
-  { "msp430f6433",2,8 },
-  { "msp430f6435",2,8 },
-  { "msp430f6436",2,8 },
-  { "msp430f6438",2,8 },
-  { "msp430f6458",2,8 },
-  { "msp430f6459",2,8 },
-  { "msp430f6630",2,8 },
-  { "msp430f6631",2,8 },
-  { "msp430f6632",2,8 },
-  { "msp430f6633",2,8 },
-  { "msp430f6634",2,8 },
-  { "msp430f6635",2,8 },
-  { "msp430f6636",2,8 },
-  { "msp430f6637",2,8 },
-  { "msp430f6638",2,8 },
-  { "msp430f6658",2,8 },
-  { "msp430f6659",2,8 },
-  { "msp430f6720",2,8 },
-  { "msp430f6720a",2,8 },
-  { "msp430f6721",2,8 },
-  { "msp430f6721a",2,8 },
-  { "msp430f6723",2,8 },
-  { "msp430f6723a",2,8 },
-  { "msp430f6724",2,8 },
-  { "msp430f6724a",2,8 },
-  { "msp430f6725",2,8 },
-  { "msp430f6725a",2,8 },
-  { "msp430f6726",2,8 },
-  { "msp430f6726a",2,8 },
-  { "msp430f6730",2,8 },
-  { "msp430f6730a",2,8 },
-  { "msp430f6731",2,8 },
-  { "msp430f6731a",2,8 },
-  { "msp430f6733",2,8 },
-  { "msp430f6733a",2,8 },
-  { "msp430f6734",2,8 },
-  { "msp430f6734a",2,8 },
-  { "msp430f6735",2,8 },
-  { "msp430f6735a",2,8 },
-  { "msp430f6736",2,8 },
-  { "msp430f6736a",2,8 },
-  { "msp430f6745",2,8 },
-  { "msp430f67451",2,8 },
-  { "msp430f67451a",2,8 },
-  { "msp430f6745a",2,8 },
-  { "msp430f6746",2,8 },
-  { "msp430f67461",2,8 },
-  { "msp430f67461a",2,8 },
-  { "msp430f6746a",2,8 },
-  { "msp430f6747",2,8 },
-  { "msp430f67471",2,8 },
-  { "msp430f67471a",2,8 },
-  { "msp430f6747a",2,8 },
-  { "msp430f6748",2,8 },
-  { "msp430f67481",2,8 },
-  { "msp430f67481a",2,8 },
-  { "msp430f6748a",2,8 },
-  { "msp430f6749",2,8 },
-  { "msp430f67491",2,8 },
-  { "msp430f67491a",2,8 },
-  { "msp430f6749a",2,8 },
-  { "msp430f67621",2,8 },
-  { "msp430f67621a",2,8 },
-  { "msp430f67641",2,8 },
-  { "msp430f67641a",2,8 },
-  { "msp430f6765",2,8 },
-  { "msp430f67651",2,8 },
-  { "msp430f67651a",2,8 },
-  { "msp430f6765a",2,8 },
-  { "msp430f6766",2,8 },
-  { "msp430f67661",2,8 },
-  { "msp430f67661a",2,8 },
-  { "msp430f6766a",2,8 },
-  { "msp430f6767",2,8 },
-  { "msp430f67671",2,8 },
-  { "msp430f67671a",2,8 },
-  { "msp430f6767a",2,8 },
-  { "msp430f6768",2,8 },
-  { "msp430f67681",2,8 },
-  { "msp430f67681a",2,8 },
-  { "msp430f6768a",2,8 },
-  { "msp430f6769",2,8 },
-  { "msp430f67691",2,8 },
-  { "msp430f67691a",2,8 },
-  { "msp430f6769a",2,8 },
-  { "msp430f6775",2,8 },
-  { "msp430f67751",2,8 },
-  { "msp430f67751a",2,8 },
-  { "msp430f6775a",2,8 },
-  { "msp430f6776",2,8 },
-  { "msp430f67761",2,8 },
-  { "msp430f67761a",2,8 },
-  { "msp430f6776a",2,8 },
-  { "msp430f6777",2,8 },
-  { "msp430f67771",2,8 },
-  { "msp430f67771a",2,8 },
-  { "msp430f6777a",2,8 },
-  { "msp430f6778",2,8 },
-  { "msp430f67781",2,8 },
-  { "msp430f67781a",2,8 },
-  { "msp430f6778a",2,8 },
-  { "msp430f6779",2,8 },
-  { "msp430f67791",2,8 },
-  { "msp430f67791a",2,8 },
-  { "msp430f6779a",2,8 },
-  { "msp430fe423",0,0 },
-  { "msp430fe4232",0,0 },
-  { "msp430fe423a",0,0 },
-  { "msp430fe4242",0,0 },
-  { "msp430fe425",0,0 },
-  { "msp430fe4252",0,0 },
-  { "msp430fe425a",0,0 },
-  { "msp430fe427",0,0 },
-  { "msp430fe4272",0,0 },
-  { "msp430fe427a",0,0 },
-  { "msp430fg4250",0,0 },
-  { "msp430fg4260",0,0 },
-  { "msp430fg4270",0,0 },
-  { "msp430fg437",0,0 },
-  { "msp430fg438",0,0 },
-  { "msp430fg439",0,0 },
-  { "msp430fg4616",1,1 },
-  { "msp430fg4617",1,1 },
-  { "msp430fg4618",1,1 },
-  { "msp430fg4619",1,1 },
-  { "msp430fg477",0,0 },
-  { "msp430fg478",0,0 },
-  { "msp430fg479",0,0 },
-  { "msp430fg6425",2,8 },
-  { "msp430fg6426",2,8 },
-  { "msp430fg6625",2,8 },
-  { "msp430fg6626",2,8 },
-  { "msp430fr2032",2,0 },
-  { "msp430fr2033",2,0 },
-  { "msp430fr2110",2,0 },
-  { "msp430fr2111",2,0 },
-  { "msp430fr2310",2,0 },
-  { "msp430fr2311",2,0 },
-  { "msp430fr2433",2,8 },
-  { "msp430fr2532",2,8 },
-  { "msp430fr2533",2,8 },
-  { "msp430fr2632",2,8 },
-  { "msp430fr2633",2,8 },
-  { "msp430fr2xx_4xxgeneric",2,8 },
-  { "msp430fr4131",2,0 },
-  { "msp430fr4132",2,0 },
-  { "msp430fr4133",2,0 },
-  { "msp430fr5720",2,8 },
-  { "msp430fr5721",2,8 },
-  { "msp430fr5722",2,8 },
-  { "msp430fr5723",2,8 },
-  { "msp430fr5724",2,8 },
-  { "msp430fr5725",2,8 },
-  { "msp430fr5726",2,8 },
-  { "msp430fr5727",2,8 },
-  { "msp430fr5728",2,8 },
-  { "msp430fr5729",2,8 },
-  { "msp430fr5730",2,8 },
-  { "msp430fr5731",2,8 },
-  { "msp430fr5732",2,8 },
-  { "msp430fr5733",2,8 },
-  { "msp430fr5734",2,8 },
-  { "msp430fr5735",2,8 },
-  { "msp430fr5736",2,8 },
-  { "msp430fr5737",2,8 },
-  { "msp430fr5738",2,8 },
-  { "msp430fr5739",2,8 },
-  { "msp430fr57xxgeneric",2,8 },
-  { "msp430fr5847",2,8 },
-  { "msp430fr58471",2,8 },
-  { "msp430fr5848",2,8 },
-  { "msp430fr5849",2,8 },
-  { "msp430fr5857",2,8 },
-  { "msp430fr5858",2,8 },
-  { "msp430fr5859",2,8 },
-  { "msp430fr5867",2,8 },
-  { "msp430fr58671",2,8 },
-  { "msp430fr5868",2,8 },
-  { "msp430fr5869",2,8 },
-  { "msp430fr5870",2,8 },
-  { "msp430fr5872",2,8 },
-  { "msp430fr58721",2,8 },
-  { "msp430fr5887",2,8 },
-  { "msp430fr5888",2,8 },
-  { "msp430fr5889",2,8 },
-  { "msp430fr58891",2,8 },
-  { "msp430fr5922",2,8 },
-  { "msp430fr59221",2,8 },
-  { "msp430fr5947",2,8 },
-  { "msp430fr59471",2,8 },
-  { "msp430fr5948",2,8 },
-  { "msp430fr5949",2,8 },
-  { "msp430fr5957",2,8 },
-  { "msp430fr5958",2,8 },
-  { "msp430fr5959",2,8 },
-  { "msp430fr5962",2,8 },
-  { "msp430fr5964",2,8 },
-  { "msp430fr5967",2,8 },
-  { "msp430fr5968",2,8 },
-  { "msp430fr5969",2,8 },
-  { "msp430fr59691",2,8 },
-  { "msp430fr5970",2,8 },
-  { "msp430fr5972",2,8 },
-  { "msp430fr59721",2,8 },
-  { "msp430fr5986",2,8 },
-  { "msp430fr5987",2,8 },
-  { "msp430fr5988",2,8 },
-  { "msp430fr5989",2,8 },
-  { "msp430fr59891",2,8 },
-  { "msp430fr5992",2,8 },
-  { "msp430fr5994",2,8 },
-  { "msp430fr59941",2,8 },
-  { "msp430fr5xx_6xxgeneric",2,8 },
-  { "msp430fr6820",2,8 },
-  { "msp430fr6822",2,8 },
-  { "msp430fr68221",2,8 },
-  { "msp430fr6870",2,8 },
-  { "msp430fr6872",2,8 },
-  { "msp430fr68721",2,8 },
-  { "msp430fr6877",2,8 },
-  { "msp430fr6879",2,8 },
-  { "msp430fr68791",2,8 },
-  { "msp430fr6887",2,8 },
-  { "msp430fr6888",2,8 },
-  { "msp430fr6889",2,8 },
-  { "msp430fr68891",2,8 },
-  { "msp430fr6920",2,8 },
-  { "msp430fr6922",2,8 },
-  { "msp430fr69221",2,8 },
-  { "msp430fr6927",2,8 },
-  { "msp430fr69271",2,8 },
-  { "msp430fr6928",2,8 },
-  { "msp430fr6970",2,8 },
-  { "msp430fr6972",2,8 },
-  { "msp430fr69721",2,8 },
-  { "msp430fr6977",2,8 },
-  { "msp430fr6979",2,8 },
-  { "msp430fr69791",2,8 },
-  { "msp430fr6987",2,8 },
-  { "msp430fr6988",2,8 },
-  { "msp430fr6989",2,8 },
-  { "msp430fr69891",2,8 },
-  { "msp430fw423",0,0 },
-  { "msp430fw425",0,0 },
-  { "msp430fw427",0,0 },
-  { "msp430fw428",0,0 },
-  { "msp430fw429",0,0 },
-  { "msp430g2001",0,0 },
-  { "msp430g2101",0,0 },
-  { "msp430g2102",0,0 },
-  { "msp430g2111",0,0 },
-  { "msp430g2112",0,0 },
-  { "msp430g2113",0,0 },
-  { "msp430g2121",0,0 },
-  { "msp430g2131",0,0 },
-  { "msp430g2132",0,0 },
-  { "msp430g2152",0,0 },
-  { "msp430g2153",0,0 },
-  { "msp430g2201",0,0 },
-  { "msp430g2202",0,0 },
-  { "msp430g2203",0,0 },
-  { "msp430g2210",0,0 },
-  { "msp430g2211",0,0 },
-  { "msp430g2212",0,0 },
-  { "msp430g2213",0,0 },
-  { "msp430g2221",0,0 },
-  { "msp430g2230",0,0 },
-  { "msp430g2231",0,0 },
-  { "msp430g2232",0,0 },
-  { "msp430g2233",0,0 },
-  { "msp430g2252",0,0 },
-  { "msp430g2253",0,0 },
-  { "msp430g2302",0,0 },
-  { "msp430g2303",0,0 },
-  { "msp430g2312",0,0 },
-  { "msp430g2313",0,0 },
-  { "msp430g2332",0,0 },
-  { "msp430g2333",0,0 },
-  { "msp430g2352",0,0 },
-  { "msp430g2353",0,0 },
-  { "msp430g2402",0,0 },
-  { "msp430g2403",0,0 },
-  { "msp430g2412",0,0 },
-  { "msp430g2413",0,0 },
-  { "msp430g2432",0,0 },
-  { "msp430g2433",0,0 },
-  { "msp430g2444",0,0 },
-  { "msp430g2452",0,0 },
-  { "msp430g2453",0,0 },
-  { "msp430g2513",0,0 },
-  { "msp430g2533",0,0 },
-  { "msp430g2544",0,0 },
-  { "msp430g2553",0,0 },
-  { "msp430g2744",0,0 },
-  { "msp430g2755",0,0 },
-  { "msp430g2855",0,0 },
-  { "msp430g2955",0,0 },
-  { "msp430i2020",0,2 },
-  { "msp430i2021",0,2 },
-  { "msp430i2030",0,2 },
-  { "msp430i2031",0,2 },
-  { "msp430i2040",0,2 },
-  { "msp430i2041",0,2 },
-  { "msp430i2xxgeneric",0,2 },
-  { "msp430l092",0,0 },
-  { "msp430p112",0,0 },
-  { "msp430p313",0,0 },
-  { "msp430p315",0,0 },
-  { "msp430p315s",0,0 },
-  { "msp430p325",0,0 },
-  { "msp430p337",0,1 },
-  { "msp430sl5438a",2,8 },
-  { "msp430tch5e",0,0 },
-  { "msp430xgeneric",2,8 },
-  { "rf430f5144",2,8 },
-  { "rf430f5155",2,8 },
-  { "rf430f5175",2,8 },
-  { "rf430frl152h",0,0 },
-  { "rf430frl152h_rom",0,0 },
-  { "rf430frl153h",0,0 },
-  { "rf430frl153h_rom",0,0 },
-  { "rf430frl154h",0,0 },
-  { "rf430frl154h_rom",0,0 }
-};  
-
 /* Generate a C preprocessor symbol based upon the MCU selected by the user.
    If a specific MCU has not been selected then return a generic symbol instead.  */
 
@@ -724,6 +104,7 @@ msp430_mcu_name (void)
 {
   if (target_mcu)
     {
+      msp430_extract_mcu_data (target_mcu);
       unsigned int i;
       unsigned int start_upper;
       unsigned int end_upper;
@@ -786,22 +167,20 @@ msp430_option_override (void)
 
   if (target_mcu)
     {
-      int i;
+      msp430_extract_mcu_data (target_mcu);
 
-      /* FIXME: If the array were alpha sorted, we could use a binary search.  */
-      for (i = ARRAY_SIZE (msp430_mcu_data); i--;)
-	if (strcasecmp (msp430_mcu_data[i].name, target_mcu) == 0)
+	if (extracted_mcu_data.name != NULL)
 	  {
-	    bool xisa = msp430_mcu_data[i].revision >= 1; 
+	    bool xisa = extracted_mcu_data.revision >= 1;
 
 	    if (msp430_warn_mcu)
 	      {
-		if (target_cpu&& msp430x != xisa)
+		if (target_cpu && msp430x != xisa)
 		  warning (0, "MCU %qs supports %s ISA but %<-mcpu%> option "
 			   "is set to %s",
 			   target_mcu, xisa ? "430X" : "430", msp430x ? "430X" : "430");
 
-		if (msp430_mcu_data[i].hwmpy == 0
+		if (extracted_mcu_data.hwmpy == 0
 		    && msp430_hwmult_type != MSP430_HWMULT_AUTO
 		    && msp430_hwmult_type != MSP430_HWMULT_NONE)
 		  warning (0, "MCU %qs does not have hardware multiply "
@@ -810,26 +189,25 @@ msp430_option_override (void)
 			   msp430_hwmult_type == MSP430_HWMULT_SMALL ? "16-bit"
 			   : msp430_hwmult_type == MSP430_HWMULT_LARGE ? "32-bit" : "f5series");
 		else if (msp430_hwmult_type == MSP430_HWMULT_SMALL
-		    && msp430_mcu_data[i].hwmpy != 1
-		    && msp430_mcu_data[i].hwmpy != 2 )
+		    && extracted_mcu_data.hwmpy != 1
+		    && extracted_mcu_data.hwmpy != 2)
 		  warning (0, "MCU %qs supports %s hardware multiply, "
 			   "but %<-mhwmult%> is set to 16-bit",
-			   target_mcu, hwmult_name (msp430_mcu_data[i].hwmpy));
-		else if (msp430_hwmult_type == MSP430_HWMULT_LARGE && msp430_mcu_data[i].hwmpy != 4)
+			   target_mcu, hwmult_name (extracted_mcu_data.hwmpy));
+		else if (msp430_hwmult_type == MSP430_HWMULT_LARGE
+			 && extracted_mcu_data.hwmpy != 4)
 		  warning (0, "MCU %qs supports %s hardware multiply, "
 			   "but %<-mhwmult%> is set to 32-bit",
-			   target_mcu, hwmult_name (msp430_mcu_data[i].hwmpy));
-		else if (msp430_hwmult_type == MSP430_HWMULT_F5SERIES && msp430_mcu_data[i].hwmpy != 8)
+			   target_mcu, hwmult_name (extracted_mcu_data.hwmpy));
+		else if (msp430_hwmult_type == MSP430_HWMULT_F5SERIES
+			 && extracted_mcu_data.hwmpy != 8)
 		  warning (0, "MCU %qs supports %s hardware multiply, "
 			   "but %<-mhwmult%> is set to f5series",
-			   target_mcu, hwmult_name (msp430_mcu_data[i].hwmpy));
+			   target_mcu, hwmult_name (extracted_mcu_data.hwmpy));
 	      }
-
 	    msp430x = xisa;
-	    break;
 	  }
-
-      if (i < 0)
+      else
 	{
 	  if (msp430_hwmult_type == MSP430_HWMULT_AUTO)
 	    {
@@ -3376,12 +2754,10 @@ msp430_use_f5_series_hwmult (void)
   if (strncasecmp (target_mcu, "msp430f6", 8) == 0)
     return cached_result = true;
 
-  int i;
+  msp430_extract_mcu_data (target_mcu);
 
-  /* FIXME: This array is alpha sorted - we could use a binary search.  */
-  for (i = ARRAY_SIZE (msp430_mcu_data); i--;)
-    if (strcasecmp (target_mcu, msp430_mcu_data[i].name) == 0)
-      return cached_result = msp430_mcu_data[i].hwmpy == 8;
+  if (extracted_mcu_data.name != NULL)
+    return cached_result = extracted_mcu_data.hwmpy == 8;
 
   return cached_result = false;
 }
@@ -3394,7 +2770,6 @@ use_32bit_hwmult (void)
 {
   static const char * cached_match = NULL;
   static bool         cached_result;
-  int i;
 
   if (msp430_hwmult_type == MSP430_HWMULT_LARGE)
     return true;
@@ -3407,10 +2782,9 @@ use_32bit_hwmult (void)
 
   cached_match = target_mcu;
 
-  /* FIXME: This array is alpha sorted - we could use a binary search.  */
-  for (i = ARRAY_SIZE (msp430_mcu_data); i--;)
-    if (strcasecmp (target_mcu, msp430_mcu_data[i].name) == 0)
-      return cached_result = msp430_mcu_data[i].hwmpy == 4;
+  msp430_extract_mcu_data (target_mcu);
+  if (extracted_mcu_data.name != NULL)
+    return cached_result = extracted_mcu_data.hwmpy == 4;
 
   return cached_result = false;
 }
@@ -3423,7 +2797,6 @@ msp430_no_hwmult (void)
 {
   static const char * cached_match = NULL;
   static bool         cached_result;
-  int i;
 
   if (msp430_hwmult_type == MSP430_HWMULT_NONE)
     return true;
@@ -3439,10 +2812,9 @@ msp430_no_hwmult (void)
 
   cached_match = target_mcu;
 
-  /* FIXME: This array is alpha sorted - we could use a binary search.  */
-  for (i = ARRAY_SIZE (msp430_mcu_data); i--;)
-    if (strcasecmp (target_mcu, msp430_mcu_data[i].name) == 0)
-      return cached_result = msp430_mcu_data[i].hwmpy == 0;
+  msp430_extract_mcu_data (target_mcu);
+  if (extracted_mcu_data.name != NULL)
+    return cached_result = extracted_mcu_data.hwmpy == 0;
 
   /* If we do not recognise the MCU name, we assume that it does not support
      any kind of hardware multiply - this is the safest assumption to make.  */
diff --git a/gcc/config/msp430/msp430.h b/gcc/config/msp430/msp430.h
index 33617718703..b080dfbaca1 100644
--- a/gcc/config/msp430/msp430.h
+++ b/gcc/config/msp430/msp430.h
@@ -53,7 +53,7 @@ extern bool msp430x;
   "%{minrt:%:if-exists(crtn-minrt.o%s)}%{!minrt:%:if-exists(crtn.o%s)} -lgcc"
 
 #define ASM_SPEC "-mP " /* Enable polymorphic instructions.  */ \
-  "%{mcpu=*:-mcpu=%*}%{!mcpu=*:%{mmcu=*:-mmcu=%*}} " /* Pass the CPU type on to the assembler.  */ \
+  "%{mcpu=*:-mcpu=%*} " /* Pass the CPU type on to the assembler.  */ \
   "%{mrelax=-mQ} " /* Pass the relax option on to the assembler.  */ \
   "%{mlarge:-ml} " /* Tell the assembler if we are building for the LARGE pointer model.  */ \
   "%{!msim:-md} %{msim:%{mlarge:-md}} " /* Copy data from ROM to RAM if necessary.  */ \
@@ -74,11 +74,15 @@ extern bool msp430x;
   " %{!mlarge:%{mcode-region=*:"	\
     "%e-mcode-region requires the large memory model (-mlarge)}}"	\
   " %{!mlarge:%{mdata-region=*:"	\
-    "%e-mdata-region requires the large memory model (-mlarge)}}"
+    "%e-mdata-region requires the large memory model (-mlarge)}}"	\
+  " %{!mcpu=*:%{mmcu=*:%:msp430_select_cpu(%{mmcu=*:%*})}}"
 
 extern const char * msp430_select_hwmult_lib (int, const char **);
+extern const char * msp430_select_cpu (int, const char **);
+
 # define EXTRA_SPEC_FUNCTIONS				\
-  { "msp430_hwmult_lib", msp430_select_hwmult_lib },
+  { "msp430_hwmult_lib", msp430_select_hwmult_lib },	\
+  { "msp430_select_cpu", msp430_select_cpu },
 
 /* Specify the libraries to include on the linker command line.
 
diff --git a/gcc/config/msp430/t-msp430 b/gcc/config/msp430/t-msp430
index edfdad7ed1a..b9565103e9a 100644
--- a/gcc/config/msp430/t-msp430
+++ b/gcc/config/msp430/t-msp430
@@ -22,6 +22,10 @@ driver-msp430.o: $(srcdir)/config/msp430/driver-msp430.c \
   $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H)
 	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $<
 
+msp430-devices.o: $(srcdir)/config/msp430/msp430-devices.c \
+	$(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H)
+	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $<
+
 # Enable multilibs:
 
 MULTILIB_OPTIONS    = mcpu=msp430 mlarge 
@@ -30,235 +34,9 @@ MULTILIB_DIRNAMES   = 430          large
 # Match -mcpu=430
 MULTILIB_MATCHES    = mcpu?msp430=mcpu?430
 
-# Match the known 430 ISA mcu names.
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430c091
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430c092
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430c111
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430c1111
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430c112
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430c1121
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430c1331
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430c1351
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430c311s
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430c312
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430c313
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430c314
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430c315
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430c323
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430c325
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430c412
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430c413
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430e112
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430e313
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430e315
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430e325
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f110
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f1101
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f1101a
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f1111
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f1111a
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f112
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f1121
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f1121a
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f1122
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f1132
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f122
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f1222
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f123
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f1232
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f133
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f135
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f155
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f156
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f157
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f2001
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f2002
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f2003
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f2011
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f2012
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f2013
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f2101
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f2111
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f2112
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f2121
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f2122
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f2131
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f2132
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f2232
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f2234
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f2252
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f2254
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f2272
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f2274
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f412
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f413
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f4132
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f415
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f4152
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f417
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f4250
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f4260
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f4270
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f435
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f4351
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f436
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f4361
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f437
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f4371
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f438
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f439
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f477
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f478
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f479
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430fe423
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430fe4232
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430fe423a
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430fe4242
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430fe425
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430fe4252
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430fe425a
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430fe427
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430fe4272
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430fe427a
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430fg4250
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430fg4260
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430fg4270
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430fg437
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430fg438
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430fg439
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430fg477
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430fg478
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430fg479
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430fw423
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430fw425
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430fw427
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430fw428
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430fw429
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2001
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2101
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2102
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2111
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2112
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2113
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2121
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2131
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2132
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2152
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2153
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2201
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2202
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2203
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2210
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2211
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2212
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2213
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2221
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2230
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2231
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2232
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2233
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2252
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2253
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2302
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2303
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2312
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2313
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2332
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2333
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2352
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2353
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2402
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2403
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2412
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2413
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2432
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2433
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2444
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2452
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2453
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2513
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2533
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2544
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2553
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2744
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2755
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2855
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430g2955
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430l092
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430p112
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430p313
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430p315
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430p315s
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430p325
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430tch5e
-MULTILIB_MATCHES += mcpu?msp430=mmcu?rf430frl152h
-MULTILIB_MATCHES += mcpu?msp430=mmcu?rf430frl152h_rom
-MULTILIB_MATCHES += mcpu?msp430=mmcu?rf430frl153h
-MULTILIB_MATCHES += mcpu?msp430=mmcu?rf430frl153h_rom
-MULTILIB_MATCHES += mcpu?msp430=mmcu?rf430frl154h
-MULTILIB_MATCHES += mcpu?msp430=mmcu?rf430frl154h_rom
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430c336
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430c337
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430e337
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f147
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f1471
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f148
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f1481
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f149
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f1491
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f1610
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f1611
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f1612
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f167
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f168
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f169
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f423
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f423a
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f425
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f425a
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f427
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f427a
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f447
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f448
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f4481
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f449
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f4491
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430p337
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430afe221
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430afe222
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430afe223
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430afe231
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430afe232
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430afe233
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430afe251
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430afe252
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430afe253
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f233
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f2330
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f235
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f2350
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f2370
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f2410
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f247
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f2471
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f248
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f2481
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f249
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f2491
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430i2020
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430i2021
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430i2030
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430i2031
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430i2040
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430i2041
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430i2xxgeneric
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f4783
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f4784
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f4793
-MULTILIB_MATCHES += mcpu?msp430=mmcu?msp430f4794
-
-# Add additional MCU matches like this:
-# MULTILIB_MATCHES += mcpu?msp430x=mmcu?xxxxxxxxxx
+# The correct multilib for a given mmcu is selected without the need for
+# hard-coded data here, because DRIVER_SELF_SPECS will place the correct
+# -mcpu option for a given mcu onto the command line.
 
 MULTILIB_EXCEPTIONS = mcpu=msp430/mlarge
 
diff --git a/gcc/testsuite/gcc.target/msp430/devices-main.c b/gcc/testsuite/gcc.target/msp430/devices-main.c
new file mode 100644
index 00000000000..20448f4f03d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/msp430/devices-main.c
@@ -0,0 +1,6 @@
+int
+main (void)
+{
+  while (1);
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.target/msp430/devices/README b/gcc/testsuite/gcc.target/msp430/devices/README
new file mode 100644
index 00000000000..8d8c8f26db8
--- /dev/null
+++ b/gcc/testsuite/gcc.target/msp430/devices/README
@@ -0,0 +1,12 @@
+Some tests in this directory are run in a msp430-specific "torture" style,
+where all target specific options (that change code generation) are each used
+on each test source file in turn.
+
+The criteria for this torture style of testing is:
+  - The source file has a .c suffix
+  - The source file is in this "devices" subdirectory of the msp430 tests
+  - Somewhere in the test file name matches the regex:
+    [a-z0-9]+430[a-z0-9_]+(?=\.c).
+
+Some of the options used to run the tests will produce warnings/errors for the
+mcus, so ensure the test has dg-warning and dg-error directives as appropriate.
diff --git a/gcc/testsuite/gcc.target/msp430/devices/hard-cc430f5123.c b/gcc/testsuite/gcc.target/msp430/devices/hard-cc430f5123.c
new file mode 100644
index 00000000000..15a4ae1a584
--- /dev/null
+++ b/gcc/testsuite/gcc.target/msp430/devices/hard-cc430f5123.c
@@ -0,0 +1,7 @@
+/* { dg-do compile } */
+/* { dg-options "-mmcu=cc430f5123" } */
+/* { dg-warning "supports 430X ISA but '-mcpu' option is set to 430" "" { target msp430_430_selected } 0 } */
+/* { dg-warning "supports 32-bit .5xx. hardware multiply" "" { target msp430_hwmul_not_f5 } 0 } */
+
+/* revision=2, hwmpy=8 */
+#include "../devices-main.c"
diff --git a/gcc/testsuite/gcc.target/msp430/devices/hard-foo.c b/gcc/testsuite/gcc.target/msp430/devices/hard-foo.c
new file mode 100644
index 00000000000..802b0413452
--- /dev/null
+++ b/gcc/testsuite/gcc.target/msp430/devices/hard-foo.c
@@ -0,0 +1,5 @@
+/* { dg-do compile } */
+/* { dg-options "-mmcu=msp430foo" } */
+/* { dg-warning "Unrecognized MCU name 'msp430foo'.*\n.*Use the" "" { target *-*-* } 0 } */
+
+#include "../devices-main.c"
diff --git a/gcc/testsuite/gcc.target/msp430/devices/hard-msp430afe253.c b/gcc/testsuite/gcc.target/msp430/devices/hard-msp430afe253.c
new file mode 100644
index 00000000000..9edf6eb02a7
--- /dev/null
+++ b/gcc/testsuite/gcc.target/msp430/devices/hard-msp430afe253.c
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+/* { dg-options "-mmcu=msp430afe253" } */
+/* { dg-warning "supports 16-bit hardware multiply" "" { target msp430_hwmul_not_16bit } 0 } */
+/* { dg-warning "supports 430 ISA but" "" { target msp430_430x_selected } 0 } */
+/* { dg-error "'-mlarge' requires a 430X-compatible '-mmcu='" "" { target msp430_mlarge_selected } 0 } */
+
+/* revision=0, hwmpy=2  */
+#include "../devices-main.c"
diff --git a/gcc/testsuite/gcc.target/msp430/devices/hard-msp430cg4616.c b/gcc/testsuite/gcc.target/msp430/devices/hard-msp430cg4616.c
new file mode 100644
index 00000000000..493d02258f2
--- /dev/null
+++ b/gcc/testsuite/gcc.target/msp430/devices/hard-msp430cg4616.c
@@ -0,0 +1,7 @@
+/* { dg-do compile } */
+/* { dg-options "-mmcu=msp430cg4616" } */
+/* { dg-warning "supports 430X ISA but '-mcpu' option is set to 430" "" { target msp430_430_selected } 0 } */
+/* { dg-warning "supports 16-bit hardware multiply" "" { target msp430_hwmul_not_16bit } 0 } */
+
+/* revision=1, hwmpy=1 */
+#include "../devices-main.c"
diff --git a/gcc/testsuite/gcc.target/msp430/devices/hard-msp430f4783.c b/gcc/testsuite/gcc.target/msp430/devices/hard-msp430f4783.c
new file mode 100644
index 00000000000..af918c3e516
--- /dev/null
+++ b/gcc/testsuite/gcc.target/msp430/devices/hard-msp430f4783.c
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+/* { dg-options "-mmcu=msp430f4783" } */
+/* { dg-warning "supports 32-bit hardware multiply" "" { target msp430_hwmul_not_32bit } 0 } */
+/* { dg-warning "supports 430 ISA but" "" { target msp430_430x_selected } 0 } */
+/* { dg-error "'-mlarge' requires a 430X-compatible '-mmcu='" "" { target msp430_mlarge_selected } 0 } */
+
+/* revision=0, hwmpy=4  */
+#include "../devices-main.c"
diff --git a/gcc/testsuite/gcc.target/msp430/devices/hard-rf430frl154h_rom.c b/gcc/testsuite/gcc.target/msp430/devices/hard-rf430frl154h_rom.c
new file mode 100644
index 00000000000..ad0c33d39b3
--- /dev/null
+++ b/gcc/testsuite/gcc.target/msp430/devices/hard-rf430frl154h_rom.c
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+/* { dg-options "-mmcu=rf430frl154h_rom" } */
+/* { dg-warning "does not have hardware multiply" "" { target msp430_hwmul_not_none } 0 } */
+/* { dg-warning "supports 430 ISA but" "" { target msp430_430x_selected } 0 } */
+/* { dg-error "'-mlarge' requires a 430X-compatible '-mmcu='" "" { target msp430_mlarge_selected } 0 } */
+
+/* revision=0, hwmpy=0  */
+#include "../devices-main.c"
diff --git a/gcc/testsuite/gcc.target/msp430/msp430.exp b/gcc/testsuite/gcc.target/msp430/msp430.exp
index 50620e9df3d..20bfc149bd7 100644
--- a/gcc/testsuite/gcc.target/msp430/msp430.exp
+++ b/gcc/testsuite/gcc.target/msp430/msp430.exp
@@ -18,7 +18,85 @@
 
 # Exit immediately if this isn't the right target.
 if { ![istarget msp430-*-*] } then {
-  return
+    return
+}
+
+# Below are msp430-specific effective target keywords, required for checking
+# device related warnings/errors
+proc check_effective_target_msp430_430_selected { } {
+    return [check-flags [list "" { *-*-* } { "-mcpu=msp430" } { "" } ]]
+}
+
+proc check_effective_target_msp430_430x_selected { } {
+    return [check-flags [list "" { *-*-* } \
+    { "-mcpu=msp430x" "-mcpu=msp430xv2" } { "" } ]]
+}
+
+proc check_effective_target_msp430_mlarge_selected { } {
+    return [check-flags [list "" { *-*-* } { "-mlarge" } { "" } ]]
+}
+
+proc check_effective_target_msp430_hwmul_not_none { } {
+    return [check-flags [list "" { *-*-* } \
+    { "-mhwmult=16bit" "-mhwmult=32bit" "-mhwmult=f5series" } { "" } ]]
+}
+
+proc check_effective_target_msp430_hwmul_not_16bit { } {
+    return [check-flags [list "" { *-*-* } \
+    { "-mhwmult=f5series" "-mhwmult=32bit" } { "" } ]]
+}
+
+proc check_effective_target_msp430_hwmul_not_32bit { } {
+    return [check-flags [list "" { *-*-* } \
+    { "-mhwmult=16bit" "-mhwmult=f5series" } { "" } ]]
+}
+
+proc check_effective_target_msp430_hwmul_not_f5 { } {
+    return [check-flags [list "" { *-*-* } \
+    { "-mhwmult=16bit" "-mhwmult=32bit" } { "" } ]]
+}
+
+# Return a list of msp430-specific options we can run the test with.
+# The mcu name is extracted from the file name, not from the -mmcu option
+# specified in the test file.
+proc msp430_get_opts { test_file } {
+    global board_info
+    # If the mcu name is not recognized, run the test as normal without
+    # additional options.
+    if { ![regexp {[a-z0-9]+430[a-z0-9_]+(?=\.c)} $test_file mcu_name] } {
+	return { "" }
+    }
+    # If the testsuite has been invoked with specific MSP430 options, don't run
+    # in this torture style.
+    set multi_flags [board_info [target_info name] multilib_flags]
+    if { [string match "*mlarge*" $multi_flags]
+	|| [string match "*msmall*" $multi_flags]
+	|| [string match "*mcpu*" $multi_flags]
+	|| [string match "*mmcu*" $multi_flags]
+	|| [string match "*mhwmult*" $multi_flags] } {
+	return { "" }
+    }
+    # Test all device related options. The compiler will warn about
+    # incompatibilities, so ensure dg-warning or dg-error directives are set up
+    # in the test sources.
+    return {"" -mhwmult=none -mhwmult=16bit -mhwmult=32bit -mhwmult=f5series \
+        -mcpu=msp430 -mcpu=msp430x -mcpu=msp430xv2 -mlarge}
+}
+
+# Run each test file in 'tests' with every possible value for -mcpu and
+# -mhwmult, and with -mlarge.
+proc msp430_device_permutations_runtest { tests } {
+    # The specific tests being run
+    global runtests
+    global MSP430_DEFAULT_CFLAGS
+    foreach { test_file } $tests {
+	if { ![runtest_file_p $runtests $test_file] } {
+	    continue
+	}
+	foreach { mcu_flags } [msp430_get_opts $test_file] {
+	    dg-runtest $test_file "$mcu_flags" "$MSP430_DEFAULT_CFLAGS"
+	}
+    }
 }
 
 # Load support procs.
@@ -42,5 +120,7 @@ dg-init
 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cCS\]]] \
 	"" $MSP430_DEFAULT_CFLAGS
 
+msp430_device_permutations_runtest [lsort [glob -nocomplain $srcdir/$subdir/devices/*.\[cCS\]]]
+
 # All done.
 dg-finish
-- 
2.17.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [MSP430][PATCH 2/2] Read MCU data from external file
  2019-08-08 12:17 [MSP430][PATCH 0/2] Improve and extend MCU data handling Jozef Lawrynowicz
  2019-08-08 12:24 ` [MSP430][PATCH 1/2] Consolidate handling of hard-coded MCU data Jozef Lawrynowicz
@ 2019-08-08 12:59 ` Jozef Lawrynowicz
  2019-08-12 22:01   ` Jeff Law
  1 sibling, 1 reply; 7+ messages in thread
From: Jozef Lawrynowicz @ 2019-08-08 12:59 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 621 bytes --]

This patch extends the MCU data handling so that MCU data can be provided
in an external file (devices.csv). This means the compiler doesn't have to be
updated and rebuilt to support new devices when they are released.

TI distribute devices.csv with other support files (header files, linker
scripts) on their website. I have also tested that a program builds successfully
for every MCU and the correct hwmult library is passed to the linker.
I also built the msp430 cross compiler using a trunk build of native GCC to
ensure all the error and warning messages added by my code are correct, as
checked by -Wformat-diag.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0002-MSP430-Devices-2-Read-MCU-data-from-external-devices.patch --]
[-- Type: text/x-patch, Size: 44385 bytes --]

From 6f67cdd282f2351d7450e343314beeaa745f0159 Mon Sep 17 00:00:00 2001
From: Jozef Lawrynowicz <jozef.l@mittosystems.com>
Date: Tue, 6 Aug 2019 10:52:54 +0100
Subject: [PATCH 2/2] MSP430: Devices [2]: Read MCU data from external
 devices.csv file, if it exists

gcc/ChangeLog:

2019-08-XX  Jozef Lawrynowicz  <jozef.l@mittosystems.com>

	* gcc/config/msp430/driver-msp430.c (msp430_set_driver_var): New.
	* gcc/config/msp430/msp430-devices.c (canonicalize_path_dirsep): New.
	(msp430_check_path_for_devices): New.
	(parse_devices_csv_1): New.
	(parse_devices_csv): New.
	(msp430_extract_mcu_data): Try to find devices.csv and search for the
	MCU data in devices.csv before using the hard-coded data.
	Warn if devices.csv isn't found and the MCU wasn't found in the
	hard-coded data either.
	* gcc/config/msp430/msp430.h (DRIVER_SELF_SPECS): Call
	msp430_set_driver_var for -mno-warn-devices-csv and -mdevices-csv-loc.
	Search for devices.csv on -I and -L paths.
	(EXTRA_SPEC_FUNCTIONS): Add msp430_check_path_for_devices and
	msp430_set_driver_var.
	* gcc/config/msp430/msp430.opt: Add -mwarn-devices-csv and
	-mdevices-csv-loc=.
	* gcc/doc/invoke.texi (-mmcu): Document that -I and -L paths are
	searched for devices.csv.
	(mwarn-devices-csv): Document option.

gcc/testsuite/ChangeLog:

2019-08-XX  Jozef Lawrynowicz  <jozef.l@mittosystems.com>

	* gcc.target/msp430/msp430.exp (msp430_device_permutations_runtest):
	Handle csv-* and bad-devices-* tests.
	* gcc.target/msp430/devices/README: Document how bad-devices-* tests
	work.
	* gcc.target/msp430/devices/bad-devices-1.c: New test.
	* gcc.target/msp430/devices/bad-devices-2.c: Likewise.
	* gcc.target/msp430/devices/bad-devices-3.c: Likewise.
	* gcc.target/msp430/devices/bad-devices-4.c: Likewise.
	* gcc.target/msp430/devices/bad-devices-5.c: Likewise.
	* gcc.target/msp430/devices/bad-devices-6.c: Likewise.
	* gcc.target/msp430/devices/csv-device-order.c: Likewise.
	* gcc.target/msp430/devices/csv-msp430_00.c: Likewise.
	* gcc.target/msp430/devices/csv-msp430_01.c: Likewise.
	* gcc.target/msp430/devices/csv-msp430_02.c: Likewise.
	* gcc.target/msp430/devices/csv-msp430_04.c: Likewise.
	* gcc.target/msp430/devices/csv-msp430_08.c: Likewise.
	* gcc.target/msp430/devices/csv-msp430_10.c: Likewise.
	* gcc.target/msp430/devices/csv-msp430_11.c: Likewise.
	* gcc.target/msp430/devices/csv-msp430_12.c: Likewise.
	* gcc.target/msp430/devices/csv-msp430_14.c: Likewise.
	* gcc.target/msp430/devices/csv-msp430_18.c: Likewise.
	* gcc.target/msp430/devices/csv-msp430_20.c: Likewise.
	* gcc.target/msp430/devices/csv-msp430_21.c: Likewise.
	* gcc.target/msp430/devices/csv-msp430_22.c: Likewise.
	* gcc.target/msp430/devices/csv-msp430_24.c: Likewise.
	* gcc.target/msp430/devices/csv-msp430_28.c: Likewise.
	* gcc.target/msp430/devices/csv-msp430fr5969.c: Likewise.
	* gcc.target/msp430/devices/hard-foo.c: Likewise.
	* gcc.target/msp430/devices/bad-devices-1.csv: New test support file.
	* gcc.target/msp430/devices/bad-devices-2.csv: Likewise.
	* gcc.target/msp430/devices/bad-devices-3.csv: Likewise.
	* gcc.target/msp430/devices/bad-devices-4.csv: Likewise.
	* gcc.target/msp430/devices/bad-devices-5.csv: Likewise.
	* gcc.target/msp430/devices/bad-devices-6.csv: Likewise.
	* gcc.target/msp430/devices/devices.csv: Likewise.
---
 gcc/config/msp430/driver-msp430.c             |  23 ++
 gcc/config/msp430/msp430-devices.c            | 276 +++++++++++++++++-
 gcc/config/msp430/msp430.h                    |  10 +-
 gcc/config/msp430/msp430.opt                  |   9 +
 gcc/doc/invoke.texi                           |  14 +-
 .../gcc.target/msp430/devices/README          |   5 +
 .../gcc.target/msp430/devices/bad-devices-1.c |   5 +
 .../msp430/devices/bad-devices-1.csv          |   3 +
 .../gcc.target/msp430/devices/bad-devices-2.c |   5 +
 .../msp430/devices/bad-devices-2.csv          |   3 +
 .../gcc.target/msp430/devices/bad-devices-3.c |   5 +
 .../msp430/devices/bad-devices-3.csv          |   3 +
 .../gcc.target/msp430/devices/bad-devices-4.c |   5 +
 .../msp430/devices/bad-devices-4.csv          |   3 +
 .../gcc.target/msp430/devices/bad-devices-5.c |   5 +
 .../msp430/devices/bad-devices-5.csv          |   3 +
 .../gcc.target/msp430/devices/bad-devices-6.c |   5 +
 .../msp430/devices/bad-devices-6.csv          |   3 +
 .../msp430/devices/csv-device-order.c         |  11 +
 .../gcc.target/msp430/devices/csv-msp430_00.c |   7 +
 .../gcc.target/msp430/devices/csv-msp430_01.c |   7 +
 .../gcc.target/msp430/devices/csv-msp430_02.c |   7 +
 .../gcc.target/msp430/devices/csv-msp430_04.c |   7 +
 .../gcc.target/msp430/devices/csv-msp430_08.c |   7 +
 .../gcc.target/msp430/devices/csv-msp430_10.c |   6 +
 .../gcc.target/msp430/devices/csv-msp430_11.c |   6 +
 .../gcc.target/msp430/devices/csv-msp430_12.c |   6 +
 .../gcc.target/msp430/devices/csv-msp430_14.c |   6 +
 .../gcc.target/msp430/devices/csv-msp430_18.c |   6 +
 .../gcc.target/msp430/devices/csv-msp430_20.c |   6 +
 .../gcc.target/msp430/devices/csv-msp430_21.c |   6 +
 .../gcc.target/msp430/devices/csv-msp430_22.c |   6 +
 .../gcc.target/msp430/devices/csv-msp430_24.c |   6 +
 .../gcc.target/msp430/devices/csv-msp430_28.c |   6 +
 .../msp430/devices/csv-msp430fr5969.c         |  11 +
 .../gcc.target/msp430/devices/devices.csv     |  22 ++
 .../gcc.target/msp430/devices/hard-foo.c      |   1 +
 gcc/testsuite/gcc.target/msp430/msp430.exp    |  16 +-
 38 files changed, 537 insertions(+), 4 deletions(-)
 create mode 100644 gcc/testsuite/gcc.target/msp430/devices/bad-devices-1.c
 create mode 100644 gcc/testsuite/gcc.target/msp430/devices/bad-devices-1.csv
 create mode 100644 gcc/testsuite/gcc.target/msp430/devices/bad-devices-2.c
 create mode 100644 gcc/testsuite/gcc.target/msp430/devices/bad-devices-2.csv
 create mode 100644 gcc/testsuite/gcc.target/msp430/devices/bad-devices-3.c
 create mode 100644 gcc/testsuite/gcc.target/msp430/devices/bad-devices-3.csv
 create mode 100644 gcc/testsuite/gcc.target/msp430/devices/bad-devices-4.c
 create mode 100644 gcc/testsuite/gcc.target/msp430/devices/bad-devices-4.csv
 create mode 100644 gcc/testsuite/gcc.target/msp430/devices/bad-devices-5.c
 create mode 100644 gcc/testsuite/gcc.target/msp430/devices/bad-devices-5.csv
 create mode 100644 gcc/testsuite/gcc.target/msp430/devices/bad-devices-6.c
 create mode 100644 gcc/testsuite/gcc.target/msp430/devices/bad-devices-6.csv
 create mode 100644 gcc/testsuite/gcc.target/msp430/devices/csv-device-order.c
 create mode 100644 gcc/testsuite/gcc.target/msp430/devices/csv-msp430_00.c
 create mode 100644 gcc/testsuite/gcc.target/msp430/devices/csv-msp430_01.c
 create mode 100644 gcc/testsuite/gcc.target/msp430/devices/csv-msp430_02.c
 create mode 100644 gcc/testsuite/gcc.target/msp430/devices/csv-msp430_04.c
 create mode 100644 gcc/testsuite/gcc.target/msp430/devices/csv-msp430_08.c
 create mode 100644 gcc/testsuite/gcc.target/msp430/devices/csv-msp430_10.c
 create mode 100644 gcc/testsuite/gcc.target/msp430/devices/csv-msp430_11.c
 create mode 100644 gcc/testsuite/gcc.target/msp430/devices/csv-msp430_12.c
 create mode 100644 gcc/testsuite/gcc.target/msp430/devices/csv-msp430_14.c
 create mode 100644 gcc/testsuite/gcc.target/msp430/devices/csv-msp430_18.c
 create mode 100644 gcc/testsuite/gcc.target/msp430/devices/csv-msp430_20.c
 create mode 100644 gcc/testsuite/gcc.target/msp430/devices/csv-msp430_21.c
 create mode 100644 gcc/testsuite/gcc.target/msp430/devices/csv-msp430_22.c
 create mode 100644 gcc/testsuite/gcc.target/msp430/devices/csv-msp430_24.c
 create mode 100644 gcc/testsuite/gcc.target/msp430/devices/csv-msp430_28.c
 create mode 100644 gcc/testsuite/gcc.target/msp430/devices/csv-msp430fr5969.c
 create mode 100644 gcc/testsuite/gcc.target/msp430/devices/devices.csv

diff --git a/gcc/config/msp430/driver-msp430.c b/gcc/config/msp430/driver-msp430.c
index 9ad05dca957..4fa70c6c2e1 100644
--- a/gcc/config/msp430/driver-msp430.c
+++ b/gcc/config/msp430/driver-msp430.c
@@ -54,6 +54,29 @@ msp430_select_cpu (int argc, const char ** argv)
   return NULL;
 }
 
+/* Spec function to set a global variable to a specific value in the driver.
+   The first argument is the variable name, and the second is the value to set
+   it to.
+   Currently only "msp430_warn_devices_csv" and "msp430_devices_csv_loc" are
+   supported.
+   The intention is that we can take a "Target" option and set the variable
+   associated with it in the driver as well.  Whilst the driver sees "Target"
+   options, it does not set the variables associated with that option.  */
+const char *
+msp430_set_driver_var (int argc, const char ** argv)
+{
+  if (argc != 2)
+    error ("%<msp430_set_driver_var%> expects 2 arguments");
+  else if (strcmp (argv[0], "msp430_warn_devices_csv") == 0)
+    msp430_warn_devices_csv = atoi (argv[1]);
+  else if (strcmp (argv[0], "msp430_devices_csv_loc") == 0)
+    msp430_devices_csv_loc = argv[1];
+  else
+    error ("unhandled arguments %qs and %qs to %<msp430_set_driver_var%>",
+	   argv[0], argv[1]);
+  return NULL;
+}
+
 /* Implement spec function `msp430_hwmult_lib´.  */
 
 const char *
diff --git a/gcc/config/msp430/msp430-devices.c b/gcc/config/msp430/msp430-devices.c
index c5faff80487..0488a0f197c 100644
--- a/gcc/config/msp430/msp430-devices.c
+++ b/gcc/config/msp430/msp430-devices.c
@@ -35,8 +35,254 @@ struct t_msp430_mcu_data extracted_mcu_data;
 /* Initialized at the bottom of this file.  */
 extern struct t_msp430_mcu_data hard_msp430_mcu_data[605];
 
+/* Set to the full path to devices.csv if it is found by searching the -I and
+   -L paths.  */
+char * derived_devices_csv_loc = NULL;
+
+/* This is to canonicalize the directory separators in the path.
+   On Windows we could have a mix of '/' and '\' in the path.  */
+static void
+canonicalize_path_dirsep (char **path)
+{
+  char *t_path = *path;
+  int len = strlen (t_path);
+  int i;
+  for (i = 0; i < len; i++)
+    if (IS_DIR_SEPARATOR (t_path[i]))
+      t_path[i] = DIR_SEPARATOR;
+}
+
+/* Spec function which searches the paths passed to the -I and -L options for
+   the "devices.csv" file.  If it is found then the -mdevices-csv-loc option is
+   placed on the command line so the compiler knows the location of the
+   file.  */
+const char *
+msp430_check_path_for_devices (int argc, const char **argv)
+{
+  const char dirsep[2] = { DIR_SEPARATOR, 0 };
+  FILE * devices_file = NULL;
+  char * local_devices_csv_loc = NULL;
+  int i;
+  /* msp430_devices_csv_loc is set by -mdevices-csv-loc, derived_devices_csv_loc
+     is set by this function only.  */
+  if (msp430_devices_csv_loc || derived_devices_csv_loc)
+    return NULL;
+  for (i = 0; i < argc; i++)
+    {
+      char *inc_path = ASTRDUP (argv[i]);
+      canonicalize_path_dirsep (&inc_path);
+      if (!IS_DIR_SEPARATOR (inc_path[strlen (inc_path) - 1]))
+	inc_path = concat (inc_path, dirsep, NULL);
+      local_devices_csv_loc = concat (inc_path, "devices.csv", NULL);
+      devices_file = fopen (local_devices_csv_loc, "r");
+      if (devices_file != NULL)
+	{
+	  fclose (devices_file);
+	  derived_devices_csv_loc = local_devices_csv_loc;
+	  return concat ("-mdevices-csv-loc=", local_devices_csv_loc, NULL);
+	}
+    }
+  return NULL;
+}
+
+/* Search the devices.csv file for the given MCU name, and load the device
+   data into extracted_mcu_data.
+   Return 1 if MCU wasn't found in devices.csv, or the data couldn't be loaded
+   into extracted_mcu_data.
+   devices.csv has a specific format.  There is a row for column headings which
+   begins with "# Device Name".  The column numbers for CPU_TYPE (MSP430 ISA)
+   and MPY_TYPE (hwmult support) are extracted from this row and used later to
+   extract the ISA and hwmult supported for the given device.
+   The rows containing the MCU data are expected to begin immediately after the
+   column headings.  */
+static int
+parse_devices_csv_1 (const char * real_devices_csv_loc, const char * mcu_name)
+{
+  FILE * devices_file = fopen (real_devices_csv_loc, "r");
+  /* Some devices have a large number of errata, which means that MPY_TYPE
+     isn't found until the ~100th character in the line.  line_buf_size is set
+     to 200 to account for further possible additions to errata.  */
+  const size_t line_buf_size = 200;
+  char line[line_buf_size];
+  char * res;
+  bool found_headings = false;
+  bool found_mcu = false;
+  int cpu_type = -1;
+  int mpy_type = -1;
+  int cpu_type_column = -1;
+  int mpy_type_column = -1;
+  const char * device_name_heading = "# Device Name";
+  const char * cpu_type_heading = "CPU_TYPE";
+  const char * mpy_type_heading = "MPY_TYPE";
+  /* devices_file should never be NULL at this stage.  */
+  if (devices_file == NULL)
+    {
+      if (msp430_warn_devices_csv)
+	warning (0, "unexpected error opening %<devices.csv%>");
+      return 1;
+    }
+  while (1)
+    {
+      res = fgets (line, line_buf_size, devices_file);
+      if (res == NULL)
+	{
+	  /* The device has not been found in devices.csv.  Don't warn now in
+	     case it is in the hard-coded data.  We will warn later if the
+	     device was not found in the hard-coded data either.  */
+	  goto end;
+	}
+      else if (!found_headings
+	       && strncmp (line, device_name_heading,
+			   strlen (device_name_heading)) == 0)
+	{
+	  int curr_column = 0;
+	  char * heading = strtok (line, ",");
+	  found_headings = true;
+	  /* Find which column MPY_TYPE and CPU_TYPE are in.  */
+	  while (heading != NULL)
+	    {
+	      if (strncmp (heading, cpu_type_heading,
+			   strlen (cpu_type_heading)) == 0)
+		  cpu_type_column = curr_column;
+	      else if (strncmp (heading, mpy_type_heading,
+			   strlen (mpy_type_heading)) == 0)
+		  mpy_type_column = curr_column;
+	      if (cpu_type_column != -1 && mpy_type_column != -1)
+		break;
+	      heading = strtok (NULL, ",");
+	      curr_column++;
+	    }
+	  if (cpu_type_column == -1 || mpy_type_column == -1)
+	    {
+	      if (msp430_warn_devices_csv)
+		{
+		  if (cpu_type_column == -1 && mpy_type_column != -1)
+		    warning (0, "%<CPU_TYPE%> column heading is missing from "
+			     "%<devices.csv%>");
+		  else if (mpy_type_column == -1 && cpu_type_column != -1)
+		    warning (0, "%<MPY_TYPE%> column heading is missing from "
+			     "%<devices.csv%>");
+		  else
+		    warning (0, "%<CPU_TYPE%> and %<MPY_TYPE%> column headings "
+			     "are missing from %<devices.csv%>");
+		}
+	      goto end;
+	    }
+	}
+      else if (strncasecmp (line, mcu_name, strlen (mcu_name)) == 0
+	       && *(line + strlen (mcu_name)) == ',')
+	{
+	  if (!found_headings)
+	    {
+	      if (msp430_warn_devices_csv)
+		warning (0, "format of column headings in %<devices.csv%> "
+			 "is incorrect");
+	      goto end;
+	    }
+	  char * val = strtok (line, ",");
+	  int final_col_num = ((mpy_type_column > cpu_type_column)
+			       ? mpy_type_column : cpu_type_column);
+	  int curr_col;
+	  bool found_cpu = false;
+	  bool found_mpy = false;
+	  for (curr_col = 0; curr_col <= final_col_num; curr_col++)
+	    {
+	      /* Strip any new line characters from the last token.  */
+	      if (curr_col == final_col_num && strlen (val) > 1
+		  /* ASCII digit 10 == LF, 13 == CR.  */
+		  && (val[1] == 10 || val[1] == 13))
+		{
+		  /* Terminate the string after the first character.  */
+		  val[1] = 0;
+		}
+	      if (curr_col == cpu_type_column)
+		{
+		  cpu_type = atoi (val);
+		  /* Only a single '0', '1' or '2' is accepted.  */
+		  if (strlen (val) != 1
+		      /* atoi will return 0 if the string passed as an argument
+			 is empty or contains only whitespace characters, so we
+			 must error if 0 is returned but the first character in
+			 the original string is not '0'.  */
+		      || (cpu_type == 0 && val[0] != '0')
+		      || cpu_type > 2 || cpu_type < 0)
+		    {
+		      if (msp430_warn_devices_csv)
+			warning (0, "invalid %<CPU_TYPE%> value of %qs read "
+				 "from %<devices.csv%> for %qs", val, mcu_name);
+		      goto end;
+		    }
+		  extracted_mcu_data.revision = cpu_type;
+		  found_cpu = true;
+		}
+	      else if (curr_col == mpy_type_column)
+		{
+		  mpy_type = atoi (val);
+		  /* Only a single '0', '1', '2', '4' or '8' is accepted.  */
+		  if (strlen (val) != 1
+		      || (mpy_type == 0 && val[0] != '0')
+		      || !(mpy_type == 0
+			   || mpy_type == 1
+			   || mpy_type == 2
+			   || mpy_type == 4
+			   || mpy_type == 8))
+		    {
+		      if (msp430_warn_devices_csv)
+			warning (0, "invalid %<MPY_TYPE%> value of %qs read "
+				 "from %<devices.csv%> for %qs", val, mcu_name);
+		      goto end;
+		    }
+		  extracted_mcu_data.hwmpy = mpy_type;
+		  found_mpy = true;
+		}
+	      if (found_cpu && found_mpy)
+		{
+		  extracted_mcu_data.name = mcu_name;
+		  found_mcu = true;
+		  goto end;
+		}
+	      val = strtok (NULL, ",");
+	    }
+	  if (msp430_warn_devices_csv && (cpu_type == -1 || mpy_type == -1))
+	    warning (0, "unknown error reading %s from "
+		     "%<devices.csv%>",
+		     (cpu_type != -1 ? "%<MPY_TYPE%>"
+		      : (mpy_type != -1 ? "%<CPU_TYPE%>"
+			 : "%<CPU_TYPE%> and %<MPY_TYPE%>")));
+	  goto end;
+	}
+    }
+end:
+  fclose (devices_file);
+  if (!found_mcu)
+    return 1;
+  return 0;
+}
+
+/* Wrapper for the parse_devices_csv_1 work function.
+   A return code of 0 indicates that the MCU data has been successfully
+   extracted into extracted_mcu_data.
+   A return code of 1 indicates that the specified MCU wasn't found in
+   devices.csv.
+   A return code of 2 indicates that devices.csv wasn't found at all.  */
+static int
+parse_devices_csv (const char * mcu_name)
+{
+  /* First check if the path to devices.csv was set by -mdevices-csv-loc.  */
+  if (msp430_devices_csv_loc != NULL)
+    return parse_devices_csv_1 (msp430_devices_csv_loc, mcu_name);
+  /* Otherwise check if the path to devices.csv was found another way.  */
+  else if (derived_devices_csv_loc != NULL)
+    return parse_devices_csv_1 (derived_devices_csv_loc, mcu_name);
+  /* devices.csv was not found.  */
+  return 2;
+}
+
 /* Main entry point to load the MCU data for the given -mmcu into
-   extracted_mcu_data.  hard_msp430_mcu_data (initialized at the bottom of this
+   extracted_mcu_data.
+   First, the "devices.csv" MCU data file is searched for, if it is found, and
+   the MCU has a record in it, then that data is used.
+   Otherwise, hard_msp430_mcu_data (initialized at the bottom of this
    file) is searched for the MCU name.
    This function only needs to be executed once, but it can be first called
    from a number of different locations.  */
@@ -44,10 +290,27 @@ void
 msp430_extract_mcu_data (const char * mcu_name)
 {
   static int executed = 0;
+  int devices_csv_not_found = 0;
   int i;
   if (mcu_name == NULL || executed == 1)
     return;
   executed = 1;
+  /* If parse_devices_csv returns non-zero we need to use the
+     hard-coded data.  */
+  switch (parse_devices_csv (mcu_name))
+    {
+    case 0:
+      return;
+    case 1:
+      /* MCU not found in devices.csv.  Warn later if it's not in the
+	 hard-coded data either.  */
+      break;
+    case 2:
+      devices_csv_not_found = 1;
+      break;
+    default:
+      gcc_unreachable ();
+    }
   /* FIXME: This array is alpha sorted - we could use a binary search.  */
   for (i = ARRAY_SIZE (hard_msp430_mcu_data); i--;)
     if (strcasecmp (mcu_name, hard_msp430_mcu_data[i].name) == 0)
@@ -82,6 +345,17 @@ msp430_extract_mcu_data (const char * mcu_name)
 		       hard_msp430_mcu_data[i].revision);
 	}
     }
+  else if (msp430_warn_devices_csv && devices_csv_not_found)
+    warning (0, "could not locate MCU data file %<devices.csv%>");
+  else if (msp430_warn_mcu && extracted_mcu_data.name == NULL)
+    {
+      /* FIXME: We should warn here that the MCU name is unrecognized, but
+	 msp430_option_override will warn about an unrecognized MCU as well.
+	 The benefit of warning here is that this is code common to both the
+	 driver and compiler proper, so a warning will be emitted when
+	 assembling/linking via the driver, whilst msp430_option_override will
+	 only be called when preprocessing or compiling.  */
+    }
 }
 
 /* The data in this structure has been extracted from version 1.194 of the
diff --git a/gcc/config/msp430/msp430.h b/gcc/config/msp430/msp430.h
index b080dfbaca1..f23a460251f 100644
--- a/gcc/config/msp430/msp430.h
+++ b/gcc/config/msp430/msp430.h
@@ -75,14 +75,22 @@ extern bool msp430x;
     "%e-mcode-region requires the large memory model (-mlarge)}}"	\
   " %{!mlarge:%{mdata-region=*:"	\
     "%e-mdata-region requires the large memory model (-mlarge)}}"	\
+  " %{mno-warn-devices-csv:%:msp430_set_driver_var(msp430_warn_devices_csv 0)}"\
+  " %{mdevices-csv-loc=*:%:msp430_set_driver_var(msp430_devices_csv_loc %*)}"\
+  " %{I*:%:msp430_check_path_for_devices(%{I*:%*})}"       \
+  " %{L*:%:msp430_check_path_for_devices(%{L*:%*})}"       \
   " %{!mcpu=*:%{mmcu=*:%:msp430_select_cpu(%{mmcu=*:%*})}}"
 
 extern const char * msp430_select_hwmult_lib (int, const char **);
 extern const char * msp430_select_cpu (int, const char **);
+extern const char * msp430_set_driver_var (int, const char **);
+extern const char * msp430_check_path_for_devices (int, const char **);
 
 # define EXTRA_SPEC_FUNCTIONS				\
   { "msp430_hwmult_lib", msp430_select_hwmult_lib },	\
-  { "msp430_select_cpu", msp430_select_cpu },
+  { "msp430_select_cpu", msp430_select_cpu },		\
+  { "msp430_set_driver_var", msp430_set_driver_var },		\
+  { "msp430_check_path_for_devices", msp430_check_path_for_devices },
 
 /* Specify the libraries to include on the linker command line.
 
diff --git a/gcc/config/msp430/msp430.opt b/gcc/config/msp430/msp430.opt
index c027201bacd..cbbe0faa6a2 100644
--- a/gcc/config/msp430/msp430.opt
+++ b/gcc/config/msp430/msp430.opt
@@ -14,6 +14,10 @@ mwarn-mcu
 Target Report Var(msp430_warn_mcu) Init(1)
 Warn if an MCU name is unrecognized or conflicts with other options (default: on).
 
+mwarn-devices-csv
+Target Report Var(msp430_warn_devices_csv) Init(1)
+Warn if devices.csv is not found or there are problem parsing it (default: on).
+
 mcpu=
 Target Report Joined RejectNegative Var(target_cpu)
 Specify the ISA to build for: msp430, msp430x, msp430xv2.
@@ -92,3 +96,8 @@ Passes on a request to the assembler to enable fixes for various silicon errata.
 msilicon-errata-warn=
 Target Joined RejectNegative Report ToLower
 Passes on a request to the assembler to warn about various silicon errata.
+
+mdevices-csv-loc=
+Target Joined Var(msp430_devices_csv_loc) RejectNegative Report
+The path to devices.csv.  The GCC driver can normally locate devices.csv itself
+and pass this option to the compiler, so the user shouldn't need to pass this.
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 01aab60f895..b3841aaeb11 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -23040,7 +23040,12 @@ command line.  The script's name is the name of the MCU with
 command line defines the C preprocessor symbol @code{__XXX__} and
 cause the linker to search for a script called @file{xxx.ld}.
 
-This option is also passed on to the assembler.
+The ISA and hardware multiply supported for the different MCUs is hard-coded
+into GCC.  However, an external @samp{devices.csv} file can be used to
+extend device support beyond those that have been hard-coded.
+
+GCC searches for the @samp{devices.csv} file on the paths specified
+with the @code{-I} and @code{-L} options.
 
 @item -mwarn-mcu
 @itemx -mno-warn-mcu
@@ -23129,6 +23134,13 @@ the named silicon errata.
 This option passes on a request to the assembler to enable warning
 messages when a silicon errata might need to be applied.
 
+@item -mwarn-devices-csv
+@itemx -mno-warn-devices-csv
+@opindex mwarn-devices-csv
+@opindex mno-warn-devices-csv
+Warn if @samp{devices.csv} is not found or there are problem parsing it
+(default: on).
+
 @end table
 
 @node NDS32 Options
diff --git a/gcc/testsuite/gcc.target/msp430/devices/README b/gcc/testsuite/gcc.target/msp430/devices/README
index 8d8c8f26db8..9134b4c4320 100644
--- a/gcc/testsuite/gcc.target/msp430/devices/README
+++ b/gcc/testsuite/gcc.target/msp430/devices/README
@@ -10,3 +10,8 @@ The criteria for this torture style of testing is:
 
 Some of the options used to run the tests will produce warnings/errors for the
 mcus, so ensure the test has dg-warning and dg-error directives as appropriate.
+
+The "bad-device-*.c" tests expect a corresponding "bad-devices-*.csv", which
+msp430.exp will pass as the argument to -mdevices-csv-loc=.  These tests are for
+checking the warnings in msp430-devices.c about a corrupted devices.csv work as
+expected.
diff --git a/gcc/testsuite/gcc.target/msp430/devices/bad-devices-1.c b/gcc/testsuite/gcc.target/msp430/devices/bad-devices-1.c
new file mode 100644
index 00000000000..29ef85968d5
--- /dev/null
+++ b/gcc/testsuite/gcc.target/msp430/devices/bad-devices-1.c
@@ -0,0 +1,5 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-mmcu=msp430_00 -mno-warn-mcu" } */
+/* { dg-warning "'CPU_TYPE' column heading is missing from 'devices.csv'" "" { target *-*-* } 0 } */
+
+#include "../devices-main.c"
diff --git a/gcc/testsuite/gcc.target/msp430/devices/bad-devices-1.csv b/gcc/testsuite/gcc.target/msp430/devices/bad-devices-1.csv
new file mode 100644
index 00000000000..282fa7bb292
--- /dev/null
+++ b/gcc/testsuite/gcc.target/msp430/devices/bad-devices-1.csv
@@ -0,0 +1,3 @@
+# Test warning for missing CPU_TYPE heading
+# Device Name,FOO,MPY_TYPE
+msp430_00,0,0
diff --git a/gcc/testsuite/gcc.target/msp430/devices/bad-devices-2.c b/gcc/testsuite/gcc.target/msp430/devices/bad-devices-2.c
new file mode 100644
index 00000000000..32e5cebd46e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/msp430/devices/bad-devices-2.c
@@ -0,0 +1,5 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-mmcu=msp430_00 -mno-warn-mcu" } */
+/* { dg-warning "'MPY_TYPE' column heading is missing from 'devices.csv'" "" { target *-*-* } 0 } */
+
+#include "../devices-main.c"
diff --git a/gcc/testsuite/gcc.target/msp430/devices/bad-devices-2.csv b/gcc/testsuite/gcc.target/msp430/devices/bad-devices-2.csv
new file mode 100644
index 00000000000..3bead68a85e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/msp430/devices/bad-devices-2.csv
@@ -0,0 +1,3 @@
+# Test warning for missing MPY_TYPE heading
+# Device Name,CPU_TYPE,FOO
+msp430_00,0,0
diff --git a/gcc/testsuite/gcc.target/msp430/devices/bad-devices-3.c b/gcc/testsuite/gcc.target/msp430/devices/bad-devices-3.c
new file mode 100644
index 00000000000..c982c4a7de5
--- /dev/null
+++ b/gcc/testsuite/gcc.target/msp430/devices/bad-devices-3.c
@@ -0,0 +1,5 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-mmcu=msp430_00 -mno-warn-mcu" } */
+/* { dg-warning "'CPU_TYPE' and 'MPY_TYPE' column headings are missing from 'devices.csv'" "" { target *-*-* } 0 } */
+
+#include "../devices-main.c"
diff --git a/gcc/testsuite/gcc.target/msp430/devices/bad-devices-3.csv b/gcc/testsuite/gcc.target/msp430/devices/bad-devices-3.csv
new file mode 100644
index 00000000000..63b203005bd
--- /dev/null
+++ b/gcc/testsuite/gcc.target/msp430/devices/bad-devices-3.csv
@@ -0,0 +1,3 @@
+# Test warning for missing CPU_TYPE and MPY_TYPE headings
+# Device Name,FOO,BAR
+msp430_00,0,0
diff --git a/gcc/testsuite/gcc.target/msp430/devices/bad-devices-4.c b/gcc/testsuite/gcc.target/msp430/devices/bad-devices-4.c
new file mode 100644
index 00000000000..89ebe61d179
--- /dev/null
+++ b/gcc/testsuite/gcc.target/msp430/devices/bad-devices-4.c
@@ -0,0 +1,5 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-mmcu=msp430_00 -mno-warn-mcu" } */
+/* { dg-warning "format of column headings in 'devices.csv' is incorrect" "" { target *-*-* } 0 } */
+
+#include "../devices-main.c"
diff --git a/gcc/testsuite/gcc.target/msp430/devices/bad-devices-4.csv b/gcc/testsuite/gcc.target/msp430/devices/bad-devices-4.csv
new file mode 100644
index 00000000000..4f25f93f288
--- /dev/null
+++ b/gcc/testsuite/gcc.target/msp430/devices/bad-devices-4.csv
@@ -0,0 +1,3 @@
+# Test incorrectly formatted column headings
+# DeviceName,CPU_TYPE,MPY_TYPE
+msp430_00,0,0
diff --git a/gcc/testsuite/gcc.target/msp430/devices/bad-devices-5.c b/gcc/testsuite/gcc.target/msp430/devices/bad-devices-5.c
new file mode 100644
index 00000000000..e33bac06b42
--- /dev/null
+++ b/gcc/testsuite/gcc.target/msp430/devices/bad-devices-5.c
@@ -0,0 +1,5 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-mmcu=msp430_00 -mno-warn-mcu" } */
+/* { dg-warning "invalid 'CPU_TYPE' value of '5' read from 'devices.csv' for 'msp430_00'" "" { target *-*-* } 0 } */
+
+#include "../devices-main.c"
diff --git a/gcc/testsuite/gcc.target/msp430/devices/bad-devices-5.csv b/gcc/testsuite/gcc.target/msp430/devices/bad-devices-5.csv
new file mode 100644
index 00000000000..32b70413a22
--- /dev/null
+++ b/gcc/testsuite/gcc.target/msp430/devices/bad-devices-5.csv
@@ -0,0 +1,3 @@
+# Test bad CPU_TYPE value
+# Device Name,CPU_TYPE,MPY_TYPE
+msp430_00,5,0
diff --git a/gcc/testsuite/gcc.target/msp430/devices/bad-devices-6.c b/gcc/testsuite/gcc.target/msp430/devices/bad-devices-6.c
new file mode 100644
index 00000000000..9dd9ed9e156
--- /dev/null
+++ b/gcc/testsuite/gcc.target/msp430/devices/bad-devices-6.c
@@ -0,0 +1,5 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-mmcu=msp430_00 -mno-warn-mcu" } */
+/* { dg-warning "invalid 'MPY_TYPE' value of '3' read from 'devices.csv' for 'msp430_00'" "" { target *-*-* } 0 } */
+
+#include "../devices-main.c"
diff --git a/gcc/testsuite/gcc.target/msp430/devices/bad-devices-6.csv b/gcc/testsuite/gcc.target/msp430/devices/bad-devices-6.csv
new file mode 100644
index 00000000000..0ec7152c475
--- /dev/null
+++ b/gcc/testsuite/gcc.target/msp430/devices/bad-devices-6.csv
@@ -0,0 +1,3 @@
+# Test bad MPY_TYPE value
+# Device Name,CPU_TYPE,MPY_TYPE
+msp430_00,0,3
diff --git a/gcc/testsuite/gcc.target/msp430/devices/csv-device-order.c b/gcc/testsuite/gcc.target/msp430/devices/csv-device-order.c
new file mode 100644
index 00000000000..172880321de
--- /dev/null
+++ b/gcc/testsuite/gcc.target/msp430/devices/csv-device-order.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-skip-if "MCU supports 430 ISA only" { *-*-* } { "-mlarge" "-mcpu=msp430x*" } { "" } } */
+/* { dg-additional-options "-mmcu=msp430f012 -mcpu=msp430 -mhwmult=16bit" } */
+
+/* Test that MCU names in devices.csv are only chosen if the full device name
+   is matched exactly.
+   msp430f0123 (with 430X ISA and f5series hwmult) appears before msp430f012 in
+   devices.csv, but should not be matched.
+   Errors and warnings will be emitted if msp430f0123 is wrongly matched.  */
+
+#include "../devices-main.c"
diff --git a/gcc/testsuite/gcc.target/msp430/devices/csv-msp430_00.c b/gcc/testsuite/gcc.target/msp430/devices/csv-msp430_00.c
new file mode 100644
index 00000000000..8d56873140e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/msp430/devices/csv-msp430_00.c
@@ -0,0 +1,7 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-mmcu=msp430_00" } */
+/* { dg-warning "does not have hardware multiply" "" { target msp430_hwmul_not_none } 0 } */
+/* { dg-warning "supports 430 ISA but" "" { target msp430_430x_selected } 0 } */
+/* { dg-error "'-mlarge' requires a 430X-compatible '-mmcu='" "" { target msp430_mlarge_selected } 0 } */
+
+#include "../devices-main.c"
diff --git a/gcc/testsuite/gcc.target/msp430/devices/csv-msp430_01.c b/gcc/testsuite/gcc.target/msp430/devices/csv-msp430_01.c
new file mode 100644
index 00000000000..154511b6fea
--- /dev/null
+++ b/gcc/testsuite/gcc.target/msp430/devices/csv-msp430_01.c
@@ -0,0 +1,7 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-mmcu=msp430_01" } */
+/* { dg-warning "supports 16-bit hardware multiply" "" { target msp430_hwmul_not_16bit } 0 } */
+/* { dg-warning "supports 430 ISA but" "" { target msp430_430x_selected } 0 } */
+/* { dg-error "'-mlarge' requires a 430X-compatible '-mmcu='" "" { target msp430_mlarge_selected } 0 } */
+
+#include "../devices-main.c"
diff --git a/gcc/testsuite/gcc.target/msp430/devices/csv-msp430_02.c b/gcc/testsuite/gcc.target/msp430/devices/csv-msp430_02.c
new file mode 100644
index 00000000000..4c721638903
--- /dev/null
+++ b/gcc/testsuite/gcc.target/msp430/devices/csv-msp430_02.c
@@ -0,0 +1,7 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-mmcu=msp430_02" } */
+/* { dg-warning "supports 16-bit hardware multiply" "" { target msp430_hwmul_not_16bit } 0 } */
+/* { dg-warning "supports 430 ISA but" "" { target msp430_430x_selected } 0 } */
+/* { dg-error "'-mlarge' requires a 430X-compatible '-mmcu='" "" { target msp430_mlarge_selected } 0 } */
+
+#include "../devices-main.c"
diff --git a/gcc/testsuite/gcc.target/msp430/devices/csv-msp430_04.c b/gcc/testsuite/gcc.target/msp430/devices/csv-msp430_04.c
new file mode 100644
index 00000000000..c8ed711eb1d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/msp430/devices/csv-msp430_04.c
@@ -0,0 +1,7 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-mmcu=msp430_04" } */
+/* { dg-warning "supports 32-bit hardware multiply" "" { target msp430_hwmul_not_32bit } 0 } */
+/* { dg-warning "supports 430 ISA but" "" { target msp430_430x_selected } 0 } */
+/* { dg-error "'-mlarge' requires a 430X-compatible '-mmcu='" "" { target msp430_mlarge_selected } 0 } */
+
+#include "../devices-main.c"
diff --git a/gcc/testsuite/gcc.target/msp430/devices/csv-msp430_08.c b/gcc/testsuite/gcc.target/msp430/devices/csv-msp430_08.c
new file mode 100644
index 00000000000..0214e636644
--- /dev/null
+++ b/gcc/testsuite/gcc.target/msp430/devices/csv-msp430_08.c
@@ -0,0 +1,7 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-mmcu=msp430_08" } */
+/* { dg-warning "supports 32-bit .5xx. hardware multiply" "" { target msp430_hwmul_not_f5 } 0 } */
+/* { dg-warning "supports 430 ISA but" "" { target msp430_430x_selected } 0 } */
+/* { dg-error "'-mlarge' requires a 430X-compatible '-mmcu='" "" { target msp430_mlarge_selected } 0 } */
+
+#include "../devices-main.c"
diff --git a/gcc/testsuite/gcc.target/msp430/devices/csv-msp430_10.c b/gcc/testsuite/gcc.target/msp430/devices/csv-msp430_10.c
new file mode 100644
index 00000000000..86f89ed51cf
--- /dev/null
+++ b/gcc/testsuite/gcc.target/msp430/devices/csv-msp430_10.c
@@ -0,0 +1,6 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-mmcu=msp430_10" } */
+/* { dg-warning "does not have hardware multiply" "" { target msp430_hwmul_not_none } 0 } */
+/* { dg-warning "supports 430X ISA but '-mcpu' option is set to 430" "" { target msp430_430_selected } 0 } */
+
+#include "../devices-main.c"
diff --git a/gcc/testsuite/gcc.target/msp430/devices/csv-msp430_11.c b/gcc/testsuite/gcc.target/msp430/devices/csv-msp430_11.c
new file mode 100644
index 00000000000..2923238e6b8
--- /dev/null
+++ b/gcc/testsuite/gcc.target/msp430/devices/csv-msp430_11.c
@@ -0,0 +1,6 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-mmcu=msp430_11" } */
+/* { dg-warning "supports 430X ISA but '-mcpu' option is set to 430" "" { target msp430_430_selected } 0 } */
+/* { dg-warning "supports 16-bit hardware multiply" "" { target msp430_hwmul_not_16bit } 0 } */
+
+#include "../devices-main.c"
diff --git a/gcc/testsuite/gcc.target/msp430/devices/csv-msp430_12.c b/gcc/testsuite/gcc.target/msp430/devices/csv-msp430_12.c
new file mode 100644
index 00000000000..ed59ac890c1
--- /dev/null
+++ b/gcc/testsuite/gcc.target/msp430/devices/csv-msp430_12.c
@@ -0,0 +1,6 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-mmcu=msp430_12" } */
+/* { dg-warning "supports 430X ISA but '-mcpu' option is set to 430" "" { target msp430_430_selected } 0 } */
+/* { dg-warning "supports 16-bit hardware multiply" "" { target msp430_hwmul_not_16bit } 0 } */
+
+#include "../devices-main.c"
diff --git a/gcc/testsuite/gcc.target/msp430/devices/csv-msp430_14.c b/gcc/testsuite/gcc.target/msp430/devices/csv-msp430_14.c
new file mode 100644
index 00000000000..fb038a0d30f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/msp430/devices/csv-msp430_14.c
@@ -0,0 +1,6 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-mmcu=msp430_14" } */
+/* { dg-warning "supports 430X ISA but '-mcpu' option is set to 430" "" { target msp430_430_selected } 0 } */
+/* { dg-warning "supports 32-bit hardware multiply" "" { target msp430_hwmul_not_32bit } 0 } */
+
+#include "../devices-main.c"
diff --git a/gcc/testsuite/gcc.target/msp430/devices/csv-msp430_18.c b/gcc/testsuite/gcc.target/msp430/devices/csv-msp430_18.c
new file mode 100644
index 00000000000..133f984d031
--- /dev/null
+++ b/gcc/testsuite/gcc.target/msp430/devices/csv-msp430_18.c
@@ -0,0 +1,6 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-mmcu=msp430_18" } */
+/* { dg-warning "supports 430X ISA but '-mcpu' option is set to 430" "" { target msp430_430_selected } 0 } */
+/* { dg-warning "supports 32-bit .5xx. hardware multiply" "" { target msp430_hwmul_not_f5 } 0 } */
+
+#include "../devices-main.c"
diff --git a/gcc/testsuite/gcc.target/msp430/devices/csv-msp430_20.c b/gcc/testsuite/gcc.target/msp430/devices/csv-msp430_20.c
new file mode 100644
index 00000000000..c7c94252b00
--- /dev/null
+++ b/gcc/testsuite/gcc.target/msp430/devices/csv-msp430_20.c
@@ -0,0 +1,6 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-mmcu=msp430_20" } */
+/* { dg-warning "does not have hardware multiply" "" { target msp430_hwmul_not_none } 0 } */
+/* { dg-warning "supports 430X ISA but '-mcpu' option is set to 430" "" { target msp430_430_selected } 0 } */
+
+#include "../devices-main.c"
diff --git a/gcc/testsuite/gcc.target/msp430/devices/csv-msp430_21.c b/gcc/testsuite/gcc.target/msp430/devices/csv-msp430_21.c
new file mode 100644
index 00000000000..8794f891db7
--- /dev/null
+++ b/gcc/testsuite/gcc.target/msp430/devices/csv-msp430_21.c
@@ -0,0 +1,6 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-mmcu=msp430_21" } */
+/* { dg-warning "supports 430X ISA but '-mcpu' option is set to 430" "" { target msp430_430_selected } 0 } */
+/* { dg-warning "supports 16-bit hardware multiply" "" { target msp430_hwmul_not_16bit } 0 } */
+
+#include "../devices-main.c"
diff --git a/gcc/testsuite/gcc.target/msp430/devices/csv-msp430_22.c b/gcc/testsuite/gcc.target/msp430/devices/csv-msp430_22.c
new file mode 100644
index 00000000000..47d90f4f730
--- /dev/null
+++ b/gcc/testsuite/gcc.target/msp430/devices/csv-msp430_22.c
@@ -0,0 +1,6 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-mmcu=msp430_22" } */
+/* { dg-warning "supports 430X ISA but '-mcpu' option is set to 430" "" { target msp430_430_selected } 0 } */
+/* { dg-warning "supports 16-bit hardware multiply" "" { target msp430_hwmul_not_16bit } 0 } */
+
+#include "../devices-main.c"
diff --git a/gcc/testsuite/gcc.target/msp430/devices/csv-msp430_24.c b/gcc/testsuite/gcc.target/msp430/devices/csv-msp430_24.c
new file mode 100644
index 00000000000..0a616307e86
--- /dev/null
+++ b/gcc/testsuite/gcc.target/msp430/devices/csv-msp430_24.c
@@ -0,0 +1,6 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-mmcu=msp430_24" } */
+/* { dg-warning "supports 430X ISA but '-mcpu' option is set to 430" "" { target msp430_430_selected } 0 } */
+/* { dg-warning "supports 32-bit hardware multiply" "" { target msp430_hwmul_not_32bit } 0 } */
+
+#include "../devices-main.c"
diff --git a/gcc/testsuite/gcc.target/msp430/devices/csv-msp430_28.c b/gcc/testsuite/gcc.target/msp430/devices/csv-msp430_28.c
new file mode 100644
index 00000000000..1243f7527e3
--- /dev/null
+++ b/gcc/testsuite/gcc.target/msp430/devices/csv-msp430_28.c
@@ -0,0 +1,6 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-mmcu=msp430_28" } */
+/* { dg-warning "supports 430X ISA but '-mcpu' option is set to 430" "" { target msp430_430_selected } 0 } */
+/* { dg-warning "supports 32-bit .5xx. hardware multiply" "" { target msp430_hwmul_not_f5 } 0 } */
+
+#include "../devices-main.c"
diff --git a/gcc/testsuite/gcc.target/msp430/devices/csv-msp430fr5969.c b/gcc/testsuite/gcc.target/msp430/devices/csv-msp430fr5969.c
new file mode 100644
index 00000000000..636460756ad
--- /dev/null
+++ b/gcc/testsuite/gcc.target/msp430/devices/csv-msp430fr5969.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-mmcu=msp430fr5969" } */
+/* MSP430FR5969 has msp430x ISA and f5series hwmult in the hard-coded data,
+   check that the different values for this device in devices.csv override it.
+   */
+/* { dg-warning "does not have hardware multiply" "" { target msp430_hwmul_not_none } 0 } */
+/* { dg-warning "supports 430 ISA but" "" { target msp430_430x_selected } 0 } */
+/* { dg-error "'-mlarge' requires a 430X-compatible '-mmcu='" "" { target msp430_mlarge_selected } 0 } */
+
+
+#include "../devices-main.c"
diff --git a/gcc/testsuite/gcc.target/msp430/devices/devices.csv b/gcc/testsuite/gcc.target/msp430/devices/devices.csv
new file mode 100644
index 00000000000..7a13ed9dac4
--- /dev/null
+++ b/gcc/testsuite/gcc.target/msp430/devices/devices.csv
@@ -0,0 +1,22 @@
+# Text before "#Device Name" is ignored.
+# We add arbitrary/empty fields in some records after the MPY_TYPE column to get
+# more varied testing.
+# Device Name,CPU_TYPE,MPY_TYPE
+msp430_00,0,0
+msp430_01,0,1,
+msp430_02,0,2,1
+msp430_04,0,4
+msp430_08,0,8,
+msp430_10,1,0,0,
+msp430_11,1,1
+msp430_12,1,2
+msp430_14,1,4,,
+msp430_18,1,8
+msp430_20,2,0
+msp430_21,2,1,4,
+msp430_22,2,2
+msp430_24,2,4
+msp430_28,2,8,100,
+msp430fr5969,0,0
+msp430f0123,2,8
+msp430f012,0,1
diff --git a/gcc/testsuite/gcc.target/msp430/devices/hard-foo.c b/gcc/testsuite/gcc.target/msp430/devices/hard-foo.c
index 802b0413452..e13acb52c50 100644
--- a/gcc/testsuite/gcc.target/msp430/devices/hard-foo.c
+++ b/gcc/testsuite/gcc.target/msp430/devices/hard-foo.c
@@ -1,5 +1,6 @@
 /* { dg-do compile } */
 /* { dg-options "-mmcu=msp430foo" } */
+/* { dg-warning "could not locate MCU data file 'devices.csv'" "" { target *-*-* } 0 } */
 /* { dg-warning "Unrecognized MCU name 'msp430foo'.*\n.*Use the" "" { target *-*-* } 0 } */
 
 #include "../devices-main.c"
diff --git a/gcc/testsuite/gcc.target/msp430/msp430.exp b/gcc/testsuite/gcc.target/msp430/msp430.exp
index 20bfc149bd7..b97f4dcdc16 100644
--- a/gcc/testsuite/gcc.target/msp430/msp430.exp
+++ b/gcc/testsuite/gcc.target/msp430/msp430.exp
@@ -94,7 +94,21 @@ proc msp430_device_permutations_runtest { tests } {
 	    continue
 	}
 	foreach { mcu_flags } [msp430_get_opts $test_file] {
-	    dg-runtest $test_file "$mcu_flags" "$MSP430_DEFAULT_CFLAGS"
+	    if { [string match "csv-*" [file tail $test_file]] } {
+		# Specify the path to devices.csv for devices/csv-* tests with -I.
+		# Note that the csv-* tests do not have dg-options directives,
+		# they only have dg-additional-options to pass -mmcu.  This is
+		# so we can set the path to devices.csv as a "default" flag
+		# with -I, and the path won't show up in the test results
+		# summary.  If there were dg-options directives, then these
+		# default flags passed as the 3rd argument to dg-runtest would
+		# not be used.
+		dg-runtest $test_file "$mcu_flags" "-I[file dirname $test_file] $MSP430_DEFAULT_CFLAGS"
+	    } elseif { [string match "bad-devices*" [file tail $test_file]] } {
+		dg-runtest $test_file "$mcu_flags" "-mdevices-csv-loc=[file dirname $test_file]/[file tail $test_file]sv $MSP430_DEFAULT_CFLAGS"
+	    } else {
+		dg-runtest $test_file "$mcu_flags" "$MSP430_DEFAULT_CFLAGS"
+	    }
 	}
     }
 }
-- 
2.17.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [MSP430][PATCH 1/2] Consolidate handling of hard-coded MCU data
  2019-08-08 12:24 ` [MSP430][PATCH 1/2] Consolidate handling of hard-coded MCU data Jozef Lawrynowicz
@ 2019-08-12 21:57   ` Jeff Law
  2019-08-13  9:34     ` Jozef Lawrynowicz
  0 siblings, 1 reply; 7+ messages in thread
From: Jeff Law @ 2019-08-12 21:57 UTC (permalink / raw)
  To: Jozef Lawrynowicz, gcc-patches

On 8/8/19 6:14 AM, Jozef Lawrynowicz wrote:
> This patch improves the handling of MCU data by consolidating multiple
> copies of hard-coded MCU data into a single location, and adds a new function
> to be used as a single entry point for the extraction of MCU data for the
> selected MCU.
> 
> This ensures the data is only extracted once per invocation of the
> driver/compiler, whilst previously, the data for the MCU is extracted each time
> it is needed.
> 
> Some notes:
> - The GNU assembler doesn't do anything with the -mmcu option beyond setting up
>   the CPU ISA, so if the GCC driver passes it the -mcpu option, which it will
>   always do if -mmcu is specified, then it is redundant to also pass it -mmcu.
> - The indenting in some places (e.g. msp430_select_hwmult_lib) looks wrong in
>   the patched file, but to make the diff a lot easier to read I have kept the
>   indenting the same as it was before. I can fix this after the patch is
>   accepted.
FWIW, another way to address the indentation issue is with the diff -b
option which says to ignore whitespace differences.

Regardless, yes, please clean up any indentation issues.


> 
> 
> 0001-MSP430-Devices-1-Consolidate-handling-of-hard-coded-.patch
> 
> From cd131b07e0447d104c99317e7ac37c2420c1bf6e Mon Sep 17 00:00:00 2001
> From: Jozef Lawrynowicz <jozef.l@mittosystems.com>
> Date: Wed, 31 Jul 2019 22:53:50 +0100
> Subject: [PATCH 1/2] MSP430: Devices [1]: Consolidate handling of hard-coded
>  MCU data
> 
> gcc/ChangeLog:
> 
> 2019-08-XX  Jozef Lawrynowicz  <jozef.l@mittosystems.com>
> 
> 	* gcc/config.gcc (msp430*-*-*): Add msp430-devices.o to extra_objs and
> 	extra_gcc_objs.
> 	* gcc/config/msp430/driver-msp430.c: Remove msp430_mcu_data.
> 	(msp430_select_cpu): New spec function.
> 	(msp430_select_hwmult_lib): Use msp430_extract_mcu_data to extract
> 	MCU data.
> 	* gcc/config/msp430/msp430-devices.c: New file.
> 	* gcc/config/msp430/msp430-devices.h: New file.
> 	* gcc/config/msp430/msp430.c: Remove msp430_mcu_data.
> 	(msp430_option_override): Use msp430_extract_mcu_data to extract
> 	MCU data.
> 	(msp430_use_f5_series_hwmult): Likewise.
> 	(use_32bit_hwmult): Likewise.
> 	(msp430_no_hwmult): Likewise.
> 	* gcc/config/msp430/msp430.h (ASM_SPEC): Don't pass -mmcu to the
> 	assembler.
> 	(DRIVER_SELF_SPECS): Call msp430_select_cpu if -mmcu is used without
> 	and -mcpu option.
> 	(EXTRA_SPEC_FUNCTIONS): Add msp430_select_cpu.
> 	* gcc/config/msp430/t-msp430: Add rule to build msp430-devices.o.
> 	Remove hard-coded MCU multilib data.
> 
> gcc/testsuite/ChangeLog:
> 
> 2019-08-XX  Jozef Lawrynowicz  <jozef.l@mittosystems.com>
> 
> 	* gcc.target/msp430/msp430.exp
> 	(check_effective_target_msp430_430_selected): New.
> 	(check_effective_target_msp430_430x_selected): New.
> 	(check_effective_target_msp430_mlarge_selected): New.
> 	(check_effective_target_msp430_hwmul_not_none): New.
> 	(check_effective_target_msp430_hwmul_not_16bit): New.
> 	(check_effective_target_msp430_hwmul_not_32bit): New.
> 	(check_effective_target_msp430_hwmul_not_f5): New.
> 	(msp430_get_opts): New.
> 	(msp430_device_permutations_runtest): New.
> 	* gcc.target/msp430/devices/README: New file.
> 	* gcc.target/msp430/devices-main.c: New test.
> 	* gcc.target/msp430/devices/hard-cc430f5123.c: Likewise.
> 	* gcc.target/msp430/devices/hard-foo.c: Likewise.
> 	* gcc.target/msp430/devices/hard-msp430afe253.c: Likewise.
> 	* gcc.target/msp430/devices/hard-msp430cg4616.c: Likewise.
> 	* gcc.target/msp430/devices/hard-msp430f4783.c: Likewise.
> 	* gcc.target/msp430/devices/hard-rf430frl154h_rom.c: Likewise.
Presumably we aren't supporting switching the selected mcu via
attributes on a per-function basis?

> +/* Main entry point to load the MCU data for the given -mmcu into
> +   extracted_mcu_data.  hard_msp430_mcu_data (initialized at the bottom of this
> +   file) is searched for the MCU name.
> +   This function only needs to be executed once, but it can be first called
> +   from a number of different locations.  */
> +void
> +msp430_extract_mcu_data (const char * mcu_name)
> +{
> +  static int executed = 0;
> +  int i;
> +  if (mcu_name == NULL || executed == 1)
> +    return;
> +  executed = 1;
> +  /* FIXME: This array is alpha sorted - we could use a binary search.  */
> +  for (i = ARRAY_SIZE (hard_msp430_mcu_data); i--;)
> +    if (strcasecmp (mcu_name, hard_msp430_mcu_data[i].name) == 0)
> +      {
> +	extracted_mcu_data = hard_msp430_mcu_data[i];
> +	break;
> +      }
I guess we only run this once, so the linear search isn't a serious
compile-time issue?

Assuming we don't care about switching the selected mcu within a
compilation unit, OK for the trunk.

jeff

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [MSP430][PATCH 2/2] Read MCU data from external file
  2019-08-08 12:59 ` [MSP430][PATCH 2/2] Read MCU data from external file Jozef Lawrynowicz
@ 2019-08-12 22:01   ` Jeff Law
  2019-08-13 10:19     ` Jozef Lawrynowicz
  0 siblings, 1 reply; 7+ messages in thread
From: Jeff Law @ 2019-08-12 22:01 UTC (permalink / raw)
  To: Jozef Lawrynowicz, gcc-patches

On 8/8/19 6:17 AM, Jozef Lawrynowicz wrote:
> This patch extends the MCU data handling so that MCU data can be provided
> in an external file (devices.csv). This means the compiler doesn't have to be
> updated and rebuilt to support new devices when they are released.
> 
> TI distribute devices.csv with other support files (header files, linker
> scripts) on their website. I have also tested that a program builds successfully
> for every MCU and the correct hwmult library is passed to the linker.
> I also built the msp430 cross compiler using a trunk build of native GCC to
> ensure all the error and warning messages added by my code are correct, as
> checked by -Wformat-diag.
> 
> 
> 0002-MSP430-Devices-2-Read-MCU-data-from-external-devices.patch
> 
> From 6f67cdd282f2351d7450e343314beeaa745f0159 Mon Sep 17 00:00:00 2001
> From: Jozef Lawrynowicz <jozef.l@mittosystems.com>
> Date: Tue, 6 Aug 2019 10:52:54 +0100
> Subject: [PATCH 2/2] MSP430: Devices [2]: Read MCU data from external
>  devices.csv file, if it exists
> 
> gcc/ChangeLog:
> 
> 2019-08-XX  Jozef Lawrynowicz  <jozef.l@mittosystems.com>
> 
> 	* gcc/config/msp430/driver-msp430.c (msp430_set_driver_var): New.
> 	* gcc/config/msp430/msp430-devices.c (canonicalize_path_dirsep): New.
> 	(msp430_check_path_for_devices): New.
> 	(parse_devices_csv_1): New.
> 	(parse_devices_csv): New.
> 	(msp430_extract_mcu_data): Try to find devices.csv and search for the
> 	MCU data in devices.csv before using the hard-coded data.
> 	Warn if devices.csv isn't found and the MCU wasn't found in the
> 	hard-coded data either.
> 	* gcc/config/msp430/msp430.h (DRIVER_SELF_SPECS): Call
> 	msp430_set_driver_var for -mno-warn-devices-csv and -mdevices-csv-loc.
> 	Search for devices.csv on -I and -L paths.
> 	(EXTRA_SPEC_FUNCTIONS): Add msp430_check_path_for_devices and
> 	msp430_set_driver_var.
> 	* gcc/config/msp430/msp430.opt: Add -mwarn-devices-csv and
> 	-mdevices-csv-loc=.
> 	* gcc/doc/invoke.texi (-mmcu): Document that -I and -L paths are
> 	searched for devices.csv.
> 	(mwarn-devices-csv): Document option.
> 
> gcc/testsuite/ChangeLog:
> 
> 2019-08-XX  Jozef Lawrynowicz  <jozef.l@mittosystems.com>
> 
> 	* gcc.target/msp430/msp430.exp (msp430_device_permutations_runtest):
> 	Handle csv-* and bad-devices-* tests.
> 	* gcc.target/msp430/devices/README: Document how bad-devices-* tests
> 	work.
> 	* gcc.target/msp430/devices/bad-devices-1.c: New test.
> 	* gcc.target/msp430/devices/bad-devices-2.c: Likewise.
> 	* gcc.target/msp430/devices/bad-devices-3.c: Likewise.
> 	* gcc.target/msp430/devices/bad-devices-4.c: Likewise.
> 	* gcc.target/msp430/devices/bad-devices-5.c: Likewise.
> 	* gcc.target/msp430/devices/bad-devices-6.c: Likewise.
> 	* gcc.target/msp430/devices/csv-device-order.c: Likewise.
> 	* gcc.target/msp430/devices/csv-msp430_00.c: Likewise.
> 	* gcc.target/msp430/devices/csv-msp430_01.c: Likewise.
> 	* gcc.target/msp430/devices/csv-msp430_02.c: Likewise.
> 	* gcc.target/msp430/devices/csv-msp430_04.c: Likewise.
> 	* gcc.target/msp430/devices/csv-msp430_08.c: Likewise.
> 	* gcc.target/msp430/devices/csv-msp430_10.c: Likewise.
> 	* gcc.target/msp430/devices/csv-msp430_11.c: Likewise.
> 	* gcc.target/msp430/devices/csv-msp430_12.c: Likewise.
> 	* gcc.target/msp430/devices/csv-msp430_14.c: Likewise.
> 	* gcc.target/msp430/devices/csv-msp430_18.c: Likewise.
> 	* gcc.target/msp430/devices/csv-msp430_20.c: Likewise.
> 	* gcc.target/msp430/devices/csv-msp430_21.c: Likewise.
> 	* gcc.target/msp430/devices/csv-msp430_22.c: Likewise.
> 	* gcc.target/msp430/devices/csv-msp430_24.c: Likewise.
> 	* gcc.target/msp430/devices/csv-msp430_28.c: Likewise.
> 	* gcc.target/msp430/devices/csv-msp430fr5969.c: Likewise.
> 	* gcc.target/msp430/devices/hard-foo.c: Likewise.
> 	* gcc.target/msp430/devices/bad-devices-1.csv: New test support file.
> 	* gcc.target/msp430/devices/bad-devices-2.csv: Likewise.
> 	* gcc.target/msp430/devices/bad-devices-3.csv: Likewise.
> 	* gcc.target/msp430/devices/bad-devices-4.csv: Likewise.
> 	* gcc.target/msp430/devices/bad-devices-5.csv: Likewise.
> 	* gcc.target/msp430/devices/bad-devices-6.csv: Likewise.
> 	* gcc.target/msp430/devices/devices.csv: Likewise.
> ---
So it's good we don't have to do updates when a new devices.csv is
released -- except when we devices require new multilibs, but I don't
offhand see a sensible way to deal with that.

OK.

jeff

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [MSP430][PATCH 1/2] Consolidate handling of hard-coded MCU data
  2019-08-12 21:57   ` Jeff Law
@ 2019-08-13  9:34     ` Jozef Lawrynowicz
  0 siblings, 0 replies; 7+ messages in thread
From: Jozef Lawrynowicz @ 2019-08-13  9:34 UTC (permalink / raw)
  To: Jeff Law; +Cc: gcc-patches

On Mon, 12 Aug 2019 14:30:06 -0600
Jeff Law <law@redhat.com> wrote:

> On 8/8/19 6:14 AM, Jozef Lawrynowicz wrote:
> > This patch improves the handling of MCU data by consolidating multiple
> > copies of hard-coded MCU data into a single location, and adds a new function
> > to be used as a single entry point for the extraction of MCU data for the
> > selected MCU.
> > 
> > This ensures the data is only extracted once per invocation of the
> > driver/compiler, whilst previously, the data for the MCU is extracted each time
> > it is needed.
> > 
> > Some notes:
> > - The GNU assembler doesn't do anything with the -mmcu option beyond setting up
> >   the CPU ISA, so if the GCC driver passes it the -mcpu option, which it will
> >   always do if -mmcu is specified, then it is redundant to also pass it -mmcu.
> > - The indenting in some places (e.g. msp430_select_hwmult_lib) looks wrong in
> >   the patched file, but to make the diff a lot easier to read I have kept the
> >   indenting the same as it was before. I can fix this after the patch is
> >   accepted.  
> FWIW, another way to address the indentation issue is with the diff -b
> option which says to ignore whitespace differences.

Ah right, thanks for the tip.

> 
> Regardless, yes, please clean up any indentation issues.
> 
> 
> > 
> > 
> > 0001-MSP430-Devices-1-Consolidate-handling-of-hard-coded-.patch
> > 
> > From cd131b07e0447d104c99317e7ac37c2420c1bf6e Mon Sep 17 00:00:00 2001
> > From: Jozef Lawrynowicz <jozef.l@mittosystems.com>
> > Date: Wed, 31 Jul 2019 22:53:50 +0100
> > Subject: [PATCH 1/2] MSP430: Devices [1]: Consolidate handling of hard-coded
> >  MCU data
> > 
> > gcc/ChangeLog:
> > 
> > 2019-08-XX  Jozef Lawrynowicz  <jozef.l@mittosystems.com>
> > 
> > 	* gcc/config.gcc (msp430*-*-*): Add msp430-devices.o to extra_objs and
> > 	extra_gcc_objs.
> > 	* gcc/config/msp430/driver-msp430.c: Remove msp430_mcu_data.
> > 	(msp430_select_cpu): New spec function.
> > 	(msp430_select_hwmult_lib): Use msp430_extract_mcu_data to extract
> > 	MCU data.
> > 	* gcc/config/msp430/msp430-devices.c: New file.
> > 	* gcc/config/msp430/msp430-devices.h: New file.
> > 	* gcc/config/msp430/msp430.c: Remove msp430_mcu_data.
> > 	(msp430_option_override): Use msp430_extract_mcu_data to extract
> > 	MCU data.
> > 	(msp430_use_f5_series_hwmult): Likewise.
> > 	(use_32bit_hwmult): Likewise.
> > 	(msp430_no_hwmult): Likewise.
> > 	* gcc/config/msp430/msp430.h (ASM_SPEC): Don't pass -mmcu to the
> > 	assembler.
> > 	(DRIVER_SELF_SPECS): Call msp430_select_cpu if -mmcu is used without
> > 	and -mcpu option.
> > 	(EXTRA_SPEC_FUNCTIONS): Add msp430_select_cpu.
> > 	* gcc/config/msp430/t-msp430: Add rule to build msp430-devices.o.
> > 	Remove hard-coded MCU multilib data.
> > 
> > gcc/testsuite/ChangeLog:
> > 
> > 2019-08-XX  Jozef Lawrynowicz  <jozef.l@mittosystems.com>
> > 
> > 	* gcc.target/msp430/msp430.exp
> > 	(check_effective_target_msp430_430_selected): New.
> > 	(check_effective_target_msp430_430x_selected): New.
> > 	(check_effective_target_msp430_mlarge_selected): New.
> > 	(check_effective_target_msp430_hwmul_not_none): New.
> > 	(check_effective_target_msp430_hwmul_not_16bit): New.
> > 	(check_effective_target_msp430_hwmul_not_32bit): New.
> > 	(check_effective_target_msp430_hwmul_not_f5): New.
> > 	(msp430_get_opts): New.
> > 	(msp430_device_permutations_runtest): New.
> > 	* gcc.target/msp430/devices/README: New file.
> > 	* gcc.target/msp430/devices-main.c: New test.
> > 	* gcc.target/msp430/devices/hard-cc430f5123.c: Likewise.
> > 	* gcc.target/msp430/devices/hard-foo.c: Likewise.
> > 	* gcc.target/msp430/devices/hard-msp430afe253.c: Likewise.
> > 	* gcc.target/msp430/devices/hard-msp430cg4616.c: Likewise.
> > 	* gcc.target/msp430/devices/hard-msp430f4783.c: Likewise.
> > 	* gcc.target/msp430/devices/hard-rf430frl154h_rom.c: Likewise.  
> Presumably we aren't supporting switching the selected mcu via
> attributes on a per-function basis?

No that's not supported at the moment.

Given that 430X devices support 430 and 430X ISA instructions, I suppose this is
something that could be added in the future. Similar to (but not as
complicated as), ARM arm/thumb interworking.
 
> 
> > +/* Main entry point to load the MCU data for the given -mmcu into
> > +   extracted_mcu_data.  hard_msp430_mcu_data (initialized at the bottom of this
> > +   file) is searched for the MCU name.
> > +   This function only needs to be executed once, but it can be first called
> > +   from a number of different locations.  */
> > +void
> > +msp430_extract_mcu_data (const char * mcu_name)
> > +{
> > +  static int executed = 0;
> > +  int i;
> > +  if (mcu_name == NULL || executed == 1)
> > +    return;
> > +  executed = 1;
> > +  /* FIXME: This array is alpha sorted - we could use a binary search.  */
> > +  for (i = ARRAY_SIZE (hard_msp430_mcu_data); i--;)
> > +    if (strcasecmp (mcu_name, hard_msp430_mcu_data[i].name) == 0)
> > +      {
> > +	extracted_mcu_data = hard_msp430_mcu_data[i];
> > +	break;
> > +      }  
> I guess we only run this once, so the linear search isn't a serious
> compile-time issue?

True, this is an old FIXME from the original port, but since we are now only
searching this array a maximum of one time now, it's not important.

> 
> Assuming we don't care about switching the selected mcu within a
> compilation unit, OK for the trunk.
> 
> jeff

Great, thanks for the review,
Jozef

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [MSP430][PATCH 2/2] Read MCU data from external file
  2019-08-12 22:01   ` Jeff Law
@ 2019-08-13 10:19     ` Jozef Lawrynowicz
  0 siblings, 0 replies; 7+ messages in thread
From: Jozef Lawrynowicz @ 2019-08-13 10:19 UTC (permalink / raw)
  To: Jeff Law; +Cc: gcc-patches

On Mon, 12 Aug 2019 14:34:39 -0600
Jeff Law <law@redhat.com> wrote:

> On 8/8/19 6:17 AM, Jozef Lawrynowicz wrote:
> > This patch extends the MCU data handling so that MCU data can be provided
> > in an external file (devices.csv). This means the compiler doesn't have to be
> > updated and rebuilt to support new devices when they are released.
> > 
> > TI distribute devices.csv with other support files (header files, linker
> > scripts) on their website. I have also tested that a program builds successfully
> > for every MCU and the correct hwmult library is passed to the linker.
> > I also built the msp430 cross compiler using a trunk build of native GCC to
> > ensure all the error and warning messages added by my code are correct, as
> > checked by -Wformat-diag.
> > 
> > 
> > 0002-MSP430-Devices-2-Read-MCU-data-from-external-devices.patch
> > 
> > From 6f67cdd282f2351d7450e343314beeaa745f0159 Mon Sep 17 00:00:00 2001
> > From: Jozef Lawrynowicz <jozef.l@mittosystems.com>
> > Date: Tue, 6 Aug 2019 10:52:54 +0100
> > Subject: [PATCH 2/2] MSP430: Devices [2]: Read MCU data from external
> >  devices.csv file, if it exists
> > 
> > gcc/ChangeLog:
> > 
> > 2019-08-XX  Jozef Lawrynowicz  <jozef.l@mittosystems.com>
> > 
> > 	* gcc/config/msp430/driver-msp430.c (msp430_set_driver_var): New.
> > 	* gcc/config/msp430/msp430-devices.c (canonicalize_path_dirsep): New.
> > 	(msp430_check_path_for_devices): New.
> > 	(parse_devices_csv_1): New.
> > 	(parse_devices_csv): New.
> > 	(msp430_extract_mcu_data): Try to find devices.csv and search for the
> > 	MCU data in devices.csv before using the hard-coded data.
> > 	Warn if devices.csv isn't found and the MCU wasn't found in the
> > 	hard-coded data either.
> > 	* gcc/config/msp430/msp430.h (DRIVER_SELF_SPECS): Call
> > 	msp430_set_driver_var for -mno-warn-devices-csv and -mdevices-csv-loc.
> > 	Search for devices.csv on -I and -L paths.
> > 	(EXTRA_SPEC_FUNCTIONS): Add msp430_check_path_for_devices and
> > 	msp430_set_driver_var.
> > 	* gcc/config/msp430/msp430.opt: Add -mwarn-devices-csv and
> > 	-mdevices-csv-loc=.
> > 	* gcc/doc/invoke.texi (-mmcu): Document that -I and -L paths are
> > 	searched for devices.csv.
> > 	(mwarn-devices-csv): Document option.
> > 
> > gcc/testsuite/ChangeLog:
> > 
> > 2019-08-XX  Jozef Lawrynowicz  <jozef.l@mittosystems.com>
> > 
> > 	* gcc.target/msp430/msp430.exp (msp430_device_permutations_runtest):
> > 	Handle csv-* and bad-devices-* tests.
> > 	* gcc.target/msp430/devices/README: Document how bad-devices-* tests
> > 	work.
> > 	* gcc.target/msp430/devices/bad-devices-1.c: New test.
> > 	* gcc.target/msp430/devices/bad-devices-2.c: Likewise.
> > 	* gcc.target/msp430/devices/bad-devices-3.c: Likewise.
> > 	* gcc.target/msp430/devices/bad-devices-4.c: Likewise.
> > 	* gcc.target/msp430/devices/bad-devices-5.c: Likewise.
> > 	* gcc.target/msp430/devices/bad-devices-6.c: Likewise.
> > 	* gcc.target/msp430/devices/csv-device-order.c: Likewise.
> > 	* gcc.target/msp430/devices/csv-msp430_00.c: Likewise.
> > 	* gcc.target/msp430/devices/csv-msp430_01.c: Likewise.
> > 	* gcc.target/msp430/devices/csv-msp430_02.c: Likewise.
> > 	* gcc.target/msp430/devices/csv-msp430_04.c: Likewise.
> > 	* gcc.target/msp430/devices/csv-msp430_08.c: Likewise.
> > 	* gcc.target/msp430/devices/csv-msp430_10.c: Likewise.
> > 	* gcc.target/msp430/devices/csv-msp430_11.c: Likewise.
> > 	* gcc.target/msp430/devices/csv-msp430_12.c: Likewise.
> > 	* gcc.target/msp430/devices/csv-msp430_14.c: Likewise.
> > 	* gcc.target/msp430/devices/csv-msp430_18.c: Likewise.
> > 	* gcc.target/msp430/devices/csv-msp430_20.c: Likewise.
> > 	* gcc.target/msp430/devices/csv-msp430_21.c: Likewise.
> > 	* gcc.target/msp430/devices/csv-msp430_22.c: Likewise.
> > 	* gcc.target/msp430/devices/csv-msp430_24.c: Likewise.
> > 	* gcc.target/msp430/devices/csv-msp430_28.c: Likewise.
> > 	* gcc.target/msp430/devices/csv-msp430fr5969.c: Likewise.
> > 	* gcc.target/msp430/devices/hard-foo.c: Likewise.
> > 	* gcc.target/msp430/devices/bad-devices-1.csv: New test support file.
> > 	* gcc.target/msp430/devices/bad-devices-2.csv: Likewise.
> > 	* gcc.target/msp430/devices/bad-devices-3.csv: Likewise.
> > 	* gcc.target/msp430/devices/bad-devices-4.csv: Likewise.
> > 	* gcc.target/msp430/devices/bad-devices-5.csv: Likewise.
> > 	* gcc.target/msp430/devices/bad-devices-6.csv: Likewise.
> > 	* gcc.target/msp430/devices/devices.csv: Likewise.
> > ---  
> So it's good we don't have to do updates when a new devices.csv is
> released -- except when we devices require new multilibs, but I don't
> offhand see a sensible way to deal with that.

For a given device, the only choice to make regarding multilibs at the moment
is whether to use a 430 or 430X multilib. The large memory model multilib will
only be used if a user passes -mlarge for a 430X device.
So if a device is added which uses a new extension to the ISA (which is not
forward-compatible) and therefore needs a new multilib, we would need to update
the compiler to handle code generation for the extension anyway.

In case it wasn't clear, the hardware multiply support (which is the other
piece of data we get from devices.csv for a device) is not handled using
multilibs. Instead, the driver tells the linker which hardware multiply library
to use, of which there is only one per possible hardware multiply option.

Thanks,
Jozef
> 
> OK.
> 
> jeff

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-08-13  9:56 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-08 12:17 [MSP430][PATCH 0/2] Improve and extend MCU data handling Jozef Lawrynowicz
2019-08-08 12:24 ` [MSP430][PATCH 1/2] Consolidate handling of hard-coded MCU data Jozef Lawrynowicz
2019-08-12 21:57   ` Jeff Law
2019-08-13  9:34     ` Jozef Lawrynowicz
2019-08-08 12:59 ` [MSP430][PATCH 2/2] Read MCU data from external file Jozef Lawrynowicz
2019-08-12 22:01   ` Jeff Law
2019-08-13 10:19     ` Jozef Lawrynowicz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).