From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4789 invoked by alias); 16 Feb 2014 14:26:52 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 4778 invoked by uid 89); 16 Feb 2014 14:26:51 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.6 required=5.0 tests=AWL,BAYES_00,SPF_NEUTRAL autolearn=no version=3.3.2 X-HELO: asav4.altibox.net Received: from asav4.altibox.net (HELO asav4.altibox.net) (81.167.36.153) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Sun, 16 Feb 2014 14:26:48 +0000 Received: from localhost (localhost [127.0.0.1]) by asav4.altibox.net (Postfix) with ESMTP id A890820154; Sun, 16 Feb 2014 15:26:44 +0100 (CET) Received: from asav4.altibox.net ([127.0.0.1]) by localhost (asav4.ulh.lysetele.net [127.0.0.1]) (amavisd-new, port 10024) with LMTP id ZHta2kvFDDum; Sun, 16 Feb 2014 15:26:43 +0100 (CET) Received: from zebra.redhouse.homelinux.net (121.79-160-103.customer.lyse.net [79.160.103.121]) by asav4.altibox.net (Postfix) with ESMTP id 66C0720105; Sun, 16 Feb 2014 15:26:42 +0100 (CET) Received: from [192.168.4.160] (lion [192.168.4.160]) by zebra.redhouse.homelinux.net (Postfix) with ESMTP id 1A9DD3232; Sun, 16 Feb 2014 15:26:42 +0100 (CET) Message-ID: <5300CAA2.7090208@hesbynett.no> Date: Sun, 16 Feb 2014 14:26:00 -0000 From: David Brown User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: DJ Delorie , brian@shapes.demon.co.uk CC: gcc@gcc.gnu.org Subject: Re: MSP430 in gcc4.9 ... enable interrupts? References: <1392372773.17088.27.camel@Gannet.Four> <201402141917.s1EJHb0H008351@greed.delorie.com> In-Reply-To: <201402141917.s1EJHb0H008351@greed.delorie.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2014-02/txt/msg00243.txt.bz2 On 14/02/14 20:17, DJ Delorie wrote: > The constructs in the *.md files are for the compiler's internal use > (i.e. there are function attributes that trigger those). You don't > need compiler support for these opcodes at the user level; the right > way is to implement those builtins as inline assembler in a common > header file: > > static inline __attribute__((always_inline)) > void __nop() > { > asm volatile ("NOP"); > } > > static inline __attribute__((always_inline)) > void __eint() > { > asm volatile ("EINT"); > } > > > Or more simply: > > #define __eint() asm("EINT") > #define __nop() asm("NOP") > > > For opcodes with parameters, you use a more complex form of inline > assembler: > > static inline __attribute__((always_inline)) > void BIC_SR(const int x) > { > asm volatile ("BIC.W %0,R2" :: "i" (x)); > } > I presume these will be part of the headers for the library distributed for msp430 gcc by TI/Redhat? (I know that's a bit off-topic for the gcc list, but it is relevant to msp430 gcc users who don't want to have to learn inline assembly.) I certainly think that's the right way to handle this sort of thing - if it can be just as efficiently put in headers using inline assembly, then maintenance is easier than putting it into gcc itself. When you say that the interrupt control in the compiler is for function attributes, is that for the "critical" attribute that exists in the old msp430 port (which disables interrupts for the duration of the function)? I don't see it mentioned in the current gcc documentation, but I haven't tried the code itself. It was certainly a nice idea - and one that I would love to see supported on a range of gcc ports rather than just the msp430. David