]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS/Demo/CORTEX_M7_SAME70_Xplained_AtmelStudio/src/ASF/sam/utils/make/Makefile.sam.in
Rename DummyTCB_t to StaticTCB_t.
[freertos] / FreeRTOS / Demo / CORTEX_M7_SAME70_Xplained_AtmelStudio / src / ASF / sam / utils / make / Makefile.sam.in
diff --git a/FreeRTOS/Demo/CORTEX_M7_SAME70_Xplained_AtmelStudio/src/ASF/sam/utils/make/Makefile.sam.in b/FreeRTOS/Demo/CORTEX_M7_SAME70_Xplained_AtmelStudio/src/ASF/sam/utils/make/Makefile.sam.in
new file mode 100644 (file)
index 0000000..b31feaa
--- /dev/null
@@ -0,0 +1,496 @@
+# List of available make goals:\r
+#\r
+# all                     Default target, builds the project\r
+# clean                   Clean up the project\r
+# rebuild                 Rebuild the project\r
+# debug_flash             Builds the project and debug in flash\r
+# debug_sram              Builds the project and debug in sram\r
+#\r
+# doc                     Build the documentation\r
+# cleandoc                Clean up the documentation\r
+# rebuilddoc              Rebuild the documentation\r
+#\r
+# \file\r
+#\r
+# Copyright (c) 2011 - 2013 Atmel Corporation. All rights reserved.\r
+#\r
+# \asf_license_start\r
+#\r
+# \page License\r
+#\r
+# Redistribution and use in source and binary forms, with or without\r
+# modification, are permitted provided that the following conditions are met:\r
+#\r
+# 1. Redistributions of source code must retain the above copyright notice,\r
+#    this list of conditions and the following disclaimer.\r
+#\r
+# 2. Redistributions in binary form must reproduce the above copyright notice,\r
+#    this list of conditions and the following disclaimer in the documentation\r
+#    and/or other materials provided with the distribution.\r
+#\r
+# 3. The name of Atmel may not be used to endorse or promote products derived\r
+#    from this software without specific prior written permission.\r
+#\r
+# 4. This software may only be redistributed and used in connection with an\r
+#    Atmel microcontroller product.\r
+#\r
+# THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED\r
+# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\r
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE\r
+# EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR\r
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\r
+# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\r
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r
+# POSSIBILITY OF SUCH DAMAGE.\r
+#\r
+# \asf_license_stop\r
+#\r
+\r
+# Include the config.mk file from the current working path, e.g., where the\r
+# user called make.\r
+include config.mk\r
+\r
+# Tool to use to generate documentation from the source code\r
+DOCGEN          ?= doxygen\r
+\r
+# Look for source files relative to the top-level source directory\r
+VPATH           := $(PRJ_PATH)\r
+\r
+# Output target file\r
+project_type    := $(PROJECT_TYPE)\r
+\r
+# Output target file\r
+ifeq ($(project_type),flash)\r
+target          := $(TARGET_FLASH)\r
+linker_script   := $(PRJ_PATH)/$(LINKER_SCRIPT_FLASH)\r
+debug_script    := $(PRJ_PATH)/$(DEBUG_SCRIPT_FLASH)\r
+else\r
+target          := $(TARGET_SRAM)\r
+linker_script   := $(PRJ_PATH)/$(LINKER_SCRIPT_SRAM)\r
+debug_script    := $(PRJ_PATH)/$(DEBUG_SCRIPT_SRAM)\r
+endif\r
+\r
+# Output project name (target name minus suffix)\r
+project         := $(basename $(target))\r
+\r
+# Output target file (typically ELF or static library)\r
+ifeq ($(suffix $(target)),.a)\r
+target_type     := lib\r
+else\r
+ifeq ($(suffix $(target)),.elf)\r
+target_type     := elf\r
+else\r
+$(error "Target type $(target_type) is not supported")\r
+endif\r
+endif\r
+\r
+# Allow override of operating system detection. The user can add OS=Linux or\r
+# OS=Windows on the command line to explicit set the host OS.\r
+#\r
+# This allows to work around broken uname utility on certain systems.\r
+ifdef OS\r
+  ifeq ($(strip $(OS)), Linux)\r
+    os_type     := Linux\r
+  endif\r
+  ifeq ($(strip $(OS)), Windows)\r
+    os_type     := windows32_64\r
+  endif\r
+endif\r
+\r
+os_type         ?= $(strip $(shell uname))\r
+\r
+ifeq ($(os_type),windows32)\r
+os              := Windows\r
+else\r
+ifeq ($(os_type),windows64)\r
+os              := Windows\r
+else\r
+ifeq ($(os_type),windows32_64)\r
+os              ?= Windows\r
+else\r
+ifeq ($(os_type),)\r
+os              := Windows\r
+else\r
+# Default to Linux style operating system. Both Cygwin and mingw are fully\r
+# compatible (for this Makefile) with Linux.\r
+os              := Linux\r
+endif\r
+endif\r
+endif\r
+endif\r
+\r
+# Output documentation directory and configuration file.\r
+docdir          := ../doxygen/html\r
+doccfg          := ../doxygen/doxyfile.doxygen\r
+\r
+CROSS           ?= arm-none-eabi-\r
+AR              := $(CROSS)ar\r
+AS              := $(CROSS)as\r
+CC              := $(CROSS)gcc\r
+CPP             := $(CROSS)gcc -E\r
+CXX             := $(CROSS)g++\r
+LD              := $(CROSS)g++\r
+NM              := $(CROSS)nm\r
+OBJCOPY         := $(CROSS)objcopy\r
+OBJDUMP         := $(CROSS)objdump\r
+SIZE            := $(CROSS)size\r
+GDB             := $(CROSS)gdb\r
+\r
+RM              := rm\r
+ifeq ($(os),Windows)\r
+RMDIR           := rmdir /S /Q\r
+else\r
+RMDIR           := rmdir -p --ignore-fail-on-non-empty\r
+endif\r
+\r
+# On Windows, we need to override the shell to force the use of cmd.exe\r
+ifeq ($(os),Windows)\r
+SHELL           := cmd\r
+endif\r
+\r
+# Strings for beautifying output\r
+MSG_CLEAN_FILES         = "RM      *.o *.d"\r
+MSG_CLEAN_DIRS          = "RMDIR   $(strip $(clean-dirs))"\r
+MSG_CLEAN_DOC           = "RMDIR   $(docdir)"\r
+MSG_MKDIR               = "MKDIR   $(dir $@)"\r
+\r
+MSG_INFO                = "INFO    "\r
+MSG_PREBUILD            = "PREBUILD  $(PREBUILD_CMD)"\r
+MSG_POSTBUILD           = "POSTBUILD $(POSTBUILD_CMD)"\r
+\r
+MSG_ARCHIVING           = "AR      $@"\r
+MSG_ASSEMBLING          = "AS      $@"\r
+MSG_BINARY_IMAGE        = "OBJCOPY $@"\r
+MSG_COMPILING           = "CC      $@"\r
+MSG_COMPILING_CXX       = "CXX     $@"\r
+MSG_EXTENDED_LISTING    = "OBJDUMP $@"\r
+MSG_IHEX_IMAGE          = "OBJCOPY $@"\r
+MSG_LINKING             = "LN      $@"\r
+MSG_PREPROCESSING       = "CPP     $@"\r
+MSG_SIZE                = "SIZE    $@"\r
+MSG_SYMBOL_TABLE        = "NM      $@"\r
+\r
+MSG_GENERATING_DOC      = "DOXYGEN $(docdir)"\r
+\r
+# Don't use make's built-in rules and variables\r
+MAKEFLAGS       += -rR\r
+\r
+# Don't print 'Entering directory ...'\r
+MAKEFLAGS       += --no-print-directory\r
+\r
+# Function for reversing the order of a list\r
+reverse = $(if $(1),$(call reverse,$(wordlist 2,$(words $(1)),$(1)))) $(firstword $(1))\r
+\r
+# Hide command output by default, but allow the user to override this\r
+# by adding V=1 on the command line.\r
+#\r
+# This is inspired by the Kbuild system used by the Linux kernel.\r
+ifdef V\r
+  ifeq ("$(origin V)", "command line")\r
+    VERBOSE = $(V)\r
+  endif\r
+endif\r
+ifndef VERBOSE\r
+  VERBOSE = 0\r
+endif\r
+\r
+ifeq ($(VERBOSE), 1)\r
+  Q =\r
+else\r
+  Q = @\r
+endif\r
+\r
+arflags-gnu-y           := $(ARFLAGS)\r
+asflags-gnu-y           := $(ASFLAGS)\r
+cflags-gnu-y            := $(CFLAGS)\r
+cxxflags-gnu-y          := $(CXXFLAGS)\r
+cppflags-gnu-y          := $(CPPFLAGS)\r
+cpuflags-gnu-y          :=\r
+dbgflags-gnu-y          := $(DBGFLAGS)\r
+libflags-gnu-y          := $(foreach LIB,$(LIBS),-l$(LIB))\r
+ldflags-gnu-y           := $(LDFLAGS)\r
+flashflags-gnu-y        :=\r
+clean-files             :=\r
+clean-dirs              :=\r
+\r
+clean-files             += $(wildcard $(target) $(project).map)\r
+clean-files             += $(wildcard $(project).hex $(project).bin)\r
+clean-files             += $(wildcard $(project).lss $(project).sym)\r
+clean-files             += $(wildcard $(build))\r
+\r
+# Use pipes instead of temporary files for communication between processes\r
+cflags-gnu-y    += -pipe\r
+asflags-gnu-y   += -pipe\r
+ldflags-gnu-y   += -pipe\r
+\r
+# Archiver flags.\r
+arflags-gnu-y   += rcs\r
+\r
+# Always enable warnings. And be very careful about implicit\r
+# declarations.\r
+cflags-gnu-y    += -Wall -Wstrict-prototypes -Wmissing-prototypes\r
+cflags-gnu-y    += -Werror-implicit-function-declaration\r
+cxxflags-gnu-y  += -Wall\r
+# IAR doesn't allow arithmetic on void pointers, so warn about that.\r
+cflags-gnu-y    += -Wpointer-arith\r
+cxxflags-gnu-y  += -Wpointer-arith\r
+\r
+# Preprocessor flags.\r
+cppflags-gnu-y  += $(foreach INC,$(addprefix $(PRJ_PATH)/,$(INC_PATH)),-I$(INC))\r
+asflags-gnu-y   += $(foreach INC,$(addprefix $(PRJ_PATH)/,$(INC_PATH)),'-Wa,-I$(INC)')\r
+\r
+# CPU specific flags.\r
+cpuflags-gnu-y  += -mcpu=$(ARCH) -mthumb -D=__$(PART)__\r
+\r
+# Dependency file flags.\r
+depflags        = -MD -MP -MQ $@\r
+\r
+# Debug specific flags.\r
+ifdef BUILD_DEBUG_LEVEL\r
+dbgflags-gnu-y  += -g$(BUILD_DEBUG_LEVEL)\r
+else\r
+dbgflags-gnu-y  += -g3\r
+endif\r
+\r
+# Optimization specific flags.\r
+ifdef BUILD_OPTIMIZATION\r
+optflags-gnu-y  = -O$(BUILD_OPTIMIZATION)\r
+else\r
+optflags-gnu-y  = $(OPTIMIZATION)\r
+endif\r
+\r
+# Always preprocess assembler files.\r
+asflags-gnu-y   += -x assembler-with-cpp\r
+# Compile C files using the GNU99 standard.\r
+cflags-gnu-y    += -std=gnu99\r
+# Compile C++ files using the GNU++98 standard.\r
+cxxflags-gnu-y  += -std=gnu++98\r
+\r
+# Don't use strict aliasing (very common in embedded applications).\r
+cflags-gnu-y    += -fno-strict-aliasing\r
+cxxflags-gnu-y  += -fno-strict-aliasing\r
+\r
+# Separate each function and data into its own separate section to allow\r
+# garbage collection of unused sections.\r
+cflags-gnu-y    += -ffunction-sections -fdata-sections\r
+cxxflags-gnu-y  += -ffunction-sections -fdata-sections\r
+\r
+# Various cflags.\r
+cflags-gnu-y += -Wchar-subscripts -Wcomment -Wformat=2 -Wimplicit-int\r
+cflags-gnu-y += -Wmain -Wparentheses\r
+cflags-gnu-y += -Wsequence-point -Wreturn-type -Wswitch -Wtrigraphs -Wunused\r
+cflags-gnu-y += -Wuninitialized -Wunknown-pragmas -Wfloat-equal -Wundef\r
+cflags-gnu-y += -Wshadow -Wbad-function-cast -Wwrite-strings\r
+cflags-gnu-y += -Wsign-compare -Waggregate-return\r
+cflags-gnu-y += -Wmissing-declarations\r
+cflags-gnu-y += -Wformat -Wmissing-format-attribute -Wno-deprecated-declarations\r
+cflags-gnu-y += -Wpacked -Wredundant-decls -Wnested-externs -Winline -Wlong-long\r
+cflags-gnu-y += -Wunreachable-code\r
+cflags-gnu-y += -Wcast-align\r
+cflags-gnu-y += --param max-inline-insns-single=500\r
+\r
+# Garbage collect unreferred sections when linking.\r
+ldflags-gnu-y   += -Wl,--gc-sections\r
+\r
+# Use the linker script if provided by the project.\r
+ifneq ($(strip $(linker_script)),)\r
+ldflags-gnu-y   += -Wl,-T $(linker_script)\r
+endif\r
+\r
+# Output a link map file and a cross reference table\r
+ldflags-gnu-y   += -Wl,-Map=$(project).map,--cref\r
+\r
+# Add library search paths relative to the top level directory.\r
+ldflags-gnu-y   += $(foreach _LIB_PATH,$(addprefix $(PRJ_PATH)/,$(LIB_PATH)),-L$(_LIB_PATH))\r
+\r
+a_flags  = $(cpuflags-gnu-y) $(depflags) $(cppflags-gnu-y) $(asflags-gnu-y) -D__ASSEMBLY__\r
+c_flags  = $(cpuflags-gnu-y) $(dbgflags-gnu-y) $(depflags) $(optflags-gnu-y) $(cppflags-gnu-y) $(cflags-gnu-y)\r
+cxx_flags= $(cpuflags-gnu-y) $(dbgflags-gnu-y) $(depflags) $(optflags-gnu-y) $(cppflags-gnu-y) $(cxxflags-gnu-y)\r
+l_flags  = -Wl,--entry=Reset_Handler -Wl,--cref $(cpuflags-gnu-y) $(optflags-gnu-y) $(ldflags-gnu-y)\r
+ar_flags = $(arflags-gnu-y)\r
+\r
+# Source files list and part informations must already be included before\r
+# running this makefile\r
+\r
+# If a custom build directory is specified, use it -- force trailing / in directory name.\r
+ifdef BUILD_DIR\r
+       build-dir       := $(dir $(BUILD_DIR))$(if $(notdir $(BUILD_DIR)),$(notdir $(BUILD_DIR))/)\r
+else\r
+       build-dir        =\r
+endif\r
+\r
+# Create object files list from source files list.\r
+obj-y                   := $(addprefix $(build-dir), $(addsuffix .o,$(basename $(CSRCS) $(ASSRCS))))\r
+# Create dependency files list from source files list.\r
+dep-files               := $(wildcard $(foreach f,$(obj-y),$(basename $(f)).d))\r
+\r
+clean-files             += $(wildcard $(obj-y))\r
+clean-files             += $(dep-files)\r
+\r
+clean-dirs              += $(call reverse,$(sort $(wildcard $(dir $(obj-y)))))\r
+\r
+# Default target.\r
+.PHONY: all\r
+ifeq ($(project_type),all)\r
+all:\r
+       $(MAKE) all PROJECT_TYPE=flash\r
+       $(MAKE) all PROJECT_TYPE=sram\r
+else\r
+ifeq ($(target_type),lib)\r
+all: $(target) $(project).lss $(project).sym\r
+else\r
+ifeq ($(target_type),elf)\r
+all: prebuild $(target) $(project).lss $(project).sym $(project).hex $(project).bin postbuild\r
+endif\r
+endif\r
+endif\r
+\r
+prebuild:\r
+ifneq ($(strip $(PREBUILD_CMD)),)\r
+       @echo $(MSG_PREBUILD)\r
+       $(Q)$(PREBUILD_CMD)\r
+endif\r
+\r
+postbuild:\r
+ifneq ($(strip $(POSTBUILD_CMD)),)\r
+       @echo $(MSG_POSTBUILD)\r
+       $(Q)$(POSTBUILD_CMD)\r
+endif\r
+\r
+# Clean up the project.\r
+.PHONY: clean\r
+clean:\r
+       @$(if $(strip $(clean-files)),echo $(MSG_CLEAN_FILES))\r
+       $(if $(strip $(clean-files)),$(Q)$(RM) $(clean-files),)\r
+       @$(if $(strip $(clean-dirs)),echo $(MSG_CLEAN_DIRS))\r
+# Remove created directories, and make sure we only remove existing\r
+# directories, since recursive rmdir might help us a bit on the way.\r
+ifeq ($(os),Windows)\r
+       $(Q)$(if $(strip $(clean-dirs)),                        \\r
+                       $(RMDIR) $(strip $(subst /,\,$(clean-dirs))))\r
+else\r
+       $(Q)$(if $(strip $(clean-dirs)),                        \\r
+               for directory in $(strip $(clean-dirs)); do     \\r
+                       if [ -d "$$directory" ]; then           \\r
+                               $(RMDIR) $$directory;           \\r
+                       fi                                      \\r
+               done                                            \\r
+       )\r
+endif\r
+\r
+# Rebuild the project.\r
+.PHONY: rebuild\r
+rebuild: clean all\r
+\r
+# Debug the project in flash.\r
+.PHONY: debug_flash\r
+debug_flash: all\r
+       $(GDB) -x "$(PRJ_PATH)/$(DEBUG_SCRIPT_FLASH)" -ex "reset" -readnow -se $(TARGET_FLASH)\r
+\r
+# Debug the project in sram.\r
+.PHONY: debug_sram\r
+debug_sram: all\r
+       $(GDB) -x "$(PRJ_PATH)/$(DEBUG_SCRIPT_SRAM)" -ex "reset" -readnow -se $(TARGET_SRAM)\r
+\r
+.PHONY: objfiles\r
+objfiles: $(obj-y)\r
+\r
+# Create object files from C source files.\r
+$(build-dir)%.o: %.c $(MAKEFILE_PATH) config.mk\r
+       $(Q)test -d $(dir $@) || echo $(MSG_MKDIR)\r
+ifeq ($(os),Windows)\r
+       $(Q)test -d $(patsubst %/,%,$(dir $@)) || mkdir $(subst /,\,$(dir $@))\r
+else\r
+       $(Q)test -d $(dir $@) || mkdir -p $(dir $@)\r
+endif\r
+       @echo $(MSG_COMPILING)\r
+       $(Q)$(CC) $(c_flags) -c $< -o $@\r
+\r
+# Create object files from C++ source files.\r
+$(build-dir)%.o: %.cpp $(MAKEFILE_PATH) config.mk\r
+       $(Q)test -d $(dir $@) || echo $(MSG_MKDIR)\r
+ifeq ($(os),Windows)\r
+       $(Q)test -d $(patsubst %/,%,$(dir $@)) || mkdir $(subst /,\,$(dir $@))\r
+else\r
+       $(Q)test -d $(dir $@) || mkdir -p $(dir $@)\r
+endif\r
+       @echo $(MSG_COMPILING_CXX)\r
+       $(Q)$(CXX) $(cxx_flags) -c $< -o $@\r
+\r
+# Preprocess and assemble: create object files from assembler source files.\r
+$(build-dir)%.o: %.S $(MAKEFILE_PATH) config.mk\r
+       $(Q)test -d $(dir $@) || echo $(MSG_MKDIR)\r
+ifeq ($(os),Windows)\r
+       $(Q)test -d $(patsubst %/,%,$(dir $@)) || mkdir $(subst /,\,$(dir $@))\r
+else\r
+       $(Q)test -d $(dir $@) || mkdir -p $(dir $@)\r
+endif\r
+       @echo $(MSG_ASSEMBLING)\r
+       $(Q)$(CC) $(a_flags) -c $< -o $@\r
+\r
+# Include all dependency files to add depedency to all header files in use.\r
+include $(dep-files)\r
+\r
+ifeq ($(target_type),lib)\r
+# Archive object files into an archive\r
+$(target): $(MAKEFILE_PATH) config.mk $(obj-y)\r
+       @echo $(MSG_ARCHIVING)\r
+       $(Q)$(AR) $(ar_flags) $@ $(obj-y)\r
+       @echo $(MSG_SIZE)\r
+       $(Q)$(SIZE) -Bxt $@\r
+else\r
+ifeq ($(target_type),elf)\r
+# Link the object files into an ELF file. Also make sure the target is rebuilt\r
+# if the common Makefile.sam.in or project config.mk is changed.\r
+$(target): $(linker_script) $(MAKEFILE_PATH) config.mk $(obj-y)\r
+       @echo $(MSG_LINKING)\r
+       $(Q)$(LD) $(l_flags) $(obj-y) $(libflags-gnu-y) -o $@\r
+       @echo $(MSG_SIZE)\r
+       $(Q)$(SIZE) -Ax $@\r
+       $(Q)$(SIZE) -Bx $@\r
+endif\r
+endif\r
+\r
+# Create extended function listing from target output file.\r
+%.lss: $(target)\r
+       @echo $(MSG_EXTENDED_LISTING)\r
+       $(Q)$(OBJDUMP) -h -S $< > $@\r
+\r
+# Create symbol table from target output file.\r
+%.sym: $(target)\r
+       @echo $(MSG_SYMBOL_TABLE)\r
+       $(Q)$(NM) -n $< > $@\r
+\r
+# Create Intel HEX image from ELF output file.\r
+%.hex: $(target)\r
+       @echo $(MSG_IHEX_IMAGE)\r
+       $(Q)$(OBJCOPY) -O ihex $(flashflags-gnu-y)  $< $@\r
+\r
+# Create binary image from ELF output file.\r
+%.bin: $(target)\r
+       @echo $(MSG_BINARY_IMAGE)\r
+       $(Q)$(OBJCOPY) -O binary $< $@\r
+\r
+# Provide information about the detected host operating system.\r
+.SECONDARY: info-os\r
+info-os:\r
+       @echo $(MSG_INFO)$(os) build host detected\r
+\r
+# Build Doxygen generated documentation.\r
+.PHONY: doc\r
+doc:\r
+       @echo $(MSG_GENERATING_DOC)\r
+       $(Q)cd $(dir $(doccfg)) && $(DOCGEN) $(notdir $(doccfg))\r
+\r
+# Clean Doxygen generated documentation.\r
+.PHONY: cleandoc\r
+cleandoc:\r
+       @$(if $(wildcard $(docdir)),echo $(MSG_CLEAN_DOC))\r
+       $(Q)$(if $(wildcard $(docdir)),$(RM) --recursive $(docdir))\r
+\r
+# Rebuild the Doxygen generated documentation.\r
+.PHONY: rebuilddoc\r
+rebuilddoc: cleandoc doc\r