aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/msp430
diff options
context:
space:
mode:
authorJozef Lawrynowicz <jozef.l@mittosystems.com>2018-06-07 10:09:42 +0000
committerJozef Lawrynowicz <jozefl@gcc.gnu.org>2018-06-07 10:09:42 +0000
commitcef87b05f2114ffc9aad85610eee0ec434ee5703 (patch)
treed41e4d46d4c7708788d981135907aa3f2d63ef77 /gcc/config/msp430
parentfa8ce18938339c8d5b54d6d7428800efe3229510 (diff)
downloadgcc-cef87b05f2114ffc9aad85610eee0ec434ee5703.zip
gcc-cef87b05f2114ffc9aad85610eee0ec434ee5703.tar.gz
gcc-cef87b05f2114ffc9aad85610eee0ec434ee5703.tar.bz2
msp430.c (msp430_mcu_name): Set the "i" in the symbol defined for msp430i* devices to be lower case.
* gcc/config/msp430/msp430.c (msp430_mcu_name): Set the "i" in the symbol defined for msp430i* devices to be lower case. gcc/testsuite/gcc.target/msp430/ * msp430i-device-symbol.c: New test. * msp430f-device-symbol.c: New test. * msp430.h: New test header file. From-SVN: r261268
Diffstat (limited to 'gcc/config/msp430')
-rw-r--r--gcc/config/msp430/msp430.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/gcc/config/msp430/msp430.c b/gcc/config/msp430/msp430.c
index 9051761..685bdc8 100644
--- a/gcc/config/msp430/msp430.c
+++ b/gcc/config/msp430/msp430.c
@@ -725,10 +725,25 @@ msp430_mcu_name (void)
if (target_mcu)
{
unsigned int i;
- static char mcu_name [64];
+ unsigned int start_upper;
+ unsigned int end_upper;
+ static char mcu_name[64];
- snprintf (mcu_name, sizeof (mcu_name) - 1, "__%s__", target_mcu);
- for (i = strlen (mcu_name); i--;)
+ /* The 'i' in the device name symbol for msp430i* devices must be lower
+ case, to match the expected symbol in msp430.h. */
+ if (strncmp (target_mcu, "msp430i", 7) == 0)
+ {
+ snprintf (mcu_name, sizeof (mcu_name) - 1, "__MSP430i%s__",
+ target_mcu + 7);
+ start_upper = 9;
+ }
+ else
+ {
+ snprintf (mcu_name, sizeof (mcu_name) - 1, "__%s__", target_mcu);
+ start_upper = 2;
+ }
+ end_upper = strlen (mcu_name) - 2;
+ for (i = start_upper; i < end_upper; i++)
mcu_name[i] = TOUPPER (mcu_name[i]);
return mcu_name;
}