MSP430 in gcc4.9 ... enable interrupts?

DJ Delorie dj@redhat.com
Fri Feb 14 19:17:00 GMT 2014


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));
}



More information about the Gcc mailing list