- Create a directory for your
project, and copy one of the example project makefiles into the project
directory.
- Open the copied makefile and set
the variable DEVICE to the target device.
- Set the variable GCC_DIR to point
to the directory where the GCC MSP430 package is installed.
- Include all of the project source
files (that is, the *.c files) as a dependency for the first target of the
makefile.
- Go to the project directory in a
terminal. Type make to build the project or make debug to debug
the project.
OBJECTS=blink.o
GCC_DIR = ../../../bin
SUPPORT_FILE_DIRECTORY = ../../../include
# Please set your device here
DEVICE = msp430X
CC = $(GCC_DIR)/msp430-elf-gcc
GDB = $(GCC_DIR)/msp430-elf-gdb
CFLAGS = -I $(SUPPORT_FILE_DIRECTORY) -mmcu=$(DEVICE) -O2 -g
LFLAGS = -L $(SUPPORT_FILE_DIRECTORY) -T $(DEVICE).ld
all: ${OBJECTS}
$(CC) $(CFLAGS) $(LFLAGS) $? -o $(DEVICE).out
debug: all
$(GDB) $(DEVICE).out