Commit d5c94995 by Jozef Lawrynowicz Committed by Jozef Lawrynowicz

MSP430: Read MCU data from external file

gcc/ChangeLog:

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

	* config/msp430/driver-msp430.c (msp430_set_driver_var): New.
	* 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.
	* 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.
	* config/msp430/msp430.opt: Add -mwarn-devices-csv and
	-mdevices-csv-loc=.
	* 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-13  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.

From-SVN: r274373
parent 1044fa32
2019-08-13 Jozef Lawrynowicz <jozef.l@mittosystems.com>
* config/msp430/driver-msp430.c (msp430_set_driver_var): New.
* 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.
* 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.
* config/msp430/msp430.opt: Add -mwarn-devices-csv and
-mdevices-csv-loc=.
* doc/invoke.texi (-mmcu): Document that -I and -L paths are
searched for devices.csv.
(mwarn-devices-csv): Document option.
2019-08-13 Richard Sandiford <richard.sandiford@arm.com> 2019-08-13 Richard Sandiford <richard.sandiford@arm.com>
* config/aarch64/aarch64-protos.h (aarch64_output_ptrue): Delete. * config/aarch64/aarch64-protos.h (aarch64_output_ptrue): Delete.
...@@ -25,26 +47,26 @@ ...@@ -25,26 +47,26 @@
2019-08-13 Jozef Lawrynowicz <jozef.l@mittosystems.com> 2019-08-13 Jozef Lawrynowicz <jozef.l@mittosystems.com>
* gcc/config.gcc (msp430*-*-*): Add msp430-devices.o to extra_objs and * config.gcc (msp430*-*-*): Add msp430-devices.o to extra_objs and
extra_gcc_objs. extra_gcc_objs.
* gcc/config/msp430/driver-msp430.c: Remove msp430_mcu_data. * config/msp430/driver-msp430.c: Remove msp430_mcu_data.
(msp430_select_cpu): New spec function. (msp430_select_cpu): New spec function.
(msp430_select_hwmult_lib): Use msp430_extract_mcu_data to extract (msp430_select_hwmult_lib): Use msp430_extract_mcu_data to extract
MCU data. MCU data.
* gcc/config/msp430/msp430-devices.c: New file. * config/msp430/msp430-devices.c: New file.
* gcc/config/msp430/msp430-devices.h: New file. * config/msp430/msp430-devices.h: New file.
* gcc/config/msp430/msp430.c: Remove msp430_mcu_data. * config/msp430/msp430.c: Remove msp430_mcu_data.
(msp430_option_override): Use msp430_extract_mcu_data to extract (msp430_option_override): Use msp430_extract_mcu_data to extract
MCU data. MCU data.
(msp430_use_f5_series_hwmult): Likewise. (msp430_use_f5_series_hwmult): Likewise.
(use_32bit_hwmult): Likewise. (use_32bit_hwmult): Likewise.
(msp430_no_hwmult): Likewise. (msp430_no_hwmult): Likewise.
* gcc/config/msp430/msp430.h (ASM_SPEC): Don't pass -mmcu to the * config/msp430/msp430.h (ASM_SPEC): Don't pass -mmcu to the
assembler. assembler.
(DRIVER_SELF_SPECS): Call msp430_select_cpu if -mmcu is used without (DRIVER_SELF_SPECS): Call msp430_select_cpu if -mmcu is used without
and -mcpu option. and -mcpu option.
(EXTRA_SPEC_FUNCTIONS): Add msp430_select_cpu. (EXTRA_SPEC_FUNCTIONS): Add msp430_select_cpu.
* gcc/config/msp430/t-msp430: Add rule to build msp430-devices.o. * config/msp430/t-msp430: Add rule to build msp430-devices.o.
Remove hard-coded MCU multilib data. Remove hard-coded MCU multilib data.
2019-08-13 Richard Sandiford <richard.sandiford@arm.com> 2019-08-13 Richard Sandiford <richard.sandiford@arm.com>
......
...@@ -54,6 +54,29 @@ msp430_select_cpu (int argc, const char ** argv) ...@@ -54,6 +54,29 @@ msp430_select_cpu (int argc, const char ** argv)
return NULL; 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´. */ /* Implement spec function `msp430_hwmult_lib´. */
const char * const char *
......
...@@ -75,14 +75,22 @@ extern bool msp430x; ...@@ -75,14 +75,22 @@ extern bool msp430x;
"%e-mcode-region requires the large memory model (-mlarge)}}" \ "%e-mcode-region requires the large memory model (-mlarge)}}" \
" %{!mlarge:%{mdata-region=*:" \ " %{!mlarge:%{mdata-region=*:" \
"%e-mdata-region requires the large memory model (-mlarge)}}" \ "%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=*:%*})}}" " %{!mcpu=*:%{mmcu=*:%:msp430_select_cpu(%{mmcu=*:%*})}}"
extern const char * msp430_select_hwmult_lib (int, const char **); extern const char * msp430_select_hwmult_lib (int, const char **);
extern const char * msp430_select_cpu (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 \ # define EXTRA_SPEC_FUNCTIONS \
{ "msp430_hwmult_lib", msp430_select_hwmult_lib }, \ { "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. /* Specify the libraries to include on the linker command line.
......
...@@ -14,6 +14,10 @@ mwarn-mcu ...@@ -14,6 +14,10 @@ mwarn-mcu
Target Report Var(msp430_warn_mcu) Init(1) Target Report Var(msp430_warn_mcu) Init(1)
Warn if an MCU name is unrecognized or conflicts with other options (default: on). 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= mcpu=
Target Report Joined RejectNegative Var(target_cpu) Target Report Joined RejectNegative Var(target_cpu)
Specify the ISA to build for: msp430, msp430x, msp430xv2. 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. ...@@ -92,3 +96,8 @@ Passes on a request to the assembler to enable fixes for various silicon errata.
msilicon-errata-warn= msilicon-errata-warn=
Target Joined RejectNegative Report ToLower Target Joined RejectNegative Report ToLower
Passes on a request to the assembler to warn about various silicon errata. 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.
...@@ -23044,7 +23044,12 @@ command line. The script's name is the name of the MCU with ...@@ -23044,7 +23044,12 @@ command line. The script's name is the name of the MCU with
command line defines the C preprocessor symbol @code{__XXX__} and command line defines the C preprocessor symbol @code{__XXX__} and
cause the linker to search for a script called @file{xxx.ld}. 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 @item -mwarn-mcu
@itemx -mno-warn-mcu @itemx -mno-warn-mcu
...@@ -23133,6 +23138,13 @@ the named silicon errata. ...@@ -23133,6 +23138,13 @@ the named silicon errata.
This option passes on a request to the assembler to enable warning This option passes on a request to the assembler to enable warning
messages when a silicon errata might need to be applied. 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 @end table
@node NDS32 Options @node NDS32 Options
2019-08-13 Jozef Lawrynowicz <jozef.l@mittosystems.com> 2019-08-13 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.
2019-08-13 Jozef Lawrynowicz <jozef.l@mittosystems.com>
* gcc.target/msp430/msp430.exp * gcc.target/msp430/msp430.exp
(check_effective_target_msp430_430_selected): New. (check_effective_target_msp430_430_selected): New.
(check_effective_target_msp430_430x_selected): New. (check_effective_target_msp430_430x_selected): New.
......
...@@ -10,3 +10,8 @@ The criteria for this torture style of testing is: ...@@ -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 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. 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.
/* { 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"
# Test warning for missing CPU_TYPE heading
# Device Name,FOO,MPY_TYPE
msp430_00,0,0
/* { 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"
# Test warning for missing MPY_TYPE heading
# Device Name,CPU_TYPE,FOO
msp430_00,0,0
/* { 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"
# Test warning for missing CPU_TYPE and MPY_TYPE headings
# Device Name,FOO,BAR
msp430_00,0,0
/* { 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"
# Test incorrectly formatted column headings
# DeviceName,CPU_TYPE,MPY_TYPE
msp430_00,0,0
/* { 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"
# Test bad CPU_TYPE value
# Device Name,CPU_TYPE,MPY_TYPE
msp430_00,5,0
/* { 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"
# Test bad MPY_TYPE value
# Device Name,CPU_TYPE,MPY_TYPE
msp430_00,0,3
/* { 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"
/* { 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"
/* { 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"
/* { 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"
/* { 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"
/* { 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"
/* { 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"
/* { 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"
/* { 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"
/* { 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"
/* { 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"
/* { 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"
/* { 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"
/* { 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"
/* { 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"
/* { 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"
/* { 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"
# 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
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-mmcu=msp430foo" } */ /* { 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 } */ /* { dg-warning "Unrecognized MCU name 'msp430foo'.*\n.*Use the" "" { target *-*-* } 0 } */
#include "../devices-main.c" #include "../devices-main.c"
...@@ -94,7 +94,21 @@ proc msp430_device_permutations_runtest { tests } { ...@@ -94,7 +94,21 @@ proc msp430_device_permutations_runtest { tests } {
continue continue
} }
foreach { mcu_flags } [msp430_get_opts $test_file] { 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"
}
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment