summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Knispel <gknispel@avencall.com>2013-02-08 16:23:55 +0100
committerGuillaume Knispel <gknispel@avencall.com>2013-02-08 16:23:55 +0100
commit7349761747d5c7e21ac5271590eb6132c68fca8b (patch)
tree415b80b8a0de789920b5d8d777453a9c54f65c45
parenta41f05e6b00964f4c25ae76dc2fb38dcd5efa938 (diff)
update / cleanup Makefile and .gitignore (new fw filenames)v2.02
-rw-r--r--.gitignore5
-rw-r--r--Makefile97
2 files changed, 63 insertions, 39 deletions
diff --git a/.gitignore b/.gitignore
index 9b6fe6b..66d5e26 100644
--- a/.gitignore
+++ b/.gitignore
@@ -9,8 +9,9 @@ settings/
*.elf
*.hex
*.map
-PwrSeq.txt
-PwrSeq.safe.txt
+*.unsafe
+ECF-*.txt
+ECF-*.lst
IAR_ULPAdvisor_Defs.h
include.txt
source.txt
diff --git a/Makefile b/Makefile
index bb90eff..43df1cc 100644
--- a/Makefile
+++ b/Makefile
@@ -1,19 +1,30 @@
#
-# Makefile for msp430
+# Makefile for the Embedded Controller Firmware of the XIOH board
#
-# '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 nad $(TARGET).map are all generated.
-# The TXT file is used for BSL loading, the ELF can be used for JTAG use
-#
-BASE_TARGET = PwrSeq
+# Note that there are multiple board variants: BOARD=XIOH_V5 or BOARD=XIOH_V6.
+# One "make" invocation only builds for one variant.
+# The build result files include $(BOARD) in their names.
+#
+# "make" generates the following files:
+# ECF-$(BOARD).elf
+# ECF-$(BOARD).lst
+# ECF-$(BOARD).map
+# ECF-$(BOARD).txt
+#
+# Note that "make clean" removes files for all board targets.
+#
+# Note that the .txt is what must be flashed and is not 100% equivalent
+# to the .elf: the .txt includes additionnal safety features in the form
+# of filling of unused areas, done by the fill_titxt.py program.
+
+# default board variant: you can override by the command line,
+# e.g.: "make BOARD=XIOH_V6"
BOARD = XIOH_V5
-TARGET = $(BASE_TARGET).$(BOARD)
+
+BASE_TARGET = ECF
+TARGET = $(BASE_TARGET)-$(BOARD)
MCU = msp430f2274
SOURCES = main.c serial.c
-# Add or subtract whatever MSPGCC flags you want. There are plenty more
#######################################################################################
CFLAGS = -mmcu=$(MCU) -D$(BOARD) -funsigned-char -g3 -O2 -Wall -Wextra
ASFLAGS = -mmcu=$(MCU) -x assembler-with-cpp -Wa,-gstabs
@@ -40,7 +51,9 @@ MV = mv
DEPEND = $(SOURCES:.c=.$(BOARD).d)
# all the object files
OBJECTS = $(SOURCES:.c=.$(BOARD).o)
-all: $(TARGET).elf $(TARGET).hex $(TARGET).txt.unsafe $(TARGET).safe.txt $(TARGET).gcc.lst
+
+all: $(TARGET).txt $(TARGET).lst
+
$(TARGET).elf: $(OBJECTS)
echo "Linking $@"
$(CC) $(OBJECTS) $(LDFLAGS) $(LIBS) -o $@
@@ -48,56 +61,66 @@ $(TARGET).elf: $(OBJECTS)
echo ">>>> Size of Firmware <<<<"
$(SIZE) $(TARGET).elf
echo
+
%.hex: %.elf
$(OBJCOPY) -O ihex $< $@
-%.txt.unsafe: %.hex
+
+%.unsafe: %.hex
$(MAKETXT) -O $@ -TITXT $< -I
- unix2dos $(TARGET).txt.unsafe
+ unix2dos $@
# 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.
-%.safe.txt: %.txt.unsafe
- # ./fill_titxt.py:
- # -n 4 -x 0xff3f: Put 4 words 3fff just before the vectors.
- # Each decodes as an infinite loop instruction.
- # -d 0x82432001: Put aligned 4382 0120 instructions
- # (reboot using WD) everywhere it is possible.
- # -w 0x0020: If word gaps remain, put 0200 instructions
- # there (jump next instruction).
- #
- # The goal is to make a firmware more robust in case the PC gets
- # corrupted. We fill most of the unprogrammed area with instructions
- # that will trigger a reboot (write of a bad value to WDTCTL). Just
- # before the vector, we put 4 single word infinite loop instructions:
- # this is better than double words instructions because we can't put
- # arbitrary words in the vector area, so if PC/2 is odd the result
- # will still be completely defined if we land there, 3fff is an
- # acceptable BSLSKEY, and the application provides a watchdog timeout.
- # In remaining single word spaces, we put "jmp next" instructions to
- # hopefully get to the next 4382 0120 instruction.
- #
+
+# ./fill_titxt.py:
+# -n 4 -x 0xff3f: Put 4 words 3fff just before the vectors.
+# Each decodes as an infinite loop instruction.
+# -d 0x82432001: Put aligned 4382 0120 instructions
+# (reboot using WD) everywhere it is possible.
+# -w 0x0020: If word gaps remain, put 0200 instructions
+# there (jump next instruction).
+#
+# The goal is to make a firmware more robust in case the PC gets
+# corrupted. We fill most of the unprogrammed area with instructions
+# that will trigger a reboot (write of a bad value to WDTCTL). Just
+# before the vector, we put 4 single word infinite loop instructions:
+# this is better than double words instructions because we can't put
+# arbitrary words in the vector area, so if PC/2 is odd the result
+# will still be completely defined if we land there, 3fff is an
+# acceptable BSLSKEY, and the application provides a watchdog timeout.
+# In remaining single word spaces, we put "jmp next" instructions to
+# hopefully get to the next 4382 0120 instruction.
+#
+%.txt: %.unsafe
./fill_titxt.py -n 4 -x 0xff3f -d 0x82432001 -w 0x0020 -o $@ $<
echo
echo '>>>'
echo '>>>>>>' FINAL RESULT IS IN $@ '<<<<<<'
echo '>>>'
echo
-%.gcc.lst: %.elf
+
+%.lst: %.elf
$(OBJDUMP) -S -d $< > $@ && $(OBJDUMP) -s -j .rodata $< >> $@
+
%.$(BOARD).o: %.c
echo "Compiling $<"
$(CC) -c $(CFLAGS) -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)
%.$(BOARD).d: %.c
echo "Generating dependencies $@ from $<"
$(CC) -M ${CFLAGS} $< >$@
+
.SILENT:
+
.PHONY: clean
+
clean:
- -$(RM) *.o *.d *.elf *.hex *.lst *.map $(BASE_TARGET).*.txt *.unsafe
- -$(RM) $(BASE_TARGET).txt
+ -$(RM) *.o *.d *.elf *.hex *.map *.unsafe
+ -$(RM) $(BASE_TARGET)*.txt $(BASE_TARGET)*.lst
-$(RM) path.txt include.txt source.txt file.r43 *.dep