From: Dan White Date: Sat, 8 Sep 2012 01:21:14 +0000 (-0500) Subject: rename makefiles X-Git-Tag: bootrom-initial-submission~84 X-Git-Url: http://git.whiteaudio.com/gitweb/?a=commitdiff_plain;h=5b510e7733bb63000c0c4f333ff2861636d9424c;p=430.git rename makefiles --- diff --git a/msp4th/Makefile b/msp4th/Makefile old mode 100755 new mode 100644 index e377f04..c4722b0 --- a/msp4th/Makefile +++ b/msp4th/Makefile @@ -1,35 +1,101 @@ -# msp430-gcc -nostartfiles -mmcu=msp430x2013 -O2 -g -mendup-at=main test1.c +# +# Makefile for msp430 +# +# 'make' builds everything +# 'make clean' deletes everything except source files and Makefile +# You need to set TARGET, MCU and SOURCES for your project. +# TARGET is the name of the executable file to be produced +# $(TARGET).elf $(TARGET).hex and $(TARGET).txt and $(TARGET).map are all generated. +# The TXT file is used for BSL loading, the ELF can be used for JTAG use +# +SHELL = /bin/bash +TARGET = main +#MCU = msp430f5529 +MCU = msp2 +# List all the source files here +# eg if you have a source file foo.c then list it here +SOURCES = main.c ns430-uart.c msp4th.c +# Include are located in the Include directory +#INCLUDES = -IInclude +INCLUDES = -I. +# Add or subtract whatever MSPGCC flags you want. There are plenty more +####################################################################################### +CFLAGS = -mmcu=$(MCU) -g -Os -Wall -Wunused $(INCLUDES) +#ASFLAGS = -mmcu=$(MCU) -x assembler-with-cpp -Wa,-gstabs +ASFLAGS = -mmcu=$(MCU) -Os -Wall -Wunused +LDFLAGS = -mmcu=$(MCU) -Wl,-Map=$(TARGET).map -T ldscript_ns430 +######################################################################################## +CC = msp430-gcc +LD = msp430-ld +AR = msp430-ar +AS = msp430-gcc +GASP = msp430-gasp +NM = msp430-nm +OBJCOPY = msp430-objcopy +RANLIB = msp430-ranlib +STRIP = msp430-strip +SIZE = msp430-size +READELF = msp430-readelf +MAKETXT = srec_cat +CP = cp -p +RM = rm -f +MV = mv +######################################################################################## +# the file which will include dependencies +DEPEND = $(SOURCES:.c=.d) -.SECONDARY: +# all the object files +OBJECTS = $(SOURCES:.c=.o) -MAIN=x.c +# all asm files +ASSEMBLYS = $(SOURCES:.c=.lst) -default: $(MAIN:.c=.hex) $(MAIN:.c=.xout) $(MAIN:.c=.asm) +#all: $(TARGET).elf $(TARGET).hex $(TARGET).txt +all: $(TARGET).elf $(TARGET).hex $(ASSEMBLYS) -all: default flash +$(TARGET).elf: $(OBJECTS) + @echo "Linking $@" + $(CC) $(OBJECTS) $(LDFLAGS) $(LIBS) -o $@ + @echo + @echo ">>>> Size of Firmware <<<<" + $(SIZE) $(TARGET).elf + @echo -#msp430-gcc -nostartfiles -mmcu=msp430x2013 -O2 -g -Wall -Wa,-ahlms=$(<:.c=.lst) -%.a43: %.c - msp430-gcc -O0 -nostartfiles -mmcu=msp430xG438 -Wall -Wa,-ahlms=$(<:.c=.lst) \ - -mendup-at=main -o $@ $< -L -Xlinker -T ldscript_ns430 +%.hex: %.elf + $(OBJCOPY) -O ihex $< $@ -%.asm: %.c - msp430-gcc -S -O0 -nostartfiles -mmcu=msp430xG438 -Wall \ - -mendup-at=main -o $@ $< +%.txt: %.hex + $(MAKETXT) -O $@ -TITXT $< -I + unix2dos $(TARGET).txt +# The above line is required for the DOS based TI BSL tool to be able to read the txt file generated from linux/unix systems. +# +%.o: %.c + @echo "Compiling $<" + $(CC) -c $(CFLAGS) -o $@ $< -%.hex: %.a43 - msp430-objcopy -O ihex $< $@ +# rule for making assembler source listing, to see the code +%.lst: %.c + @#$(CC) -S $(ASFLAGS) -Wa,-anlhd -o $@ $< + $(CC) -S $(ASFLAGS) -o $@ $< -%.xout: %.a43 - @#msp430-objdump -dSt $< > $@ - @#msp430-objdump --disassemble-all --architecture=msp:54 $< > $@ - msp430-objdump --disassemble-all $< > $@ +# include the dependencies unless we're going to clean, then forget about them. +ifneq ($(MAKECMDGOALS), clean) +-include $(DEPEND) +endif -flash: $(MAIN:.c=.hex) - ./flash.py $< +# dependencies file +# includes also considered, since some of these are our own +# (otherwise use -MM instead of -M) +%.d: %.c + @echo "Generating dependencies $@ from $<" + $(CC) -M ${CFLAGS} $< >$@ +#.SILENT: +.PHONY: clean clean: - rm -f *.a43 *.hex *.xout *.lst *.asm - + $(RM) $(OBJECTS) + $(RM) $(TARGET).{elf,hex,txt,map} + $(RM) $(SOURCES:.c=.lst) + $(RM) $(DEPEND) diff --git a/msp4th/Makefile.old b/msp4th/Makefile.old new file mode 100755 index 0000000..e377f04 --- /dev/null +++ b/msp4th/Makefile.old @@ -0,0 +1,35 @@ +# msp430-gcc -nostartfiles -mmcu=msp430x2013 -O2 -g -mendup-at=main test1.c + + +.SECONDARY: + +MAIN=x.c + +default: $(MAIN:.c=.hex) $(MAIN:.c=.xout) $(MAIN:.c=.asm) + +all: default flash + +#msp430-gcc -nostartfiles -mmcu=msp430x2013 -O2 -g -Wall -Wa,-ahlms=$(<:.c=.lst) +%.a43: %.c + msp430-gcc -O0 -nostartfiles -mmcu=msp430xG438 -Wall -Wa,-ahlms=$(<:.c=.lst) \ + -mendup-at=main -o $@ $< -L -Xlinker -T ldscript_ns430 + +%.asm: %.c + msp430-gcc -S -O0 -nostartfiles -mmcu=msp430xG438 -Wall \ + -mendup-at=main -o $@ $< + +%.hex: %.a43 + msp430-objcopy -O ihex $< $@ + +%.xout: %.a43 + @#msp430-objdump -dSt $< > $@ + @#msp430-objdump --disassemble-all --architecture=msp:54 $< > $@ + msp430-objdump --disassemble-all $< > $@ + +flash: $(MAIN:.c=.hex) + ./flash.py $< + +clean: + rm -f *.a43 *.hex *.xout *.lst *.asm + + diff --git a/msp4th/mkfile b/msp4th/mkfile deleted file mode 100644 index c4722b0..0000000 --- a/msp4th/mkfile +++ /dev/null @@ -1,101 +0,0 @@ -# -# Makefile for msp430 -# -# 'make' builds everything -# 'make clean' deletes everything except source files and Makefile -# You need to set TARGET, MCU and SOURCES for your project. -# TARGET is the name of the executable file to be produced -# $(TARGET).elf $(TARGET).hex and $(TARGET).txt and $(TARGET).map are all generated. -# The TXT file is used for BSL loading, the ELF can be used for JTAG use -# -SHELL = /bin/bash - -TARGET = main -#MCU = msp430f5529 -MCU = msp2 -# List all the source files here -# eg if you have a source file foo.c then list it here -SOURCES = main.c ns430-uart.c msp4th.c -# Include are located in the Include directory -#INCLUDES = -IInclude -INCLUDES = -I. -# Add or subtract whatever MSPGCC flags you want. There are plenty more -####################################################################################### -CFLAGS = -mmcu=$(MCU) -g -Os -Wall -Wunused $(INCLUDES) -#ASFLAGS = -mmcu=$(MCU) -x assembler-with-cpp -Wa,-gstabs -ASFLAGS = -mmcu=$(MCU) -Os -Wall -Wunused -LDFLAGS = -mmcu=$(MCU) -Wl,-Map=$(TARGET).map -T ldscript_ns430 -######################################################################################## -CC = msp430-gcc -LD = msp430-ld -AR = msp430-ar -AS = msp430-gcc -GASP = msp430-gasp -NM = msp430-nm -OBJCOPY = msp430-objcopy -RANLIB = msp430-ranlib -STRIP = msp430-strip -SIZE = msp430-size -READELF = msp430-readelf -MAKETXT = srec_cat -CP = cp -p -RM = rm -f -MV = mv -######################################################################################## -# the file which will include dependencies -DEPEND = $(SOURCES:.c=.d) - -# all the object files -OBJECTS = $(SOURCES:.c=.o) - -# all asm files -ASSEMBLYS = $(SOURCES:.c=.lst) - -#all: $(TARGET).elf $(TARGET).hex $(TARGET).txt -all: $(TARGET).elf $(TARGET).hex $(ASSEMBLYS) - -$(TARGET).elf: $(OBJECTS) - @echo "Linking $@" - $(CC) $(OBJECTS) $(LDFLAGS) $(LIBS) -o $@ - @echo - @echo ">>>> Size of Firmware <<<<" - $(SIZE) $(TARGET).elf - @echo - -%.hex: %.elf - $(OBJCOPY) -O ihex $< $@ - -%.txt: %.hex - $(MAKETXT) -O $@ -TITXT $< -I - unix2dos $(TARGET).txt -# The above line is required for the DOS based TI BSL tool to be able to read the txt file generated from linux/unix systems. -# -%.o: %.c - @echo "Compiling $<" - $(CC) -c $(CFLAGS) -o $@ $< - -# rule for making assembler source listing, to see the code -%.lst: %.c - @#$(CC) -S $(ASFLAGS) -Wa,-anlhd -o $@ $< - $(CC) -S $(ASFLAGS) -o $@ $< - -# include the dependencies unless we're going to clean, then forget about them. -ifneq ($(MAKECMDGOALS), clean) --include $(DEPEND) -endif - -# dependencies file -# includes also considered, since some of these are our own -# (otherwise use -MM instead of -M) -%.d: %.c - @echo "Generating dependencies $@ from $<" - $(CC) -M ${CFLAGS} $< >$@ - -#.SILENT: -.PHONY: clean -clean: - $(RM) $(OBJECTS) - $(RM) $(TARGET).{elf,hex,txt,map} - $(RM) $(SOURCES:.c=.lst) - $(RM) $(DEPEND) -