BSP430  20141115
Board Support Package for MSP430 microcontrollers
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Bootstrapping a New Platform: Blink

The second bootstrap program confirms that you can control LEDs.

main.c

/* We're going to use LEDs so we need the interface file */
/* We want to know the nominal clock speed so we can delay. */
#include <bsp430/clock.h>
void main ()
{
int led = 0;
/* First thing you do in main is configure the platform.
* Note that this configures the LEDs. */
while (1) {
/* A common complaint is that "blink doesn't work!" when the issue
* is that the watchdog is resetting the board. Don't let that
* happen to you. */
if (1 < nBSP430led) {
/* If there are multiple LEDs, turn each LED on in turn, wait a
* half second, then turn it off and move to the next LED. If
* there's only one LED, the invert state handles the on as well
* as the off. */
vBSP430ledSet(led, 1);
}
/* -1 means "invert state", which in this case will turn it off */
vBSP430ledSet(led, -1);
if (++led == nBSP430led) {
led = 0;
}
}
}

bsp430_config.h

/* Specify that we want the LED feature. Not strictly necessary,
* since this defaults to true. */
#define configBSP430_LED 1
/* Get the rest of the default configuration */

Makefile

PLATFORM ?= exp430fr5739
MODULES=$(MODULES_PLATFORM)
SRC=main.c
include $(BSP430_ROOT)/make/Makefile.common