Added make_skeleton_asf.sh & req. support in Makefile. master
authorethereal <ethereal@ethv.net>
Thu, 6 Nov 2014 08:50:55 +0000 (00:50 -0800)
committerethereal <ethereal@ethv.net>
Thu, 6 Nov 2014 08:50:55 +0000 (00:50 -0800)
.gitignore
Makefile
make_skeleton_asf.sh [new file with mode: 0755]

index b120abc..57b6ec1 100644 (file)
@@ -1,3 +1,5 @@
+/asf_complete
 output.bin
 output.elf
 *.o
+*.p
index 760b88f..4bb96dc 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -38,13 +38,20 @@ LD=$(CPREFIX)ld
 OBJCOPY=$(CPREFIX)objcopy
 
 SOURCE_FILES=exceptions.c startup_sam3n.c system_sam3n.c main.c util.c $(DRIVER_SRC)
-#OBJECT_FILES=$(add_prefix obj/ $(basename $(SOURCE_FILES:.c=.o)))
 OBJECT_FILES=$(SOURCE_FILES:.c=.o)
+PP_FILES=$(SOURCE_FILES:.c=.p)
+
+.c.p:
+       $(CC) $(CFLAGS) -E $< -o $@
 
 all: $(OBJECT_FILES) flash.ld
        $(LD) $(LDFLAGS) -Tflash.ld $(OBJECT_FILES) -o output.elf
        $(OBJCOPY) -O binary output.elf output.bin
 
+.PHONY: req
+req: $(PP_FILES)
+       @echo $(PP_FILES)
+
 .PHONY: clean
 clean:
-       -rm -f $(OBJECT_FILES) output.elf
+       -rm -f $(OBJECT_FILES) $(PP_FILES) output.elf
diff --git a/make_skeleton_asf.sh b/make_skeleton_asf.sh
new file mode 100755 (executable)
index 0000000..5a20119
--- /dev/null
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+PATH_TO_ASF="asf_complete"
+
+rm -rf asf
+ln -s $PATH_TO_ASF asf
+PP_FILES=$(make req)
+FILES=$(grep '^#' $PP_FILES | awk '{print $3}' | sort | uniq | grep "^\"asf/" | sed -e 's/"//g')
+rm asf
+for file in $FILES; do
+    mkdir -p $(dirname $file);
+    cp $(echo $file | sed -e 's/^asf/'$PATH_TO_ASF'/') $file;
+done
+
+mkdir -p asf/thirdparty/CMSIS/Lib/GCC/
+cp $PATH_TO_ASF/thirdparty/CMSIS/Lib/GCC/libarm_cortexM3l_math.a asf/thirdparty/CMSIS/Lib/GCC/