Skip to content

Instantly share code, notes, and snippets.

@uberscientist
Last active August 29, 2015 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save uberscientist/baa627f9779d2d08ca87 to your computer and use it in GitHub Desktop.
Save uberscientist/baa627f9779d2d08ca87 to your computer and use it in GitHub Desktop.
msp430-elf-gcc ISR format

The error:

main.c: In function 'Timer_A':
main.c:150:28: error: MSP430 builtin functions only work inside interrupt handlers
   __bic_SR_register_on_exit(CPUOFF);      // Clear CPUOFF bit from 0(SR)
                            ^
makefile:23: recipe for target 'main.o' failed

Here's the code:

// TimerA interrupt
__attribute__((__interrupt__(TIMERA0_VECTOR)))
Timer_A (void)
{
  iflag |= BIT0; // Set BIT0 flag
  __bic_SR_register_on_exit(CPUOFF);      // Clear CPUOFF bit from 0(SR)
}

Is this a bug?

I found slaa294a (http://www.ti.com/general/docs/litabsmultiplefilelist.tsp?literatureNumber=slaa294a) last night and have been trying to follow their code flow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment