From c6850d60b703404d07ba01e7f6349c351d459909 Mon Sep 17 00:00:00 2001 From: Thibaut VIARD Date: Tue, 21 Jun 2011 01:03:39 +0200 Subject: [PATCH] Adding mk files for future use and readme --- hardware/sam/system/libsam/build_gcc/sam3n.mk | 129 ++++++++++++++++++ hardware/sam/system/libsam/build_gcc/sam3s.mk | 1 + hardware/sam/system/libsam/build_gcc/sam3u.mk | 129 ++++++++++++++++++ hardware/sam/system/libsam/build_gcc/sam3x.mk | 129 ++++++++++++++++++ hardware/sam/system/libsam/readme.txt | 1 + 5 files changed, 389 insertions(+) create mode 100644 hardware/sam/system/libsam/build_gcc/sam3n.mk create mode 100644 hardware/sam/system/libsam/build_gcc/sam3u.mk create mode 100644 hardware/sam/system/libsam/build_gcc/sam3x.mk create mode 100644 hardware/sam/system/libsam/readme.txt diff --git a/hardware/sam/system/libsam/build_gcc/sam3n.mk b/hardware/sam/system/libsam/build_gcc/sam3n.mk new file mode 100644 index 000000000..9100d1687 --- /dev/null +++ b/hardware/sam/system/libsam/build_gcc/sam3n.mk @@ -0,0 +1,129 @@ +# Makefile for compiling libchip +.SUFFIXES: .o .a .c .s +SUB_MAKEFILES=debug.mk gcc.mk release.mk win.mk sam3s.mk + +LIBNAME=libchip +TOOLCHAIN=gcc + +ifeq ($(CHIP),) +$(error CHIP not defined) +endif + +#------------------------------------------------------------------------------- +# Path +#------------------------------------------------------------------------------- + +# Output directories +OUTPUT_BIN = ../lib + +# Libraries +PROJECT_BASE_PATH = .. + +#------------------------------------------------------------------------------- +# Files +#------------------------------------------------------------------------------- + +vpath %.h $(PROJECT_BASE_PATH)/include +vpath %.c $(PROJECT_BASE_PATH)/source $(PROJECT_BASE_PATH)/cmsis +vpath %.s $(PROJECT_BASE_PATH)/source $(PROJECT_BASE_PATH)/cmsis + +VPATH+=$(PROJECT_BASE_PATH)/source +VPATH+=$(PROJECT_BASE_PATH)/cmsis + +INCLUDES = -I$(PROJECT_BASE_PATH) +INCLUDES += -I$(PROJECT_BASE_PATH)/include +INCLUDES += -I$(PROJECT_BASE_PATH)/cmsis + +#------------------------------------------------------------------------------- +ifdef DEBUG +include debug.mk +else +include release.mk +endif + +#------------------------------------------------------------------------------- +# Tools +#------------------------------------------------------------------------------- + +include $(TOOLCHAIN).mk + +#------------------------------------------------------------------------------- +ifdef DEBUG +OUTPUT_OBJ=debug +OUTPUT_LIB=$(LIBNAME)_$(CHIP)_$(TOOLCHAIN)_dbg.a +else +OUTPUT_OBJ=release +OUTPUT_LIB=$(LIBNAME)_$(CHIP)_$(TOOLCHAIN)_rel.a +endif + +OUTPUT_PATH=$(OUTPUT_OBJ)_$(CHIP) + +#------------------------------------------------------------------------------- +# C source files and objects +#------------------------------------------------------------------------------- +C_SRC=$(wildcard $(PROJECT_BASE_PATH)/source/*.c) +C_SRC+=$(wildcard $(PROJECT_BASE_PATH)/cmsis/*.c) + +C_OBJ_TEMP=$(patsubst %.c, %.o, $(notdir $(C_SRC))) + +# during development, remove some files +C_OBJ_FILTER=pio_it.o + +C_OBJ=$(filter-out $(C_OBJ_FILTER), $(C_OBJ_TEMP)) + +#------------------------------------------------------------------------------- +# Assembler source files and objects +#------------------------------------------------------------------------------- +A_SRC=$(wildcard $(PROJECT_BASE_PATH)/source/*.s) +A_SRC+=$(wildcard $(PROJECT_BASE_PATH)/cmsis/*.s) + +A_OBJ_TEMP=$(patsubst %.s, %.o, $(notdir $(A_SRC))) + +# during development, remove some files +A_OBJ_FILTER= + +A_OBJ=$(filter-out $(A_OBJ_FILTER), $(A_OBJ_TEMP)) + +#------------------------------------------------------------------------------- +# Rules +#------------------------------------------------------------------------------- +all: $(CHIP) + +$(CHIP): create_output $(OUTPUT_LIB) + +.PHONY: create_output +create_output: + @echo --- Preparing $(CHIP) files $(OUTPUT_PATH) $(OUTPUT_BIN) +# @echo ------------------------- +# @echo *$(C_SRC) +# @echo ------------------------- +# @echo *$(C_OBJ) +# @echo ------------------------- +# @echo *$(addprefix $(OUTPUT_PATH)/, $(C_OBJ)) +# @echo ------------------------- +# @echo *$(A_SRC) +# @echo ------------------------- + + -@mkdir $(subst /,$(SEP),$(OUTPUT_BIN)) 1>NUL 2>&1 + -@mkdir $(OUTPUT_PATH) 1>NUL 2>&1 + +$(addprefix $(OUTPUT_PATH)/,$(C_OBJ)): $(OUTPUT_PATH)/%.o: %.c +# "$(CC)" -v -c $(CFLAGS) -Wa,aln=$(subst .o,.s,$@) $< -o $@ + @"$(CC)" -c $(CFLAGS) $< -o $@ + +$(addprefix $(OUTPUT_PATH)/,$(A_OBJ)): $(OUTPUT_PATH)/%.o: %.s + @"$(AS)" -c $(ASFLAGS) $< -o $@ + +$(OUTPUT_LIB): $(addprefix $(OUTPUT_PATH)/, $(C_OBJ)) $(addprefix $(OUTPUT_PATH)/, $(A_OBJ)) + @"$(AR)" -r "$(OUTPUT_BIN)/$@" $^ + @"$(NM)" "$(OUTPUT_BIN)/$@" > "$(OUTPUT_BIN)/$@.txt" + +.PHONY: clean +clean: + @echo --- Cleaning $(CHIP) files + -@$(RM) $(OUTPUT_PATH) 1>NUL 2>&1 + -@$(RM) $(subst /,$(SEP),$(OUTPUT_BIN)/$(OUTPUT_LIB)) 1>NUL 2>&1 + -@$(RM) $(subst /,$(SEP),$(OUTPUT_BIN)/$(OUTPUT_LIB)).txt 1>NUL 2>&1 + +# dependencies +$(addprefix $(OUTPUT_PATH)/,$(C_OBJ)): $(OUTPUT_PATH)/%.o: $(PROJECT_BASE_PATH)/chip.h $(wildcard $(PROJECT_BASE_PATH)/include/*.h) $(wildcard $(PROJECT_BASE_PATH)/cmsis/*.h) diff --git a/hardware/sam/system/libsam/build_gcc/sam3s.mk b/hardware/sam/system/libsam/build_gcc/sam3s.mk index 9100d1687..0340a3a12 100644 --- a/hardware/sam/system/libsam/build_gcc/sam3s.mk +++ b/hardware/sam/system/libsam/build_gcc/sam3s.mk @@ -115,6 +115,7 @@ $(addprefix $(OUTPUT_PATH)/,$(A_OBJ)): $(OUTPUT_PATH)/%.o: %.s @"$(AS)" -c $(ASFLAGS) $< -o $@ $(OUTPUT_LIB): $(addprefix $(OUTPUT_PATH)/, $(C_OBJ)) $(addprefix $(OUTPUT_PATH)/, $(A_OBJ)) + @"$(AR)" -r "../../../cores/sam/$@" $^ @"$(AR)" -r "$(OUTPUT_BIN)/$@" $^ @"$(NM)" "$(OUTPUT_BIN)/$@" > "$(OUTPUT_BIN)/$@.txt" diff --git a/hardware/sam/system/libsam/build_gcc/sam3u.mk b/hardware/sam/system/libsam/build_gcc/sam3u.mk new file mode 100644 index 000000000..9100d1687 --- /dev/null +++ b/hardware/sam/system/libsam/build_gcc/sam3u.mk @@ -0,0 +1,129 @@ +# Makefile for compiling libchip +.SUFFIXES: .o .a .c .s +SUB_MAKEFILES=debug.mk gcc.mk release.mk win.mk sam3s.mk + +LIBNAME=libchip +TOOLCHAIN=gcc + +ifeq ($(CHIP),) +$(error CHIP not defined) +endif + +#------------------------------------------------------------------------------- +# Path +#------------------------------------------------------------------------------- + +# Output directories +OUTPUT_BIN = ../lib + +# Libraries +PROJECT_BASE_PATH = .. + +#------------------------------------------------------------------------------- +# Files +#------------------------------------------------------------------------------- + +vpath %.h $(PROJECT_BASE_PATH)/include +vpath %.c $(PROJECT_BASE_PATH)/source $(PROJECT_BASE_PATH)/cmsis +vpath %.s $(PROJECT_BASE_PATH)/source $(PROJECT_BASE_PATH)/cmsis + +VPATH+=$(PROJECT_BASE_PATH)/source +VPATH+=$(PROJECT_BASE_PATH)/cmsis + +INCLUDES = -I$(PROJECT_BASE_PATH) +INCLUDES += -I$(PROJECT_BASE_PATH)/include +INCLUDES += -I$(PROJECT_BASE_PATH)/cmsis + +#------------------------------------------------------------------------------- +ifdef DEBUG +include debug.mk +else +include release.mk +endif + +#------------------------------------------------------------------------------- +# Tools +#------------------------------------------------------------------------------- + +include $(TOOLCHAIN).mk + +#------------------------------------------------------------------------------- +ifdef DEBUG +OUTPUT_OBJ=debug +OUTPUT_LIB=$(LIBNAME)_$(CHIP)_$(TOOLCHAIN)_dbg.a +else +OUTPUT_OBJ=release +OUTPUT_LIB=$(LIBNAME)_$(CHIP)_$(TOOLCHAIN)_rel.a +endif + +OUTPUT_PATH=$(OUTPUT_OBJ)_$(CHIP) + +#------------------------------------------------------------------------------- +# C source files and objects +#------------------------------------------------------------------------------- +C_SRC=$(wildcard $(PROJECT_BASE_PATH)/source/*.c) +C_SRC+=$(wildcard $(PROJECT_BASE_PATH)/cmsis/*.c) + +C_OBJ_TEMP=$(patsubst %.c, %.o, $(notdir $(C_SRC))) + +# during development, remove some files +C_OBJ_FILTER=pio_it.o + +C_OBJ=$(filter-out $(C_OBJ_FILTER), $(C_OBJ_TEMP)) + +#------------------------------------------------------------------------------- +# Assembler source files and objects +#------------------------------------------------------------------------------- +A_SRC=$(wildcard $(PROJECT_BASE_PATH)/source/*.s) +A_SRC+=$(wildcard $(PROJECT_BASE_PATH)/cmsis/*.s) + +A_OBJ_TEMP=$(patsubst %.s, %.o, $(notdir $(A_SRC))) + +# during development, remove some files +A_OBJ_FILTER= + +A_OBJ=$(filter-out $(A_OBJ_FILTER), $(A_OBJ_TEMP)) + +#------------------------------------------------------------------------------- +# Rules +#------------------------------------------------------------------------------- +all: $(CHIP) + +$(CHIP): create_output $(OUTPUT_LIB) + +.PHONY: create_output +create_output: + @echo --- Preparing $(CHIP) files $(OUTPUT_PATH) $(OUTPUT_BIN) +# @echo ------------------------- +# @echo *$(C_SRC) +# @echo ------------------------- +# @echo *$(C_OBJ) +# @echo ------------------------- +# @echo *$(addprefix $(OUTPUT_PATH)/, $(C_OBJ)) +# @echo ------------------------- +# @echo *$(A_SRC) +# @echo ------------------------- + + -@mkdir $(subst /,$(SEP),$(OUTPUT_BIN)) 1>NUL 2>&1 + -@mkdir $(OUTPUT_PATH) 1>NUL 2>&1 + +$(addprefix $(OUTPUT_PATH)/,$(C_OBJ)): $(OUTPUT_PATH)/%.o: %.c +# "$(CC)" -v -c $(CFLAGS) -Wa,aln=$(subst .o,.s,$@) $< -o $@ + @"$(CC)" -c $(CFLAGS) $< -o $@ + +$(addprefix $(OUTPUT_PATH)/,$(A_OBJ)): $(OUTPUT_PATH)/%.o: %.s + @"$(AS)" -c $(ASFLAGS) $< -o $@ + +$(OUTPUT_LIB): $(addprefix $(OUTPUT_PATH)/, $(C_OBJ)) $(addprefix $(OUTPUT_PATH)/, $(A_OBJ)) + @"$(AR)" -r "$(OUTPUT_BIN)/$@" $^ + @"$(NM)" "$(OUTPUT_BIN)/$@" > "$(OUTPUT_BIN)/$@.txt" + +.PHONY: clean +clean: + @echo --- Cleaning $(CHIP) files + -@$(RM) $(OUTPUT_PATH) 1>NUL 2>&1 + -@$(RM) $(subst /,$(SEP),$(OUTPUT_BIN)/$(OUTPUT_LIB)) 1>NUL 2>&1 + -@$(RM) $(subst /,$(SEP),$(OUTPUT_BIN)/$(OUTPUT_LIB)).txt 1>NUL 2>&1 + +# dependencies +$(addprefix $(OUTPUT_PATH)/,$(C_OBJ)): $(OUTPUT_PATH)/%.o: $(PROJECT_BASE_PATH)/chip.h $(wildcard $(PROJECT_BASE_PATH)/include/*.h) $(wildcard $(PROJECT_BASE_PATH)/cmsis/*.h) diff --git a/hardware/sam/system/libsam/build_gcc/sam3x.mk b/hardware/sam/system/libsam/build_gcc/sam3x.mk new file mode 100644 index 000000000..9100d1687 --- /dev/null +++ b/hardware/sam/system/libsam/build_gcc/sam3x.mk @@ -0,0 +1,129 @@ +# Makefile for compiling libchip +.SUFFIXES: .o .a .c .s +SUB_MAKEFILES=debug.mk gcc.mk release.mk win.mk sam3s.mk + +LIBNAME=libchip +TOOLCHAIN=gcc + +ifeq ($(CHIP),) +$(error CHIP not defined) +endif + +#------------------------------------------------------------------------------- +# Path +#------------------------------------------------------------------------------- + +# Output directories +OUTPUT_BIN = ../lib + +# Libraries +PROJECT_BASE_PATH = .. + +#------------------------------------------------------------------------------- +# Files +#------------------------------------------------------------------------------- + +vpath %.h $(PROJECT_BASE_PATH)/include +vpath %.c $(PROJECT_BASE_PATH)/source $(PROJECT_BASE_PATH)/cmsis +vpath %.s $(PROJECT_BASE_PATH)/source $(PROJECT_BASE_PATH)/cmsis + +VPATH+=$(PROJECT_BASE_PATH)/source +VPATH+=$(PROJECT_BASE_PATH)/cmsis + +INCLUDES = -I$(PROJECT_BASE_PATH) +INCLUDES += -I$(PROJECT_BASE_PATH)/include +INCLUDES += -I$(PROJECT_BASE_PATH)/cmsis + +#------------------------------------------------------------------------------- +ifdef DEBUG +include debug.mk +else +include release.mk +endif + +#------------------------------------------------------------------------------- +# Tools +#------------------------------------------------------------------------------- + +include $(TOOLCHAIN).mk + +#------------------------------------------------------------------------------- +ifdef DEBUG +OUTPUT_OBJ=debug +OUTPUT_LIB=$(LIBNAME)_$(CHIP)_$(TOOLCHAIN)_dbg.a +else +OUTPUT_OBJ=release +OUTPUT_LIB=$(LIBNAME)_$(CHIP)_$(TOOLCHAIN)_rel.a +endif + +OUTPUT_PATH=$(OUTPUT_OBJ)_$(CHIP) + +#------------------------------------------------------------------------------- +# C source files and objects +#------------------------------------------------------------------------------- +C_SRC=$(wildcard $(PROJECT_BASE_PATH)/source/*.c) +C_SRC+=$(wildcard $(PROJECT_BASE_PATH)/cmsis/*.c) + +C_OBJ_TEMP=$(patsubst %.c, %.o, $(notdir $(C_SRC))) + +# during development, remove some files +C_OBJ_FILTER=pio_it.o + +C_OBJ=$(filter-out $(C_OBJ_FILTER), $(C_OBJ_TEMP)) + +#------------------------------------------------------------------------------- +# Assembler source files and objects +#------------------------------------------------------------------------------- +A_SRC=$(wildcard $(PROJECT_BASE_PATH)/source/*.s) +A_SRC+=$(wildcard $(PROJECT_BASE_PATH)/cmsis/*.s) + +A_OBJ_TEMP=$(patsubst %.s, %.o, $(notdir $(A_SRC))) + +# during development, remove some files +A_OBJ_FILTER= + +A_OBJ=$(filter-out $(A_OBJ_FILTER), $(A_OBJ_TEMP)) + +#------------------------------------------------------------------------------- +# Rules +#------------------------------------------------------------------------------- +all: $(CHIP) + +$(CHIP): create_output $(OUTPUT_LIB) + +.PHONY: create_output +create_output: + @echo --- Preparing $(CHIP) files $(OUTPUT_PATH) $(OUTPUT_BIN) +# @echo ------------------------- +# @echo *$(C_SRC) +# @echo ------------------------- +# @echo *$(C_OBJ) +# @echo ------------------------- +# @echo *$(addprefix $(OUTPUT_PATH)/, $(C_OBJ)) +# @echo ------------------------- +# @echo *$(A_SRC) +# @echo ------------------------- + + -@mkdir $(subst /,$(SEP),$(OUTPUT_BIN)) 1>NUL 2>&1 + -@mkdir $(OUTPUT_PATH) 1>NUL 2>&1 + +$(addprefix $(OUTPUT_PATH)/,$(C_OBJ)): $(OUTPUT_PATH)/%.o: %.c +# "$(CC)" -v -c $(CFLAGS) -Wa,aln=$(subst .o,.s,$@) $< -o $@ + @"$(CC)" -c $(CFLAGS) $< -o $@ + +$(addprefix $(OUTPUT_PATH)/,$(A_OBJ)): $(OUTPUT_PATH)/%.o: %.s + @"$(AS)" -c $(ASFLAGS) $< -o $@ + +$(OUTPUT_LIB): $(addprefix $(OUTPUT_PATH)/, $(C_OBJ)) $(addprefix $(OUTPUT_PATH)/, $(A_OBJ)) + @"$(AR)" -r "$(OUTPUT_BIN)/$@" $^ + @"$(NM)" "$(OUTPUT_BIN)/$@" > "$(OUTPUT_BIN)/$@.txt" + +.PHONY: clean +clean: + @echo --- Cleaning $(CHIP) files + -@$(RM) $(OUTPUT_PATH) 1>NUL 2>&1 + -@$(RM) $(subst /,$(SEP),$(OUTPUT_BIN)/$(OUTPUT_LIB)) 1>NUL 2>&1 + -@$(RM) $(subst /,$(SEP),$(OUTPUT_BIN)/$(OUTPUT_LIB)).txt 1>NUL 2>&1 + +# dependencies +$(addprefix $(OUTPUT_PATH)/,$(C_OBJ)): $(OUTPUT_PATH)/%.o: $(PROJECT_BASE_PATH)/chip.h $(wildcard $(PROJECT_BASE_PATH)/include/*.h) $(wildcard $(PROJECT_BASE_PATH)/cmsis/*.h) diff --git a/hardware/sam/system/libsam/readme.txt b/hardware/sam/system/libsam/readme.txt new file mode 100644 index 000000000..b000ff160 --- /dev/null +++ b/hardware/sam/system/libsam/readme.txt @@ -0,0 +1 @@ +Makefile into build_gcc folder build the SAM peripheral library and put it into ../../../cores/sam Arduino API folder \ No newline at end of file