On Mon, 12 Aug 2019 14:34:39 -0600 Jeff Law <l...@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 <joze...@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 <joze...@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 <joze...@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