From patchwork Mon Jun 4 15:57:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jozef Lawrynowicz X-Patchwork-Id: 925136 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-479032-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=mittosystems.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="kfb+ppj5"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41002457dGz9s08 for ; Tue, 5 Jun 2018 01:57:31 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to:cc :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=eDnZydiw6RDoJ3H6BfoL1LB62gPnUCplEc5cyTP1WGlwlK3JCa MuHuDFuBn7naXcWZUuY/Z+YlUZWgw4myRakMr+RCei1R23vQVe7ZAp/rfhsLqQDP eWazO0wYFleeI3dupNgb+n1M0AqVBbGN+heG6VkTJQC6jKfZsTFuTlWgA= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to:cc :from:subject:message-id:date:mime-version:content-type; s= default; bh=JHaVzvRMXV1I+WkpKt+pLQiN11w=; b=kfb+ppj5QCeUEY55g972 mzQIt301TA5bmRcApI1L9OinjZ+ICznaVxlXPQlCLloVmr1pCCBfoaZMs1CbyZAy kV759N4UXUNjs1rIt8ZYxNfEZANKOOjXNVg8x0YtaMTAqiBVIcGrNAr0sMt41tAZ 68DEL0GQO1S4CR4YCOYcPKQ= Received: (qmail 53021 invoked by alias); 4 Jun 2018 15:57:24 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 51466 invoked by uid 89); 4 Jun 2018 15:57:24 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=devices X-HELO: mail-wm0-f53.google.com Received: from mail-wm0-f53.google.com (HELO mail-wm0-f53.google.com) (74.125.82.53) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 04 Jun 2018 15:57:22 +0000 Received: by mail-wm0-f53.google.com with SMTP id p126-v6so6628040wmb.2 for ; Mon, 04 Jun 2018 08:57:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:cc:from:subject:message-id:date:user-agent :mime-version:content-language; bh=eWgZBGE/0RK4y/eztmDlEXeSpbbhV/UAHN9Jn0tzuCU=; b=lHH+CX2FurQPIlhXoVondjKq8ai+ac5dUptPPAYdWvQkvKUzjLM+0+Nn4F7wdimWkz lZjimUJH/z2+iUbWpwz8iwR0USXp5Aw7I4iten0UluBCqxUBJtDZ9lSZr1NH4Xd8hIGZ Pwxn6YTAwb2FpepHHwUt2Sc8b0GEYL5IhHDW0jlcKQCZk754F6h7s1dV0e+k5rn/EJC7 T8t/QyqpVLIRMNzMx9AgYTnO1EEP6Teg/zfJchjMGvxNOrogx80pbffMf34cxwxCEAo8 NN7gFrwB+2z0w+KcTbXh3mKTM7u95QldCLI+BLX9HognehVkFQLVvFyFjMDnls1Y3HnI +13Q== X-Gm-Message-State: ALKqPwcblmFglmIcOcjh84M5+Y9XHKU2ylzefBFYHhPqoxTV3jL2VZZm 43pGyjKKLQwDUltp83a+ysk3tw== X-Google-Smtp-Source: ADUXVKJsE3PgG4BzwW1b+Tstn84wiPuTfuo4hiyfVYGpbOe/zK3sKTn/gpdkg4ctOdQgCj+bKFIAgQ== X-Received: by 2002:a1c:eacd:: with SMTP id g74-v6mr8832595wmi.103.1528127840825; Mon, 04 Jun 2018 08:57:20 -0700 (PDT) Received: from ?IPv6:2a00:23c5:e05:e600:ed90:6252:67b8:806c? ([2a00:23c5:e05:e600:ed90:6252:67b8:806c]) by smtp.gmail.com with ESMTPSA id h65-v6sm680957wmf.7.2018.06.04.08.57.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 Jun 2018 08:57:19 -0700 (PDT) To: gcc-patches@gcc.gnu.org Cc: DJ Delorie , Nick Clifton From: Jozef Lawrynowicz Subject: [PATCH] [MSP430] Fix device name symbol defined for MSP430i series of devices Message-ID: Date: Mon, 4 Jun 2018 16:57:19 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 X-IsSubscribed: yes In the GCC board support package distributed by TI for msp430 devices, the preprocessor symbol definition for the MSP430i series of devices expected by the msp430.h header file differs from the standard template. For other devices, the expected symbol has all characters in upper case, but for the MSP430i devices, the 'i' must be lower case. TI can't change the format of the symbol expected in msp430.h in the BSP, so this work around is needed to ensure the -mmcu option works for MSP430i* devices. Ok for trunk? From 6ceb89b2955472b83d1cd1734231b46188e0c9bf Mon Sep 17 00:00:00 2001 From: Jozef Lawrynowicz Date: Mon, 4 Jun 2018 12:04:54 +0100 Subject: [PATCH] MSP430: Fix device name symbol defined for msp430i* devices 2018-06-04 Jozef Lawrynowicz * 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. * msp430.h: New test header file. --- gcc/config/msp430/msp430.c | 16 ++++++++++++---- gcc/testsuite/gcc.target/msp430/msp430.h | 6 ++++++ gcc/testsuite/gcc.target/msp430/msp430i-device-symbol.c | 4 ++++ 3 files changed, 22 insertions(+), 4 deletions(-) create mode 100644 gcc/testsuite/gcc.target/msp430/msp430.h create mode 100644 gcc/testsuite/gcc.target/msp430/msp430i-device-symbol.c diff --git a/gcc/config/msp430/msp430.c b/gcc/config/msp430/msp430.c index a8fed12..c8ca58d 100644 --- a/gcc/config/msp430/msp430.c +++ b/gcc/config/msp430/msp430.c @@ -725,11 +725,19 @@ msp430_mcu_name (void) if (target_mcu) { unsigned int i; - static char mcu_name [64]; + static char mcu_name[64]; - snprintf (mcu_name, sizeof (mcu_name) - 1, "__%s__", target_mcu); - for (i = strlen (mcu_name); i--;) - mcu_name[i] = TOUPPER (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); + else + { + snprintf (mcu_name, sizeof (mcu_name) - 1, "__%s__", target_mcu); + for (i = strlen (mcu_name); i--;) + mcu_name[i] = TOUPPER (mcu_name[i]); + } return mcu_name; } diff --git a/gcc/testsuite/gcc.target/msp430/msp430.h b/gcc/testsuite/gcc.target/msp430/msp430.h new file mode 100644 index 0000000..ee44f6b --- /dev/null +++ b/gcc/testsuite/gcc.target/msp430/msp430.h @@ -0,0 +1,6 @@ +#if defined (__MSP430i2020__) + +#else +#error "Device not supported by msp430.h" + +#endif diff --git a/gcc/testsuite/gcc.target/msp430/msp430i-device-symbol.c b/gcc/testsuite/gcc.target/msp430/msp430i-device-symbol.c new file mode 100644 index 0000000..36a86c1 --- /dev/null +++ b/gcc/testsuite/gcc.target/msp430/msp430i-device-symbol.c @@ -0,0 +1,4 @@ +/* { dg-do preprocess } */ +/* { dg-skip-if "" { "*-*-*" } { "-mlarge" "-mcpu=msp430x*" "-mmcu=*" "-mhwmult=32bit" "-mhwmult=f5series" } { "" } } */ +/* { dg-options "-mmcu=msp430i2020" } */ +#include "msp430.h" -- 2.7.4