Last active
December 11, 2015 01:39
-
-
Save aarmot/4525234 to your computer and use it in GitHub Desktop.
Makefile for MSP430 assembler development in Linux. Inspiration taken from http://sourceforge.net/apps/mediawiki/mspgcc/index.php?title=Example:Makefile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Makefile for msp430 assembler | |
# Build single GNU asm source | |
# | |
# 'make' builds everything | |
# 'make dump' generates assembler dump of target | |
# 'make burn' flashes target into launchpad | |
# 'make clean' deletes everything except source files and Makefile | |
# | |
# You need to set TARGET and MCU for your project | |
# eg if you have a source 'foo.S' then set target to 'foo' | |
# | |
TARGET = null | |
MCU = msp430g2452 | |
# Add or subtract whatever MSPGCC flags you want. There are plenty more | |
####################################################################################### | |
CFLAGS = -mmcu=$(MCU) -g -Os -Wall -Wunused -Wno-main $(INCLUDES) | |
ASFLAGS = -mmcu=$(MCU) -x assembler-with-cpp -Wa,-gstabs | |
LDFLAGS = -mmcu=$(MCU) -Wl,-Map=$(TARGET).map -nostdlibs -nostartfiles | |
######################################################################################## | |
CC = msp430-gcc | |
LD = msp430-ld | |
AR = msp430-ar | |
AS = msp430-gcc | |
NM = msp430-nm | |
OBJCOPY = msp430-objcopy | |
OBJDUMP = msp430-objdump | |
RANLIB = msp430-ranlib | |
STRIP = msp430-strip | |
SIZE = msp430-size | |
READELF = msp430-readelf | |
MSPDEBUG = mspdebug | |
CP = cp -p | |
RM = rm -f | |
MV = mv | |
######################################################################################## | |
.PHONY: all dump clean | |
all: $(TARGET).elf | |
$(TARGET).elf: $(TARGET).o | |
@echo "Linking $@" | |
$(CC) $(TARGET).o $(LDFLAGS) $(LIBS) -o $@ | |
@echo | |
@echo ">>>> Size of Firmware <<<<" | |
$(SIZE) $(TARGET).elf | |
@echo | |
%.o: %.S | |
@echo "Compiling $<" | |
$(CC) -c $(CFLAGS) -o $@ $< | |
dump: $(TARGET).elf | |
$(OBJDUMP) -S $< > $(TARGET).dump | |
burn: $(TARGET).elf | |
$(MSPDEBUG) rf2500 "prog $(TARGET).elf" | |
clean: | |
-$(RM) $(TARGET).elf $(TARGET).map $(TARGET).o $(TARGET).dump |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment