gordon 229 Posted June 30, 2011 Share Posted June 30, 2011 Rickta59 says this might be of interest to others, so here's the Makefile I've been using for MSPGCC. TARGETMCU ?= msp430g2211 CROSS := msp430- CC := $(CROSS)gcc CXX := $(CROSS)g++ OBJDUMP := $(CROSS)objdump SIZE := $(CROSS)size LD := $(CC) MSPDEBUG := mspdebug LDFLAGS := -mmcu=$(TARGETMCU) CFLAGS := -Os -Wall -W -Wextra -Werror -g -mmcu=$(TARGETMCU) ifneq ($(WITH_CXX),) CC := $(CXX) LD := $(CC) endif ifneq ($(DEBUG),) ifeq ($(WITH_CXX),) CFLAGS += -Wstrict-prototypes -Wmissing-prototypes -Wbad-function-cast CFLAGS += -Werror-implicit-function-declaration -Wdeclaration-after-statement CFLAGS += -Wnested-externs -Wold-style-definition CFLAGS += -finline-functions endif CFLAGS += -Wmissing-declarations -Winit-self -Winline -Wredundant-decls CFLAGS += -Wshadow -Wpointer-arith -Wcast-qual -Wsign-compare -Wformat=2 CFLAGS += -Wfloat-equal -Wmissing-field-initializers CFLAGS += -Wmissing-include-dirs -Wswitch-default -Wpacked CFLAGS += -Wpacked -Wlarger-than-65500 -Wunknown-pragmas CFLAGS += -Wmissing-format-attribute -Wmissing-noreturn CFLAGS += -Wstrict-aliasing=2 -Wswitch-enum -Wundef -Wunreachable-code CFLAGS += -Wunsafe-loop-optimizations -Wwrite-strings -Wcast-align CFLAGS += -Wformat-nonliteral -Wformat-security -Waggregate-return CFLAGS += -fno-common -Wp,-D_FORTIFY_SOURCE=2 endif SRCS := main.c PROG := $(firstword $(SRCS:.c=)) OBJS := $(SRCS:.c=.o) all: $(PROG).elf $(PROG).lst $(PROG).elf: $(OBJS) $(LD) $(LDFLAGS) -o $(PROG).elf $(OBJS) %.o: %.c $(CC) $(CFLAGS) -c $< %.lst: %.elf $(OBJDUMP) -DS $< > $@ $(SIZE) $< clean: -rm -f $(PROG).elf $(PROG).lst $(OBJS) install: $(PROG).elf $(MSPDEBUG) -n rf2500 "prog $(PROG).elf" I don't know what half of the CFLAGs mean anymore (some of them most likely don't even have any real meaning in the MSP430 context), I have collected them during the years, the result is considerably anal about code quality, though. roxfan notes, why not use gcc -S instead of objdump? objdump won't show symbols stripped by linker. http://www.delorie.com/djgpp/v2faq/faq8_20.html Well, I got used to objdump's output, that's about it. It's GNU make, don't even try with others, really. Also don't forget to expand spaces to tabs. bluehash, pimmel, jsolarski and 3 others 6 Quote Link to post Share on other sites
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.