mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-20 21:01:25 +03:00
Removed validation tests
This commit is contained in:
@ -1,55 +0,0 @@
|
||||
|
||||
1- Path to GCC ARM toolchain
|
||||
|
||||
Set into environment variables the ARM_GCC_TOOLCHAIN variable:
|
||||
ex:
|
||||
ARM_GCC_TOOLCHAIN=C:\CodeSourcery_2011.03-42\bin
|
||||
|
||||
2- Compile libsam (at91sam peripheral drivers)
|
||||
|
||||
Go to hardware/sam/system/libsam/build_gcc
|
||||
|
||||
run the command: 'cs-make'
|
||||
|
||||
This will compile the libsam library and deliver to main Arduino folder the files:
|
||||
|
||||
hardware/sam/cores/arduino/libsam_sam3s4c_gcc_dbg.a
|
||||
hardware/sam/cores/arduino/libsam_sam3s4c_gcc_dbg.a.txt (result of nm)
|
||||
|
||||
3- Compile libarduino (Arduino API)
|
||||
|
||||
Go to hardware/sam/cores/arduino/build_gcc
|
||||
|
||||
run the command: 'cs-make'
|
||||
|
||||
This will compile the libarduino library and deliver to main Arduino folder the files:
|
||||
|
||||
hardware/sam/cores/arduino/libarduino_sam3s_ek_gcc_dbg.a
|
||||
hardware/sam/cores/arduino/libarduino_sam3s_ek_gcc_dbg.a.txt (result of nm)
|
||||
|
||||
4- Compile libvariant (variant specific library, use Arduino API and libsam)
|
||||
|
||||
Go to hardware/sam/variants/sam3s-ek/build_gcc
|
||||
|
||||
run the command: 'cs-make'
|
||||
|
||||
This will compile the libvariant library and deliver to main Arduino folder the files:
|
||||
|
||||
hardware/sam/cores/arduino/libvariant_sam3s_ek_gcc_dbg.a
|
||||
hardware/sam/cores/arduino/libvariant_sam3s_ek_gcc_dbg.a.txt (result of nm)
|
||||
|
||||
5- Compile test application
|
||||
|
||||
Go to hardware/sam/cores/arduino/validation/build_gcc
|
||||
|
||||
run the command: 'cs-make'
|
||||
|
||||
This will compile the test application and deliver the binary into:
|
||||
|
||||
hardware/sam/cores/arduino/validation/debug_sam3s_ek/test_gcc_dbg.elf
|
||||
hardware/sam/cores/arduino/validation/debug_sam3s_ek/test_gcc_dbg.bin
|
||||
hardware/sam/cores/arduino/validation/debug_sam3s_ek/test_gcc_dbg.map (mapping matching linker script)
|
||||
hardware/sam/cores/arduino/validation/debug_sam3s_ek/test_gcc_dbg.elf.txt (result of nm)
|
||||
|
||||
|
||||
|
@ -1,108 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2012 Arduino. All right reserved.
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2.1 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
|
||||
ifeq ("$(VARIANTS)", "")
|
||||
VARIANTS = arduino_due_x sam3x_ek adk2
|
||||
#VARIANTS = sam3u_ek sam3s_ek arduino_due_u
|
||||
endif
|
||||
|
||||
SUBMAKE_OPTIONS=--no-builtin-rules --no-builtin-variables --no-print-directory
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Rules
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
all: $(VARIANTS)
|
||||
|
||||
.PHONY: sam3s_ek
|
||||
sam3s_ek:
|
||||
@echo ------------------------------------------------------------------------------------
|
||||
@echo --- Making sam3s_ek
|
||||
@$(MAKE) DEBUG=1 $(SUBMAKE_OPTIONS) -f libarduino_sam3s_ek.mk
|
||||
# @$(MAKE) $(SUBMAKE_OPTIONS) -f libarduino_sam3s_ek.mk
|
||||
@echo ------------------------------------------------------------------------------------
|
||||
|
||||
.PHONY: sam3u_ek
|
||||
sam3u_ek:
|
||||
@echo ------------------------------------------------------------------------------------
|
||||
@echo --- Making sam3u_ek
|
||||
@$(MAKE) DEBUG=1 $(SUBMAKE_OPTIONS) -f libarduino_sam3u_ek.mk
|
||||
# @$(MAKE) $(SUBMAKE_OPTIONS) -f libarduino_sam3u_ek.mk
|
||||
@echo ------------------------------------------------------------------------------------
|
||||
|
||||
.PHONY: sam3x_ek
|
||||
sam3x_ek:
|
||||
@echo ------------------------------------------------------------------------------------
|
||||
@echo --- Making sam3x_ek
|
||||
@$(MAKE) DEBUG=1 $(SUBMAKE_OPTIONS) -f libarduino_sam3x_ek.mk
|
||||
# @$(MAKE) $(SUBMAKE_OPTIONS) -f libarduino_sam3x_ek.mk
|
||||
@echo ------------------------------------------------------------------------------------
|
||||
|
||||
.PHONY: arduino_due_u
|
||||
arduino_due_u:
|
||||
@echo ------------------------------------------------------------------------------------
|
||||
@echo --- Making arduino_due_u
|
||||
@$(MAKE) DEBUG=1 $(SUBMAKE_OPTIONS) -f libarduino_arduino_due_u.mk
|
||||
# @$(MAKE) $(SUBMAKE_OPTIONS) -f libarduino_arduino_due_u.mk
|
||||
@echo ------------------------------------------------------------------------------------
|
||||
|
||||
.PHONY: arduino_due_x
|
||||
arduino_due_x:
|
||||
@echo ------------------------------------------------------------------------------------
|
||||
@echo --- Making arduino_due_x
|
||||
@$(MAKE) DEBUG=1 $(SUBMAKE_OPTIONS) -f libarduino_arduino_due_x.mk
|
||||
# @$(MAKE) $(SUBMAKE_OPTIONS) -f libarduino_arduino_due_x.mk
|
||||
@echo ------------------------------------------------------------------------------------
|
||||
|
||||
.PHONY: adk2
|
||||
adk2:
|
||||
@echo ------------------------------------------------------------------------------------
|
||||
@echo --- Making adk2
|
||||
@$(MAKE) DEBUG=1 $(SUBMAKE_OPTIONS) -f libarduino_adk2.mk
|
||||
# @$(MAKE) $(SUBMAKE_OPTIONS) -f libarduino_adk2.mk
|
||||
@echo ------------------------------------------------------------------------------------
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
@echo ------------------------------------------------------------------------------------
|
||||
@echo --- Cleaning sam3s_ek
|
||||
@$(MAKE) DEBUG=1 $(SUBMAKE_OPTIONS) -f libarduino_sam3s_ek.mk $@
|
||||
# @$(MAKE) $(SUBMAKE_OPTIONS) -f libarduino_sam3s_ek.mk $@
|
||||
|
||||
@echo --- Cleaning sam3u_ek
|
||||
@$(MAKE) DEBUG=1 $(SUBMAKE_OPTIONS) -f libarduino_sam3u_ek.mk $@
|
||||
# @$(MAKE) $(SUBMAKE_OPTIONS) -f libarduino_sam3u_ek.mk $@
|
||||
|
||||
@echo --- Cleaning sam3x_ek
|
||||
@$(MAKE) DEBUG=1 $(SUBMAKE_OPTIONS) -f libarduino_sam3x_ek.mk $@
|
||||
# @$(MAKE) $(SUBMAKE_OPTIONS) -f libarduino_sam3x_ek.mk $@
|
||||
|
||||
@echo --- Cleaning arduino_due_u
|
||||
@$(MAKE) DEBUG=1 $(SUBMAKE_OPTIONS) -f libarduino_arduino_due_u.mk $@
|
||||
# @$(MAKE) $(SUBMAKE_OPTIONS) -f libarduino_arduino_due_u.mk $@
|
||||
|
||||
@echo --- Cleaning arduino_due_x
|
||||
@$(MAKE) DEBUG=1 $(SUBMAKE_OPTIONS) -f libarduino_arduino_due_x.mk $@
|
||||
# @$(MAKE) $(SUBMAKE_OPTIONS) -f libarduino_arduino_due_x.mk $@
|
||||
|
||||
@echo --- Cleaning adk2
|
||||
@$(MAKE) DEBUG=1 $(SUBMAKE_OPTIONS) -f libarduino_adk2.mk $@
|
||||
# @$(MAKE) $(SUBMAKE_OPTIONS) -f libarduino_adk2.mk $@
|
||||
|
||||
@echo ------------------------------------------------------------------------------------
|
||||
|
@ -1,7 +0,0 @@
|
||||
# Optimization level
|
||||
# -O1 Optimize
|
||||
# -O2 Optimize even more
|
||||
# -O3 Optimize yet more
|
||||
# -O0 Reduce compilation time and make debugging produce the expected results
|
||||
# -Os Optimize for size
|
||||
OPTIMIZATION = -g -O0 -DDEBUG
|
@ -1,83 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2011 Arduino. All right reserved.
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2.1 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
|
||||
# Tool suffix when cross-compiling
|
||||
CROSS_COMPILE = $(ARM_GCC_TOOLCHAIN)/arm-none-eabi-
|
||||
|
||||
# Compilation tools
|
||||
AR = $(CROSS_COMPILE)ar
|
||||
CC = $(CROSS_COMPILE)gcc
|
||||
CXX = $(CROSS_COMPILE)g++
|
||||
AS = $(CROSS_COMPILE)as
|
||||
NM = $(CROSS_COMPILE)nm
|
||||
ifeq ($(OS),Windows_NT)
|
||||
RM=cs-rm -Rf
|
||||
else
|
||||
RM=rm -Rf
|
||||
endif
|
||||
|
||||
SEP=/
|
||||
|
||||
# ---------------------------------------------------------------------------------------
|
||||
# C Flags
|
||||
|
||||
CFLAGS += -Wall -Wchar-subscripts -Wcomment -Wformat=2 -Wimplicit-int
|
||||
CFLAGS += -Werror-implicit-function-declaration -Wmain -Wparentheses
|
||||
CFLAGS += -Wsequence-point -Wreturn-type -Wswitch -Wtrigraphs -Wunused
|
||||
CFLAGS += -Wuninitialized -Wunknown-pragmas -Wfloat-equal -Wundef
|
||||
CFLAGS += -Wshadow -Wpointer-arith -Wbad-function-cast -Wwrite-strings
|
||||
CFLAGS += -Wsign-compare -Waggregate-return -Wstrict-prototypes
|
||||
CFLAGS += -Wmissing-prototypes -Wmissing-declarations
|
||||
CFLAGS += -Wformat -Wmissing-format-attribute -Wno-deprecated-declarations
|
||||
CFLAGS += -Wpacked -Wredundant-decls -Wnested-externs -Winline -Wlong-long
|
||||
CFLAGS += -Wunreachable-code
|
||||
CFLAGS += -Wcast-align
|
||||
#CFLAGS += -Wmissing-noreturn
|
||||
#CFLAGS += -Wconversion
|
||||
|
||||
CFLAGS += --param max-inline-insns-single=500 -mcpu=cortex-m3 -mthumb -mlong-calls -ffunction-sections -fdata-sections -nostdlib -std=c99
|
||||
CFLAGS += $(OPTIMIZATION) $(INCLUDES) -D$(CHIP) -D$(VARIANT)
|
||||
|
||||
# To reduce application size use only integer printf function.
|
||||
CFLAGS += -Dprintf=iprintf
|
||||
|
||||
# ---------------------------------------------------------------------------------------
|
||||
# CPP Flags
|
||||
|
||||
CPPFLAGS += -Wall -Wchar-subscripts -Wcomment -Wformat=2
|
||||
CPPFLAGS += -Wmain -Wparentheses -Wcast-align -Wunreachable-code
|
||||
CPPFLAGS += -Wsequence-point -Wreturn-type -Wswitch -Wtrigraphs -Wunused
|
||||
CPPFLAGS += -Wuninitialized -Wunknown-pragmas -Wfloat-equal -Wundef
|
||||
CPPFLAGS += -Wshadow -Wpointer-arith -Wwrite-strings
|
||||
CPPFLAGS += -Wsign-compare -Waggregate-return -Wmissing-declarations
|
||||
CPPFLAGS += -Wformat -Wmissing-format-attribute -Wno-deprecated-declarations
|
||||
CPPFLAGS += -Wpacked -Wredundant-decls -Winline -Wlong-long
|
||||
#CPPFLAGS += -Wmissing-noreturn
|
||||
#CPPFLAGS += -Wconversion
|
||||
|
||||
#-fno-rtti -fno-exceptions
|
||||
CPPFLAGS += --param max-inline-insns-single=500 -mcpu=cortex-m3 -mthumb -mlong-calls -ffunction-sections -fdata-sections -std=c++98
|
||||
CPPFLAGS += $(OPTIMIZATION) $(INCLUDES) -D$(CHIP)
|
||||
|
||||
# To reduce application size use only integer printf function.
|
||||
CPPFLAGS += -Dprintf=iprintf
|
||||
|
||||
# ---------------------------------------------------------------------------------------
|
||||
# ASM Flags
|
||||
|
||||
ASFLAGS = -mcpu=cortex-m3 -mthumb -Wall -g $(OPTIMIZATION) $(INCLUDES)
|
@ -1,183 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2012 Arduino. All right reserved.
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2.1 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
|
||||
# Makefile for compiling libArduino
|
||||
.SUFFIXES: .o .a .c .s
|
||||
|
||||
CHIP=__SAM3X8E__
|
||||
VARIANT=adk2
|
||||
LIBNAME=libarduino_$(VARIANT)
|
||||
TOOLCHAIN=gcc
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Path
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
# Output directories
|
||||
OUTPUT_BIN = ..
|
||||
|
||||
# Libraries
|
||||
PROJECT_BASE_PATH = ..
|
||||
PROJECT_BASE_PATH_USB = ../USB
|
||||
SYSTEM_PATH = ../../../system
|
||||
CMSIS_ROOT_PATH = $(SYSTEM_PATH)/CMSIS
|
||||
CMSIS_ARM_PATH=$(CMSIS_ROOT_PATH)/CMSIS/Include
|
||||
CMSIS_ATMEL_PATH=$(CMSIS_ROOT_PATH)/Device/ATMEL
|
||||
CMSIS_CHIP_PATH=$(CMSIS_ROOT_PATH)/Device/ATMEL/$(CHIP_SERIE)
|
||||
VARIANT_PATH = ../../../../../google/sam/variants/$(VARIANT)
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Files
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
#vpath %.h $(PROJECT_BASE_PATH) $(PROJECT_BASE_PATH_USB) $(SYSTEM_PATH) $(VARIANT_PATH)
|
||||
vpath %.c $(PROJECT_BASE_PATH) $(PROJECT_BASE_PATH_USB) $(VARIANT_PATH)
|
||||
vpath %.cpp $(PROJECT_BASE_PATH) $(PROJECT_BASE_PATH_USB)
|
||||
|
||||
VPATH+=$(PROJECT_BASE_PATH)
|
||||
|
||||
INCLUDES =
|
||||
INCLUDES += -I$(PROJECT_BASE_PATH)
|
||||
INCLUDES += -I$(PROJECT_BASE_PATH_USB)
|
||||
INCLUDES += -I$(VARIANT_PATH)
|
||||
INCLUDES += -I$(CMSIS_ARM_PATH)
|
||||
INCLUDES += -I$(CMSIS_ATMEL_PATH)
|
||||
INCLUDES += -I$(SYSTEM_PATH)
|
||||
INCLUDES += -I$(SYSTEM_PATH)/libsam
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
ifdef DEBUG
|
||||
include debug.mk
|
||||
else
|
||||
include release.mk
|
||||
endif
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Tools
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
include $(TOOLCHAIN).mk
|
||||
|
||||
CFLAGS += -DUSB_VID=0x2341 -DUSB_PID=0x003e
|
||||
CPPFLAGS += -DUSB_VID=0x2341 -DUSB_PID=0x003e
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
ifdef DEBUG
|
||||
OUTPUT_OBJ=debug
|
||||
OUTPUT_LIB=$(LIBNAME)_$(TOOLCHAIN)_dbg.a
|
||||
else
|
||||
OUTPUT_OBJ=release
|
||||
OUTPUT_LIB=$(LIBNAME)_$(TOOLCHAIN)_rel.a
|
||||
endif
|
||||
|
||||
OUTPUT_PATH=$(OUTPUT_OBJ)_$(VARIANT)
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# C source files and objects
|
||||
#-------------------------------------------------------------------------------
|
||||
C_SRC=$(wildcard $(PROJECT_BASE_PATH)/*.c $(PROJECT_BASE_PATH_USB)/*.c)
|
||||
|
||||
C_OBJ_TEMP = $(patsubst %.c, %.o, $(notdir $(C_SRC)))
|
||||
|
||||
# during development, remove some files
|
||||
C_OBJ_FILTER=
|
||||
|
||||
C_OBJ=$(filter-out $(C_OBJ_FILTER), $(C_OBJ_TEMP))
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# CPP source files and objects
|
||||
#-------------------------------------------------------------------------------
|
||||
CPP_SRC=$(wildcard $(PROJECT_BASE_PATH)/*.cpp $(PROJECT_BASE_PATH_USB)/*.cpp)
|
||||
|
||||
CPP_OBJ_TEMP = $(patsubst %.cpp, %.o, $(notdir $(CPP_SRC)))
|
||||
|
||||
# during development, remove some files
|
||||
CPP_OBJ_FILTER=
|
||||
|
||||
CPP_OBJ=$(filter-out $(CPP_OBJ_FILTER), $(CPP_OBJ_TEMP))
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Assembler source files and objects
|
||||
#-------------------------------------------------------------------------------
|
||||
A_SRC=$(wildcard $(PROJECT_BASE_PATH)/*.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: $(VARIANT)
|
||||
|
||||
$(VARIANT): create_output $(OUTPUT_LIB)
|
||||
|
||||
.PHONY: create_output
|
||||
create_output:
|
||||
@echo ------------------------------------------------------------------------------------
|
||||
@echo --- Preparing $(VARIANT) files in $(OUTPUT_PATH) $(OUTPUT_BIN)
|
||||
@echo ------------------------------------------------------------------------------------
|
||||
# @echo *$(INCLUDES)
|
||||
# @echo -------------------------
|
||||
# @echo *$(C_SRC)
|
||||
# @echo -------------------------
|
||||
# @echo *$(C_OBJ)
|
||||
# @echo -------------------------
|
||||
# @echo *$(addprefix $(OUTPUT_PATH)/, $(C_OBJ))
|
||||
# @echo -------------------------
|
||||
# @echo *$(CPP_SRC)
|
||||
# @echo -------------------------
|
||||
# @echo *$(CPP_OBJ)
|
||||
# @echo -------------------------
|
||||
# @echo *$(addprefix $(OUTPUT_PATH)/, $(CPP_OBJ))
|
||||
# @echo -------------------------
|
||||
# @echo *$(A_SRC)
|
||||
# @echo -------------------------
|
||||
|
||||
-@mkdir $(OUTPUT_PATH) 1>NUL 2>&1
|
||||
@echo ------------------------------------------------------------------------------------
|
||||
|
||||
$(addprefix $(OUTPUT_PATH)/,$(C_OBJ)): $(OUTPUT_PATH)/%.o: %.c
|
||||
# "$(CC)" -v -c $(CFLAGS) $< -o $@
|
||||
@"$(CC)" -c $(CFLAGS) $< -o $@
|
||||
|
||||
#$(addprefix $(OUTPUT_PATH)/,$(CPP_OBJ)): $(OUTPUT_PATH)/%.d: %.o
|
||||
# "$(CC)" -M -MF $@.d -c $(CPPFLAGS) $<
|
||||
|
||||
$(addprefix $(OUTPUT_PATH)/,$(CPP_OBJ)): $(OUTPUT_PATH)/%.o: %.cpp
|
||||
# "$(CC)" -xc++ -c $(CPPFLAGS) $< -o $@
|
||||
@"$(CC)" -xc++ -c $(CPPFLAGS) $< -o $@
|
||||
|
||||
$(addprefix $(OUTPUT_PATH)/,$(A_OBJ)): $(OUTPUT_PATH)/%.o: %.s
|
||||
@"$(AS)" -c $(ASFLAGS) $< -o $@
|
||||
|
||||
$(OUTPUT_LIB): $(addprefix $(OUTPUT_PATH)/, $(C_OBJ)) $(addprefix $(OUTPUT_PATH)/, $(CPP_OBJ)) $(addprefix $(OUTPUT_PATH)/, $(A_OBJ))
|
||||
@echo ------------------------------------------------------------------------------------
|
||||
@"$(AR)" -r "$(OUTPUT_BIN)/$@" $^
|
||||
@"$(NM)" "$(OUTPUT_BIN)/$@" > "$(OUTPUT_BIN)/$@.txt"
|
||||
@echo ------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
@echo --- Cleaning $(VARIANT) files [$(OUTPUT_PATH)$(SEP)*.o]
|
||||
-@$(RM) $(OUTPUT_PATH) 1>NUL 2>&1
|
||||
-@$(RM) $(OUTPUT_BIN)/$(OUTPUT_LIB) 1>NUL 2>&1
|
@ -1,185 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2012 Arduino. All right reserved.
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2.1 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
|
||||
# Makefile for compiling libArduino
|
||||
.SUFFIXES: .o .a .c .s
|
||||
|
||||
CHIP=__SAM3U4E__
|
||||
VARIANT=arduino_due_u
|
||||
LIBNAME=libarduino_$(VARIANT)
|
||||
TOOLCHAIN=gcc
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Path
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
# Output directories
|
||||
OUTPUT_BIN = ..
|
||||
|
||||
# Libraries
|
||||
PROJECT_BASE_PATH = ..
|
||||
PROJECT_BASE_PATH_USB = ../USB
|
||||
SYSTEM_PATH = ../../../system
|
||||
CMSIS_ROOT_PATH = $(SYSTEM_PATH)/CMSIS
|
||||
CMSIS_ARM_PATH=$(CMSIS_ROOT_PATH)/CMSIS/Include
|
||||
CMSIS_ATMEL_PATH=$(CMSIS_ROOT_PATH)/Device/ATMEL
|
||||
CMSIS_CHIP_PATH=$(CMSIS_ROOT_PATH)/Device/ATMEL/$(CHIP_SERIE)
|
||||
VARIANT_PATH = ../../../variants/$(VARIANT)
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Files
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
#vpath %.h $(PROJECT_BASE_PATH) $(PROJECT_BASE_PATH_USB) $(SYSTEM_PATH) $(VARIANT_PATH)
|
||||
vpath %.c $(PROJECT_BASE_PATH) $(PROJECT_BASE_PATH_USB) $(VARIANT_PATH)
|
||||
vpath %.cpp $(PROJECT_BASE_PATH) $(PROJECT_BASE_PATH_USB)
|
||||
|
||||
VPATH+=$(PROJECT_BASE_PATH)
|
||||
|
||||
INCLUDES =
|
||||
INCLUDES += -I$(PROJECT_BASE_PATH)
|
||||
INCLUDES += -I$(PROJECT_BASE_PATH_USB)
|
||||
INCLUDES += -I$(VARIANT_PATH)
|
||||
INCLUDES += -I$(CMSIS_ARM_PATH)
|
||||
INCLUDES += -I$(CMSIS_ATMEL_PATH)
|
||||
INCLUDES += -I$(SYSTEM_PATH)
|
||||
INCLUDES += -I$(SYSTEM_PATH)/libsam
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
ifdef DEBUG
|
||||
include debug.mk
|
||||
else
|
||||
include release.mk
|
||||
endif
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Tools
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
include $(TOOLCHAIN).mk
|
||||
|
||||
CFLAGS += -DUSB_VID=0x2341 -DUSB_PID=0x003e
|
||||
CPPFLAGS += -DUSB_VID=0x2341 -DUSB_PID=0x003e
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
ifdef DEBUG
|
||||
OUTPUT_OBJ=debug
|
||||
OUTPUT_LIB=$(LIBNAME)_$(TOOLCHAIN)_dbg.a
|
||||
else
|
||||
OUTPUT_OBJ=release
|
||||
OUTPUT_LIB=$(LIBNAME)_$(TOOLCHAIN)_rel.a
|
||||
endif
|
||||
|
||||
OUTPUT_PATH=$(OUTPUT_OBJ)_$(VARIANT)
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# C source files and objects
|
||||
#-------------------------------------------------------------------------------
|
||||
C_SRC=$(wildcard $(PROJECT_BASE_PATH)/*.c)
|
||||
#C_SRC=$(wildcard $(PROJECT_BASE_PATH)/*.c $(PROJECT_BASE_PATH_USB)/*.c)
|
||||
|
||||
C_OBJ_TEMP = $(patsubst %.c, %.o, $(notdir $(C_SRC)))
|
||||
|
||||
# during development, remove some files
|
||||
C_OBJ_FILTER=
|
||||
|
||||
C_OBJ=$(filter-out $(C_OBJ_FILTER), $(C_OBJ_TEMP))
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# CPP source files and objects
|
||||
#-------------------------------------------------------------------------------
|
||||
CPP_SRC=$(wildcard $(PROJECT_BASE_PATH)/*.cpp)
|
||||
#CPP_SRC=$(wildcard $(PROJECT_BASE_PATH)/*.cpp $(PROJECT_BASE_PATH_USB)/*.cpp)
|
||||
|
||||
CPP_OBJ_TEMP = $(patsubst %.cpp, %.o, $(notdir $(CPP_SRC)))
|
||||
|
||||
# during development, remove some files
|
||||
CPP_OBJ_FILTER=
|
||||
|
||||
CPP_OBJ=$(filter-out $(CPP_OBJ_FILTER), $(CPP_OBJ_TEMP))
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Assembler source files and objects
|
||||
#-------------------------------------------------------------------------------
|
||||
A_SRC=$(wildcard $(PROJECT_BASE_PATH)/*.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: $(VARIANT)
|
||||
|
||||
$(VARIANT): create_output $(OUTPUT_LIB)
|
||||
|
||||
.PHONY: create_output
|
||||
create_output:
|
||||
@echo ------------------------------------------------------------------------------------
|
||||
@echo --- Preparing $(VARIANT) files in $(OUTPUT_PATH) $(OUTPUT_BIN)
|
||||
@echo ------------------------------------------------------------------------------------
|
||||
# @echo *$(INCLUDES)
|
||||
# @echo -------------------------
|
||||
# @echo *$(C_SRC)
|
||||
# @echo -------------------------
|
||||
# @echo *$(C_OBJ)
|
||||
# @echo -------------------------
|
||||
# @echo *$(addprefix $(OUTPUT_PATH)/, $(C_OBJ))
|
||||
# @echo -------------------------
|
||||
# @echo *$(CPP_SRC)
|
||||
# @echo -------------------------
|
||||
# @echo *$(CPP_OBJ)
|
||||
# @echo -------------------------
|
||||
# @echo *$(addprefix $(OUTPUT_PATH)/, $(CPP_OBJ))
|
||||
# @echo -------------------------
|
||||
# @echo *$(A_SRC)
|
||||
# @echo -------------------------
|
||||
|
||||
-@mkdir $(OUTPUT_PATH) 1>NUL 2>&1
|
||||
@echo ------------------------------------------------------------------------------------
|
||||
|
||||
$(addprefix $(OUTPUT_PATH)/,$(C_OBJ)): $(OUTPUT_PATH)/%.o: %.c
|
||||
# "$(CC)" -v -c $(CFLAGS) $< -o $@
|
||||
@"$(CC)" -c $(CFLAGS) $< -o $@
|
||||
|
||||
#$(addprefix $(OUTPUT_PATH)/,$(CPP_OBJ)): $(OUTPUT_PATH)/%.d: %.o
|
||||
# "$(CC)" -M -MF $@.d -c $(CPPFLAGS) $<
|
||||
|
||||
$(addprefix $(OUTPUT_PATH)/,$(CPP_OBJ)): $(OUTPUT_PATH)/%.o: %.cpp
|
||||
# "$(CC)" -xc++ -c $(CPPFLAGS) $< -o $@
|
||||
@"$(CC)" -xc++ -c $(CPPFLAGS) $< -o $@
|
||||
|
||||
$(addprefix $(OUTPUT_PATH)/,$(A_OBJ)): $(OUTPUT_PATH)/%.o: %.s
|
||||
@"$(AS)" -c $(ASFLAGS) $< -o $@
|
||||
|
||||
$(OUTPUT_LIB): $(addprefix $(OUTPUT_PATH)/, $(C_OBJ)) $(addprefix $(OUTPUT_PATH)/, $(CPP_OBJ)) $(addprefix $(OUTPUT_PATH)/, $(A_OBJ))
|
||||
@echo ------------------------------------------------------------------------------------
|
||||
@"$(AR)" -r "$(OUTPUT_BIN)/$@" $^
|
||||
@"$(NM)" "$(OUTPUT_BIN)/$@" > "$(OUTPUT_BIN)/$@.txt"
|
||||
@echo ------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
@echo --- Cleaning $(VARIANT) files [$(OUTPUT_PATH)$(SEP)*.o]
|
||||
-@$(RM) $(OUTPUT_PATH) 1>NUL 2>&1
|
||||
-@$(RM) $(OUTPUT_BIN)/$(OUTPUT_LIB) 1>NUL 2>&1
|
@ -1,185 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2012 Arduino. All right reserved.
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2.1 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
|
||||
# Makefile for compiling libArduino
|
||||
.SUFFIXES: .o .a .c .s
|
||||
|
||||
CHIP=__SAM3X8E__
|
||||
VARIANT=arduino_due_x
|
||||
LIBNAME=libarduino_$(VARIANT)
|
||||
TOOLCHAIN=gcc
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Path
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
# Output directories
|
||||
OUTPUT_BIN = ..
|
||||
|
||||
# Libraries
|
||||
PROJECT_BASE_PATH = ..
|
||||
PROJECT_BASE_PATH_USB = ../USB
|
||||
PROJECT_BASE_PATH_USB_HOST = ../../../system/USBHost
|
||||
SYSTEM_PATH = ../../../system
|
||||
CMSIS_ROOT_PATH = $(SYSTEM_PATH)/CMSIS
|
||||
CMSIS_ARM_PATH=$(CMSIS_ROOT_PATH)/CMSIS/Include
|
||||
CMSIS_ATMEL_PATH=$(CMSIS_ROOT_PATH)/Device/ATMEL
|
||||
CMSIS_CHIP_PATH=$(CMSIS_ROOT_PATH)/Device/ATMEL/$(CHIP_SERIE)
|
||||
VARIANT_PATH = ../../../variants/$(VARIANT)
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Files
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
#vpath %.h $(PROJECT_BASE_PATH) $(PROJECT_BASE_PATH_USB) $(PROJECT_BASE_PATH_USB_HOST) $(SYSTEM_PATH) $(VARIANT_PATH)
|
||||
vpath %.c $(PROJECT_BASE_PATH) $(PROJECT_BASE_PATH_USB) $(PROJECT_BASE_PATH_USB_HOST) $(VARIANT_PATH)
|
||||
vpath %.cpp $(PROJECT_BASE_PATH) $(PROJECT_BASE_PATH_USB) $(PROJECT_BASE_PATH_USB_HOST)
|
||||
|
||||
VPATH+=$(PROJECT_BASE_PATH)
|
||||
|
||||
INCLUDES =
|
||||
INCLUDES += -I$(PROJECT_BASE_PATH)
|
||||
INCLUDES += -I$(PROJECT_BASE_PATH_USB)
|
||||
INCLUDES += -I$(PROJECT_BASE_PATH_USB_HOST)
|
||||
INCLUDES += -I$(VARIANT_PATH)
|
||||
INCLUDES += -I$(CMSIS_ARM_PATH)
|
||||
INCLUDES += -I$(CMSIS_ATMEL_PATH)
|
||||
INCLUDES += -I$(SYSTEM_PATH)
|
||||
INCLUDES += -I$(SYSTEM_PATH)/libsam
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
ifdef DEBUG
|
||||
include debug.mk
|
||||
else
|
||||
include release.mk
|
||||
endif
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Tools
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
include $(TOOLCHAIN).mk
|
||||
|
||||
CFLAGS += -DUSB_VID=0x2341 -DUSB_PID=0x003e
|
||||
CPPFLAGS += -DUSB_VID=0x2341 -DUSB_PID=0x003e
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
ifdef DEBUG
|
||||
OUTPUT_OBJ=debug
|
||||
OUTPUT_LIB=$(LIBNAME)_$(TOOLCHAIN)_dbg.a
|
||||
else
|
||||
OUTPUT_OBJ=release
|
||||
OUTPUT_LIB=$(LIBNAME)_$(TOOLCHAIN)_rel.a
|
||||
endif
|
||||
|
||||
OUTPUT_PATH=$(OUTPUT_OBJ)_$(VARIANT)
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# C source files and objects
|
||||
#-------------------------------------------------------------------------------
|
||||
C_SRC=$(wildcard $(PROJECT_BASE_PATH)/*.c $(PROJECT_BASE_PATH_USB)/*.c $(PROJECT_BASE_PATH_USB_HOST)/*.c)
|
||||
|
||||
C_OBJ_TEMP = $(patsubst %.c, %.o, $(notdir $(C_SRC)))
|
||||
|
||||
# during development, remove some files
|
||||
C_OBJ_FILTER=
|
||||
|
||||
C_OBJ=$(filter-out $(C_OBJ_FILTER), $(C_OBJ_TEMP))
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# CPP source files and objects
|
||||
#-------------------------------------------------------------------------------
|
||||
CPP_SRC=$(wildcard $(PROJECT_BASE_PATH)/*.cpp $(PROJECT_BASE_PATH_USB)/*.cpp $(PROJECT_BASE_PATH_USB_HOST)/*.cpp)
|
||||
|
||||
CPP_OBJ_TEMP = $(patsubst %.cpp, %.o, $(notdir $(CPP_SRC)))
|
||||
|
||||
# during development, remove some files
|
||||
CPP_OBJ_FILTER=
|
||||
|
||||
CPP_OBJ=$(filter-out $(CPP_OBJ_FILTER), $(CPP_OBJ_TEMP))
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Assembler source files and objects
|
||||
#-------------------------------------------------------------------------------
|
||||
A_SRC=$(wildcard $(PROJECT_BASE_PATH)/*.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: $(VARIANT)
|
||||
|
||||
$(VARIANT): create_output $(OUTPUT_LIB)
|
||||
|
||||
.PHONY: create_output
|
||||
create_output:
|
||||
@echo ------------------------------------------------------------------------------------
|
||||
@echo --- Preparing $(VARIANT) files in $(OUTPUT_PATH) $(OUTPUT_BIN)
|
||||
@echo ------------------------------------------------------------------------------------
|
||||
# @echo *$(INCLUDES)
|
||||
# @echo -------------------------
|
||||
# @echo *$(C_SRC)
|
||||
# @echo -------------------------
|
||||
# @echo *$(C_OBJ)
|
||||
# @echo -------------------------
|
||||
# @echo *$(addprefix $(OUTPUT_PATH)/, $(C_OBJ))
|
||||
# @echo -------------------------
|
||||
# @echo *$(CPP_SRC)
|
||||
# @echo -------------------------
|
||||
# @echo *$(CPP_OBJ)
|
||||
# @echo -------------------------
|
||||
# @echo *$(addprefix $(OUTPUT_PATH)/, $(CPP_OBJ))
|
||||
# @echo -------------------------
|
||||
# @echo *$(A_SRC)
|
||||
# @echo -------------------------
|
||||
|
||||
-@mkdir $(OUTPUT_PATH) 1>NUL 2>&1
|
||||
@echo ------------------------------------------------------------------------------------
|
||||
|
||||
$(addprefix $(OUTPUT_PATH)/,$(C_OBJ)): $(OUTPUT_PATH)/%.o: %.c
|
||||
# "$(CC)" -v -c $(CFLAGS) $< -o $@
|
||||
@"$(CC)" -c $(CFLAGS) $< -o $@
|
||||
|
||||
#$(addprefix $(OUTPUT_PATH)/,$(CPP_OBJ)): $(OUTPUT_PATH)/%.d: %.o
|
||||
# "$(CC)" -M -MF $@.d -c $(CPPFLAGS) $<
|
||||
|
||||
$(addprefix $(OUTPUT_PATH)/,$(CPP_OBJ)): $(OUTPUT_PATH)/%.o: %.cpp
|
||||
# "$(CC)" -xc++ -c $(CPPFLAGS) $< -o $@
|
||||
@"$(CC)" -xc++ -c $(CPPFLAGS) $< -o $@
|
||||
|
||||
$(addprefix $(OUTPUT_PATH)/,$(A_OBJ)): $(OUTPUT_PATH)/%.o: %.s
|
||||
@"$(AS)" -c $(ASFLAGS) $< -o $@
|
||||
|
||||
$(OUTPUT_LIB): $(addprefix $(OUTPUT_PATH)/, $(C_OBJ)) $(addprefix $(OUTPUT_PATH)/, $(CPP_OBJ)) $(addprefix $(OUTPUT_PATH)/, $(A_OBJ))
|
||||
@echo ------------------------------------------------------------------------------------
|
||||
@"$(AR)" -r "$(OUTPUT_BIN)/$@" $^
|
||||
@"$(NM)" "$(OUTPUT_BIN)/$@" > "$(OUTPUT_BIN)/$@.txt"
|
||||
@echo ------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
@echo --- Cleaning $(VARIANT) files [$(OUTPUT_PATH)$(SEP)*.o]
|
||||
-@$(RM) $(OUTPUT_PATH) 1>NUL 2>&1
|
||||
-@$(RM) $(OUTPUT_BIN)/$(OUTPUT_LIB) 1>NUL 2>&1
|
@ -1,183 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2012 Arduino. All right reserved.
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2.1 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
|
||||
# Makefile for compiling libArduino
|
||||
.SUFFIXES: .o .a .c .s
|
||||
|
||||
CHIP=__SAM3S4C__
|
||||
VARIANT=sam3s_ek
|
||||
LIBNAME=libarduino_$(VARIANT)
|
||||
TOOLCHAIN=gcc
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Path
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
# Output directories
|
||||
OUTPUT_BIN = ..
|
||||
|
||||
# Libraries
|
||||
PROJECT_BASE_PATH = ..
|
||||
PROJECT_BASE_PATH_USB = ../USB
|
||||
SYSTEM_PATH = ../../../system
|
||||
CMSIS_ROOT_PATH = $(SYSTEM_PATH)/CMSIS
|
||||
CMSIS_ARM_PATH=$(CMSIS_ROOT_PATH)/CMSIS/Include
|
||||
CMSIS_ATMEL_PATH=$(CMSIS_ROOT_PATH)/Device/ATMEL
|
||||
CMSIS_CHIP_PATH=$(CMSIS_ROOT_PATH)/Device/ATMEL/$(CHIP_SERIE)
|
||||
VARIANT_PATH = ../../../../../atmel/sam/variants/$(VARIANT)
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Files
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
#vpath %.h $(PROJECT_BASE_PATH) $(PROJECT_BASE_PATH_USB) $(SYSTEM_PATH) $(VARIANT_PATH)
|
||||
vpath %.c $(PROJECT_BASE_PATH) $(PROJECT_BASE_PATH_USB) $(VARIANT_PATH)
|
||||
vpath %.cpp $(PROJECT_BASE_PATH) $(PROJECT_BASE_PATH_USB)
|
||||
|
||||
VPATH+=$(PROJECT_BASE_PATH)
|
||||
|
||||
INCLUDES =
|
||||
INCLUDES += -I$(PROJECT_BASE_PATH)
|
||||
INCLUDES += -I$(PROJECT_BASE_PATH_USB)
|
||||
INCLUDES += -I$(VARIANT_PATH)
|
||||
INCLUDES += -I$(CMSIS_ARM_PATH)
|
||||
INCLUDES += -I$(CMSIS_ATMEL_PATH)
|
||||
INCLUDES += -I$(SYSTEM_PATH)
|
||||
INCLUDES += -I$(SYSTEM_PATH)/libsam
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
ifdef DEBUG
|
||||
include debug.mk
|
||||
else
|
||||
include release.mk
|
||||
endif
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Tools
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
include $(TOOLCHAIN).mk
|
||||
|
||||
CFLAGS += -DUSB_VID=0x2341 -DUSB_PID=0xcafe
|
||||
CPPFLAGS += -DUSB_VID=0x2341 -DUSB_PID=0xcafe
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
ifdef DEBUG
|
||||
OUTPUT_OBJ=debug
|
||||
OUTPUT_LIB=$(LIBNAME)_$(TOOLCHAIN)_dbg.a
|
||||
else
|
||||
OUTPUT_OBJ=release
|
||||
OUTPUT_LIB=$(LIBNAME)_$(TOOLCHAIN)_rel.a
|
||||
endif
|
||||
|
||||
OUTPUT_PATH=$(OUTPUT_OBJ)_$(VARIANT)
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# C source files and objects
|
||||
#-------------------------------------------------------------------------------
|
||||
C_SRC=$(wildcard $(PROJECT_BASE_PATH)/*.c $(PROJECT_BASE_PATH_USB)/*.c)
|
||||
|
||||
C_OBJ_TEMP = $(patsubst %.c, %.o, $(notdir $(C_SRC)))
|
||||
|
||||
# during development, remove some files
|
||||
C_OBJ_FILTER=
|
||||
|
||||
C_OBJ=$(filter-out $(C_OBJ_FILTER), $(C_OBJ_TEMP))
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# CPP source files and objects
|
||||
#-------------------------------------------------------------------------------
|
||||
CPP_SRC=$(wildcard $(PROJECT_BASE_PATH)/*.cpp $(PROJECT_BASE_PATH_USB)/*.cpp)
|
||||
|
||||
CPP_OBJ_TEMP = $(patsubst %.cpp, %.o, $(notdir $(CPP_SRC)))
|
||||
|
||||
# during development, remove some files
|
||||
CPP_OBJ_FILTER=
|
||||
|
||||
CPP_OBJ=$(filter-out $(CPP_OBJ_FILTER), $(CPP_OBJ_TEMP))
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Assembler source files and objects
|
||||
#-------------------------------------------------------------------------------
|
||||
A_SRC=$(wildcard $(PROJECT_BASE_PATH)/*.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: $(VARIANT)
|
||||
|
||||
$(VARIANT): create_output $(OUTPUT_LIB)
|
||||
|
||||
.PHONY: create_output
|
||||
create_output:
|
||||
@echo ------------------------------------------------------------------------------------
|
||||
@echo --- Preparing $(VARIANT) files in $(OUTPUT_PATH) $(OUTPUT_BIN)
|
||||
@echo ------------------------------------------------------------------------------------
|
||||
# @echo *$(INCLUDES)
|
||||
# @echo -------------------------
|
||||
# @echo *$(C_SRC)
|
||||
# @echo -------------------------
|
||||
# @echo *$(C_OBJ)
|
||||
# @echo -------------------------
|
||||
# @echo *$(addprefix $(OUTPUT_PATH)/, $(C_OBJ))
|
||||
# @echo -------------------------
|
||||
# @echo *$(CPP_SRC)
|
||||
# @echo -------------------------
|
||||
# @echo *$(CPP_OBJ)
|
||||
# @echo -------------------------
|
||||
# @echo *$(addprefix $(OUTPUT_PATH)/, $(CPP_OBJ))
|
||||
# @echo -------------------------
|
||||
# @echo *$(A_SRC)
|
||||
# @echo -------------------------
|
||||
|
||||
-@mkdir $(OUTPUT_PATH) 1>NUL 2>&1
|
||||
@echo ------------------------------------------------------------------------------------
|
||||
|
||||
$(addprefix $(OUTPUT_PATH)/,$(C_OBJ)): $(OUTPUT_PATH)/%.o: %.c
|
||||
# "$(CC)" -v -c $(CFLAGS) $< -o $@
|
||||
@"$(CC)" -c $(CFLAGS) $< -o $@
|
||||
|
||||
#$(addprefix $(OUTPUT_PATH)/,$(CPP_OBJ)): $(OUTPUT_PATH)/%.d: %.o
|
||||
# "$(CC)" -M -MF $@.d -c $(CPPFLAGS) $<
|
||||
|
||||
$(addprefix $(OUTPUT_PATH)/,$(CPP_OBJ)): $(OUTPUT_PATH)/%.o: %.cpp
|
||||
# "$(CC)" -xc++ -c $(CPPFLAGS) $< -o $@
|
||||
@"$(CC)" -xc++ -c $(CPPFLAGS) $< -o $@
|
||||
|
||||
$(addprefix $(OUTPUT_PATH)/,$(A_OBJ)): $(OUTPUT_PATH)/%.o: %.s
|
||||
@"$(AS)" -c $(ASFLAGS) $< -o $@
|
||||
|
||||
$(OUTPUT_LIB): $(addprefix $(OUTPUT_PATH)/, $(C_OBJ)) $(addprefix $(OUTPUT_PATH)/, $(CPP_OBJ)) $(addprefix $(OUTPUT_PATH)/, $(A_OBJ))
|
||||
@echo ------------------------------------------------------------------------------------
|
||||
@"$(AR)" -r "$(OUTPUT_BIN)/$@" $^
|
||||
@"$(NM)" "$(OUTPUT_BIN)/$@" > "$(OUTPUT_BIN)/$@.txt"
|
||||
@echo ------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
@echo --- Cleaning $(VARIANT) files [$(OUTPUT_PATH)$(SEP)*.o]
|
||||
-@$(RM) $(OUTPUT_PATH) 1>NUL 2>&1
|
||||
-@$(RM) $(OUTPUT_BIN)/$(OUTPUT_LIB) 1>NUL 2>&1
|
@ -1,183 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2012 Arduino. All right reserved.
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2.1 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
|
||||
# Makefile for compiling libArduino
|
||||
.SUFFIXES: .o .a .c .s
|
||||
|
||||
CHIP=__SAM3U4E__
|
||||
VARIANT=sam3u_ek
|
||||
LIBNAME=libarduino_$(VARIANT)
|
||||
TOOLCHAIN=gcc
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Path
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
# Output directories
|
||||
OUTPUT_BIN = ..
|
||||
|
||||
# Libraries
|
||||
PROJECT_BASE_PATH = ..
|
||||
PROJECT_BASE_PATH_USB = ../USB
|
||||
SYSTEM_PATH = ../../../system
|
||||
CMSIS_ROOT_PATH = $(SYSTEM_PATH)/CMSIS
|
||||
CMSIS_ARM_PATH=$(CMSIS_ROOT_PATH)/CMSIS/Include
|
||||
CMSIS_ATMEL_PATH=$(CMSIS_ROOT_PATH)/Device/ATMEL
|
||||
CMSIS_CHIP_PATH=$(CMSIS_ROOT_PATH)/Device/ATMEL/$(CHIP_SERIE)
|
||||
VARIANT_PATH = ../../../../../atmel/sam/variants/$(VARIANT)
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Files
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
vpath %.h $(PROJECT_BASE_PATH) $(PROJECT_BASE_PATH_USB) $(SYSTEM_PATH) $(VARIANT_PATH)
|
||||
vpath %.c $(PROJECT_BASE_PATH) $(PROJECT_BASE_PATH_USB) $(VARIANT_PATH)
|
||||
vpath %.cpp $(PROJECT_BASE_PATH) $(PROJECT_BASE_PATH_USB)
|
||||
|
||||
VPATH+=$(PROJECT_BASE_PATH)
|
||||
|
||||
INCLUDES =
|
||||
INCLUDES += -I$(PROJECT_BASE_PATH)
|
||||
INCLUDES += -I$(PROJECT_BASE_PATH_USB)
|
||||
INCLUDES += -I$(VARIANT_PATH)
|
||||
INCLUDES += -I$(CMSIS_ARM_PATH)
|
||||
INCLUDES += -I$(CMSIS_ATMEL_PATH)
|
||||
INCLUDES += -I$(SYSTEM_PATH)
|
||||
INCLUDES += -I$(SYSTEM_PATH)/libsam
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
ifdef DEBUG
|
||||
include debug.mk
|
||||
else
|
||||
include release.mk
|
||||
endif
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Tools
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
include $(TOOLCHAIN).mk
|
||||
|
||||
CFLAGS += -DUSB_VID=0x2341 -DUSB_PID=0xcafe
|
||||
CPPFLAGS += -DUSB_VID=0x2341 -DUSB_PID=0xcafe
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
ifdef DEBUG
|
||||
OUTPUT_OBJ=debug
|
||||
OUTPUT_LIB=$(LIBNAME)_$(TOOLCHAIN)_dbg.a
|
||||
else
|
||||
OUTPUT_OBJ=release
|
||||
OUTPUT_LIB=$(LIBNAME)_$(TOOLCHAIN)_rel.a
|
||||
endif
|
||||
|
||||
OUTPUT_PATH=$(OUTPUT_OBJ)_$(VARIANT)
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# C source files and objects
|
||||
#-------------------------------------------------------------------------------
|
||||
C_SRC=$(wildcard $(PROJECT_BASE_PATH)/*.c $(PROJECT_BASE_PATH_USB)/*.c)
|
||||
|
||||
C_OBJ_TEMP = $(patsubst %.c, %.o, $(notdir $(C_SRC)))
|
||||
|
||||
# during development, remove some files
|
||||
C_OBJ_FILTER=
|
||||
|
||||
C_OBJ=$(filter-out $(C_OBJ_FILTER), $(C_OBJ_TEMP))
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# CPP source files and objects
|
||||
#-------------------------------------------------------------------------------
|
||||
CPP_SRC=$(wildcard $(PROJECT_BASE_PATH)/*.cpp $(PROJECT_BASE_PATH_USB)/*.cpp)
|
||||
|
||||
CPP_OBJ_TEMP = $(patsubst %.cpp, %.o, $(notdir $(CPP_SRC)))
|
||||
|
||||
# during development, remove some files
|
||||
CPP_OBJ_FILTER=
|
||||
|
||||
CPP_OBJ=$(filter-out $(CPP_OBJ_FILTER), $(CPP_OBJ_TEMP))
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Assembler source files and objects
|
||||
#-------------------------------------------------------------------------------
|
||||
A_SRC=$(wildcard $(PROJECT_BASE_PATH)/*.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: $(VARIANT)
|
||||
|
||||
$(VARIANT): create_output $(OUTPUT_LIB)
|
||||
|
||||
.PHONY: create_output
|
||||
create_output:
|
||||
@echo ------------------------------------------------------------------------------------
|
||||
@echo --- Preparing $(VARIANT) files in $(OUTPUT_PATH) $(OUTPUT_BIN)
|
||||
@echo ------------------------------------------------------------------------------------
|
||||
# @echo *$(INCLUDES)
|
||||
# @echo -------------------------
|
||||
# @echo *$(C_SRC)
|
||||
# @echo -------------------------
|
||||
# @echo *$(C_OBJ)
|
||||
# @echo -------------------------
|
||||
# @echo *$(addprefix $(OUTPUT_PATH)/, $(C_OBJ))
|
||||
# @echo -------------------------
|
||||
# @echo *$(CPP_SRC)
|
||||
# @echo -------------------------
|
||||
# @echo *$(CPP_OBJ)
|
||||
# @echo -------------------------
|
||||
# @echo *$(addprefix $(OUTPUT_PATH)/, $(CPP_OBJ))
|
||||
# @echo -------------------------
|
||||
# @echo *$(A_SRC)
|
||||
# @echo -------------------------
|
||||
|
||||
-@mkdir $(OUTPUT_PATH) 1>NUL 2>&1
|
||||
@echo ------------------------------------------------------------------------------------
|
||||
|
||||
$(addprefix $(OUTPUT_PATH)/,$(C_OBJ)): $(OUTPUT_PATH)/%.o: %.c
|
||||
# "$(CC)" -v -c $(CFLAGS) $< -o $@
|
||||
@"$(CC)" -c $(CFLAGS) $< -o $@
|
||||
|
||||
#$(addprefix $(OUTPUT_PATH)/,$(CPP_OBJ)): $(OUTPUT_PATH)/%.d: %.o
|
||||
# "$(CC)" -M -MF $@.d -c $(CPPFLAGS) $<
|
||||
|
||||
$(addprefix $(OUTPUT_PATH)/,$(CPP_OBJ)): $(OUTPUT_PATH)/%.o: %.cpp
|
||||
# "$(CC)" -xc++ -c $(CPPFLAGS) $< -o $@
|
||||
@"$(CC)" -xc++ -c $(CPPFLAGS) $< -o $@
|
||||
|
||||
$(addprefix $(OUTPUT_PATH)/,$(A_OBJ)): $(OUTPUT_PATH)/%.o: %.s
|
||||
@"$(AS)" -c $(ASFLAGS) $< -o $@
|
||||
|
||||
$(OUTPUT_LIB): $(addprefix $(OUTPUT_PATH)/, $(C_OBJ)) $(addprefix $(OUTPUT_PATH)/, $(CPP_OBJ)) $(addprefix $(OUTPUT_PATH)/, $(A_OBJ))
|
||||
@echo ------------------------------------------------------------------------------------
|
||||
@"$(AR)" -r "$(OUTPUT_BIN)/$@" $^
|
||||
@"$(NM)" "$(OUTPUT_BIN)/$@" > "$(OUTPUT_BIN)/$@.txt"
|
||||
@echo ------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
@echo --- Cleaning $(VARIANT) files [$(OUTPUT_PATH)$(SEP)*.o]
|
||||
-@$(RM) $(OUTPUT_PATH) 1>NUL 2>&1
|
||||
-@$(RM) $(OUTPUT_BIN)/$(OUTPUT_LIB) 1>NUL 2>&1
|
@ -1,183 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2012 Arduino. All right reserved.
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2.1 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
|
||||
# Makefile for compiling libArduino
|
||||
.SUFFIXES: .o .a .c .s
|
||||
|
||||
CHIP=__SAM3X8H__
|
||||
VARIANT=sam3x_ek
|
||||
LIBNAME=libarduino_$(VARIANT)
|
||||
TOOLCHAIN=gcc
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Path
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
# Output directories
|
||||
OUTPUT_BIN = ..
|
||||
|
||||
# Libraries
|
||||
PROJECT_BASE_PATH = ..
|
||||
PROJECT_BASE_PATH_USB = ../USB
|
||||
SYSTEM_PATH = ../../../system
|
||||
CMSIS_ROOT_PATH = $(SYSTEM_PATH)/CMSIS
|
||||
CMSIS_ARM_PATH=$(CMSIS_ROOT_PATH)/CMSIS/Include
|
||||
CMSIS_ATMEL_PATH=$(CMSIS_ROOT_PATH)/Device/ATMEL
|
||||
CMSIS_CHIP_PATH=$(CMSIS_ROOT_PATH)/Device/ATMEL/$(CHIP_SERIE)
|
||||
VARIANT_PATH = ../../../../../atmel/sam/variants/$(VARIANT)
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Files
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
vpath %.h $(PROJECT_BASE_PATH) $(PROJECT_BASE_PATH_USB) $(SYSTEM_PATH) $(VARIANT_PATH)
|
||||
vpath %.c $(PROJECT_BASE_PATH) $(PROJECT_BASE_PATH_USB) $(VARIANT_PATH)
|
||||
vpath %.cpp $(PROJECT_BASE_PATH) $(PROJECT_BASE_PATH_USB)
|
||||
|
||||
VPATH+=$(PROJECT_BASE_PATH)
|
||||
|
||||
INCLUDES =
|
||||
INCLUDES += -I$(PROJECT_BASE_PATH)
|
||||
INCLUDES += -I$(PROJECT_BASE_PATH_USB)
|
||||
INCLUDES += -I$(VARIANT_PATH)
|
||||
INCLUDES += -I$(CMSIS_ARM_PATH)
|
||||
INCLUDES += -I$(CMSIS_ATMEL_PATH)
|
||||
INCLUDES += -I$(SYSTEM_PATH)
|
||||
INCLUDES += -I$(SYSTEM_PATH)/libsam
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
ifdef DEBUG
|
||||
include debug.mk
|
||||
else
|
||||
include release.mk
|
||||
endif
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Tools
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
include $(TOOLCHAIN).mk
|
||||
|
||||
CFLAGS += -DUSB_VID=0x2341 -DUSB_PID=0xcafe
|
||||
CPPFLAGS += -DUSB_VID=0x2341 -DUSB_PID=0xcafe
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
ifdef DEBUG
|
||||
OUTPUT_OBJ=debug
|
||||
OUTPUT_LIB=$(LIBNAME)_$(TOOLCHAIN)_dbg.a
|
||||
else
|
||||
OUTPUT_OBJ=release
|
||||
OUTPUT_LIB=$(LIBNAME)_$(TOOLCHAIN)_rel.a
|
||||
endif
|
||||
|
||||
OUTPUT_PATH=$(OUTPUT_OBJ)_$(VARIANT)
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# C source files and objects
|
||||
#-------------------------------------------------------------------------------
|
||||
C_SRC=$(wildcard $(PROJECT_BASE_PATH)/*.c $(PROJECT_BASE_PATH_USB)/*.c)
|
||||
|
||||
C_OBJ_TEMP = $(patsubst %.c, %.o, $(notdir $(C_SRC)))
|
||||
|
||||
# during development, remove some files
|
||||
C_OBJ_FILTER=
|
||||
|
||||
C_OBJ=$(filter-out $(C_OBJ_FILTER), $(C_OBJ_TEMP))
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# CPP source files and objects
|
||||
#-------------------------------------------------------------------------------
|
||||
CPP_SRC=$(wildcard $(PROJECT_BASE_PATH)/*.cpp $(PROJECT_BASE_PATH_USB)/*.cpp)
|
||||
|
||||
CPP_OBJ_TEMP = $(patsubst %.cpp, %.o, $(notdir $(CPP_SRC)))
|
||||
|
||||
# during development, remove some files
|
||||
CPP_OBJ_FILTER=
|
||||
|
||||
CPP_OBJ=$(filter-out $(CPP_OBJ_FILTER), $(CPP_OBJ_TEMP))
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Assembler source files and objects
|
||||
#-------------------------------------------------------------------------------
|
||||
A_SRC=$(wildcard $(PROJECT_BASE_PATH)/*.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: $(VARIANT)
|
||||
|
||||
$(VARIANT): create_output $(OUTPUT_LIB)
|
||||
|
||||
.PHONY: create_output
|
||||
create_output:
|
||||
@echo ------------------------------------------------------------------------------------
|
||||
@echo --- Preparing $(VARIANT) files in $(OUTPUT_PATH) $(OUTPUT_BIN)
|
||||
@echo ------------------------------------------------------------------------------------
|
||||
# @echo *$(INCLUDES)
|
||||
# @echo -------------------------
|
||||
# @echo *$(C_SRC)
|
||||
# @echo -------------------------
|
||||
# @echo *$(C_OBJ)
|
||||
# @echo -------------------------
|
||||
# @echo *$(addprefix $(OUTPUT_PATH)/, $(C_OBJ))
|
||||
# @echo -------------------------
|
||||
# @echo *$(CPP_SRC)
|
||||
# @echo -------------------------
|
||||
# @echo *$(CPP_OBJ)
|
||||
# @echo -------------------------
|
||||
# @echo *$(addprefix $(OUTPUT_PATH)/, $(CPP_OBJ))
|
||||
# @echo -------------------------
|
||||
# @echo *$(A_SRC)
|
||||
# @echo -------------------------
|
||||
|
||||
-@mkdir $(OUTPUT_PATH) 1>NUL 2>&1
|
||||
@echo ------------------------------------------------------------------------------------
|
||||
|
||||
$(addprefix $(OUTPUT_PATH)/,$(C_OBJ)): $(OUTPUT_PATH)/%.o: %.c
|
||||
# "$(CC)" -v -c $(CFLAGS) $< -o $@
|
||||
@"$(CC)" -c $(CFLAGS) $< -o $@
|
||||
|
||||
#$(addprefix $(OUTPUT_PATH)/,$(CPP_OBJ)): $(OUTPUT_PATH)/%.d: %.o
|
||||
# "$(CC)" -M -MF $@.d -c $(CPPFLAGS) $<
|
||||
|
||||
$(addprefix $(OUTPUT_PATH)/,$(CPP_OBJ)): $(OUTPUT_PATH)/%.o: %.cpp
|
||||
# "$(CC)" -xc++ -c $(CPPFLAGS) $< -o $@
|
||||
@"$(CC)" -xc++ -c $(CPPFLAGS) $< -o $@
|
||||
|
||||
$(addprefix $(OUTPUT_PATH)/,$(A_OBJ)): $(OUTPUT_PATH)/%.o: %.s
|
||||
@"$(AS)" -c $(ASFLAGS) $< -o $@
|
||||
|
||||
$(OUTPUT_LIB): $(addprefix $(OUTPUT_PATH)/, $(C_OBJ)) $(addprefix $(OUTPUT_PATH)/, $(CPP_OBJ)) $(addprefix $(OUTPUT_PATH)/, $(A_OBJ))
|
||||
@echo ------------------------------------------------------------------------------------
|
||||
@"$(AR)" -r "$(OUTPUT_BIN)/$@" $^
|
||||
@"$(NM)" "$(OUTPUT_BIN)/$@" > "$(OUTPUT_BIN)/$@.txt"
|
||||
@echo ------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
@echo --- Cleaning $(VARIANT) files [$(OUTPUT_PATH)$(SEP)*.o]
|
||||
-@$(RM) $(OUTPUT_PATH) 1>NUL 2>&1
|
||||
-@$(RM) $(OUTPUT_BIN)/$(OUTPUT_LIB) 1>NUL 2>&1
|
@ -1,8 +0,0 @@
|
||||
|
||||
# Optimization level
|
||||
# -O1 Optimize
|
||||
# -O2 Optimize even more
|
||||
# -O3 Optimize yet more
|
||||
# -O0 Reduce compilation time and make debugging produce the expected results
|
||||
# -Os Optimize for size
|
||||
OPTIMIZATION = -Os
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,41 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2011 Arduino. All right reserved.
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2.1 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
|
||||
SUBMAKE_OPTIONS=--no-builtin-rules --no-builtin-variables
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Rules
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
all: prod_test_due
|
||||
|
||||
.PHONY: prod_test_due
|
||||
prod_test_due:
|
||||
@echo --- Making prod_test_due
|
||||
@$(MAKE) DEBUG=1 $(SUBMAKE_OPTIONS) -f prod_test_due.mk
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
@echo --- Cleaning prod_test_due
|
||||
@$(MAKE) DEBUG=1 $(SUBMAKE_OPTIONS) -f prod_test_due.mk $@
|
||||
|
||||
.PHONY: debug
|
||||
debug:
|
||||
@echo --- Debugging prod_test_due
|
||||
@$(MAKE) DEBUG=1 $(SUBMAKE_OPTIONS) -f prod_test_due.mk $@
|
||||
|
@ -1,25 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2011 Arduino. All right reserved.
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2.1 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
|
||||
# Optimization level
|
||||
# -O1 Optimize
|
||||
# -O2 Optimize even more
|
||||
# -O3 Optimize yet more
|
||||
# -O0 Reduce compilation time and make debugging produce the expected results
|
||||
# -Os Optimize for size
|
||||
OPTIMIZATION = -g -O0 -DDEBUG
|
@ -1,79 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2011 Arduino. All right reserved.
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2.1 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
|
||||
# Tool suffix when cross-compiling
|
||||
#CROSS_COMPILE = ../../../../tools/CodeSourcery_arm/bin/arm-none-eabi-
|
||||
#CROSS_COMPILE = C:/CodeSourcery_2011.03-42/bin/arm-none-eabi-
|
||||
CROSS_COMPILE = $(ARM_GCC_TOOLCHAIN)/arm-none-eabi-
|
||||
|
||||
# Compilation tools
|
||||
AR = $(CROSS_COMPILE)ar
|
||||
CC = $(CROSS_COMPILE)gcc
|
||||
CXX = $(CROSS_COMPILE)g++
|
||||
AS = $(CROSS_COMPILE)as
|
||||
GDB = $(CROSS_COMPILE)gdb
|
||||
SIZE = $(CROSS_COMPILE)size
|
||||
NM = $(CROSS_COMPILE)nm
|
||||
OBJCOPY = $(CROSS_COMPILE)objcopy
|
||||
RM=cs-rm -Rf
|
||||
SEP=\\
|
||||
|
||||
# ---------------------------------------------------------------------------------------
|
||||
# C Flags
|
||||
|
||||
CFLAGS += -Wall -Wchar-subscripts -Wcomment -Wformat=2 -Wimplicit-int
|
||||
CFLAGS += -Werror-implicit-function-declaration -Wmain -Wparentheses
|
||||
CFLAGS += -Wsequence-point -Wreturn-type -Wswitch -Wtrigraphs -Wunused
|
||||
CFLAGS += -Wuninitialized -Wunknown-pragmas -Wfloat-equal -Wundef
|
||||
CFLAGS += -Wshadow -Wpointer-arith -Wbad-function-cast -Wwrite-strings
|
||||
CFLAGS += -Wsign-compare -Waggregate-return -Wstrict-prototypes
|
||||
CFLAGS += -Wmissing-prototypes -Wmissing-declarations
|
||||
CFLAGS += -Wformat -Wmissing-format-attribute -Wno-deprecated-declarations
|
||||
CFLAGS += -Wpacked -Wredundant-decls -Wnested-externs -Winline -Wlong-long
|
||||
CFLAGS += -Wunreachable-code
|
||||
CFLAGS += -Wcast-align
|
||||
|
||||
CFLAGS += --param max-inline-insns-single=500 -mcpu=cortex-m3 -mthumb -mlong-calls -ffunction-sections -nostdlib
|
||||
CFLAGS += $(OPTIMIZATION) $(INCLUDES) -D$(CHIP) -D$(VARIANT)
|
||||
|
||||
# To reduce application size use only integer printf function.
|
||||
CFLAGS += -Dprintf=iprintf
|
||||
|
||||
# ---------------------------------------------------------------------------------------
|
||||
# CPP Flags
|
||||
|
||||
CPPFLAGS += -Wall -Wchar-subscripts -Wcomment -Wformat=2
|
||||
CPPFLAGS += -Wmain -Wparentheses -Wcast-align -Wunreachable-code
|
||||
CPPFLAGS += -Wsequence-point -Wreturn-type -Wswitch -Wtrigraphs -Wunused
|
||||
CPPFLAGS += -Wuninitialized -Wunknown-pragmas -Wfloat-equal -Wundef
|
||||
CPPFLAGS += -Wshadow -Wpointer-arith -Wwrite-strings
|
||||
CPPFLAGS += -Wsign-compare -Waggregate-return -Wmissing-declarations
|
||||
CPPFLAGS += -Wformat -Wmissing-format-attribute -Wno-deprecated-declarations
|
||||
CPPFLAGS += -Wpacked -Wredundant-decls -Winline -Wlong-long
|
||||
|
||||
#-fno-rtti -fno-exceptions
|
||||
CPPFLAGS += --param max-inline-insns-single=500 -mcpu=cortex-m3 -mthumb -mlong-calls -ffunction-sections
|
||||
CPPFLAGS += $(OPTIMIZATION) $(INCLUDES) -D$(CHIP)
|
||||
|
||||
# To reduce application size use only integer printf function.
|
||||
CPPFLAGS += -Dprintf=iprintf
|
||||
|
||||
# ---------------------------------------------------------------------------------------
|
||||
# ASM Flags
|
||||
|
||||
ASFLAGS = -mcpu=cortex-m3 -mthumb -Wall -g $(OPTIMIZATION) $(INCLUDES)
|
@ -1,183 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2011 Arduino. All right reserved.
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2.1 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
|
||||
# Makefile for compiling libArduino
|
||||
.SUFFIXES: .o .a .c .s
|
||||
|
||||
# putting default variant
|
||||
ifeq ("$(VARIANT)", "")
|
||||
#VARIANT=sam3s_ek
|
||||
VARIANT=sam3u_ek
|
||||
#VARIANT=arduino_due
|
||||
endif
|
||||
|
||||
ifeq ("$(VARIANT)", "sam3s_ek")
|
||||
CHIP=__SAM3S4C__
|
||||
else ifeq ("$(VARIANT)", "sam3u_ek")
|
||||
CHIP=__SAM3U4E__
|
||||
else ifeq ("$(VARIANT)", "arduino_due")
|
||||
CHIP=__SAM3U4E__
|
||||
endif
|
||||
|
||||
TOOLCHAIN=gcc
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Path
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
# Libraries
|
||||
PROJECT_BASE_PATH = ./..
|
||||
SYSTEM_PATH = ../../../../system
|
||||
CMSIS_BASE_PATH = $(SYSTEM_PATH)/CMSIS/Include
|
||||
VARIANT_PATH = ../../../../variants/$(VARIANT)
|
||||
|
||||
ifeq ($(CHIP), __SAM3S4C__)
|
||||
CHIP_NAME=sam3s4c
|
||||
CHIP_SERIE=sam3s
|
||||
else ifeq ($(CHIP), __SAM3U4E__)
|
||||
CHIP_NAME=sam3u4e
|
||||
CHIP_SERIE=sam3u
|
||||
else ifeq ($(CHIP), __SAM3N4C__)
|
||||
CHIP_NAME=sam3n4c
|
||||
CHIP_SERIE=sam3n
|
||||
else ifeq ($(CHIP), __SAM3X8H__)
|
||||
CHIP_NAME=sam3x8h
|
||||
CHIP_SERIE=sam3xa
|
||||
else
|
||||
endif
|
||||
|
||||
CMSIS_CHIP_PATH=$(SYSTEM_PATH)/libsam/cmsis/$(CHIP_SERIE)
|
||||
|
||||
# Output directories
|
||||
OUTPUT_PATH = debug_$(VARIANT)
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Files
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
vpath %.h $(PROJECT_BASE_PATH)/.. $(VARIANT_PATH) $(SYSTEM_PATH) $(CMSIS_BASE_PATH)
|
||||
vpath %.cpp $(PROJECT_BASE_PATH)
|
||||
|
||||
VPATH+=$(PROJECT_BASE_PATH)
|
||||
|
||||
INCLUDES = -I$(PROJECT_BASE_PATH)/..
|
||||
INCLUDES += -I$(VARIANT_PATH)
|
||||
INCLUDES += -I$(VARIANT_PATH)/..
|
||||
INCLUDES += -I$(SYSTEM_PATH)
|
||||
INCLUDES += -I$(SYSTEM_PATH)/libsam
|
||||
INCLUDES += -I$(CMSIS_BASE_PATH)
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
ifdef DEBUG
|
||||
include debug.mk
|
||||
else
|
||||
include release.mk
|
||||
endif
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Tools
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
include $(TOOLCHAIN).mk
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
ifdef DEBUG
|
||||
OUTPUT_OBJ=debug
|
||||
LIBS_POSTFIX=dbg
|
||||
else
|
||||
OUTPUT_OBJ=release
|
||||
LIBS_POSTFIX=rel
|
||||
endif
|
||||
|
||||
OUTPUT_BIN=test_$(TOOLCHAIN)_$(LIBS_POSTFIX)
|
||||
#LIBS=-L../libsam_$(CHIP_NAME)_$(TOOLCHAIN)_rel.a -L../arduino_$(VARIANT)_$(TOOLCHAIN)_rel.a
|
||||
#
|
||||
LIBS=-Wl,--start-group -lgcc -lc -lstdc++ -lsam_$(CHIP_NAME)_$(TOOLCHAIN)_$(LIBS_POSTFIX) -larduino_$(VARIANT)_$(TOOLCHAIN)_$(LIBS_POSTFIX) -lvariant_$(VARIANT)_$(TOOLCHAIN)_$(LIBS_POSTFIX) -Wl,--end-group
|
||||
|
||||
LIB_PATH =-L$(PROJECT_BASE_PATH)/..
|
||||
LIB_PATH+=-L=/lib/thumb2
|
||||
#LIB_PATH+=-L=/../lib/gcc/arm-none-eabi/4.5.2/thumb2
|
||||
|
||||
LDFLAGS= -mcpu=cortex-m3 -mthumb -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--entry=Reset_Handler -Wl,--unresolved-symbols=report-all -Wl,--warn-common -Wl,--warn-section-align -Wl,--warn-unresolved-symbols
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# CPP source files and objects
|
||||
#-------------------------------------------------------------------------------
|
||||
CPP_SRC=$(wildcard $(PROJECT_BASE_PATH)/*.cpp)
|
||||
|
||||
CPP_OBJ_TEMP = $(patsubst %.cpp, %.o, $(notdir $(CPP_SRC)))
|
||||
|
||||
# during development, remove some files
|
||||
CPP_OBJ_FILTER=
|
||||
|
||||
CPP_OBJ=$(filter-out $(CPP_OBJ_FILTER), $(CPP_OBJ_TEMP))
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Rules
|
||||
#-------------------------------------------------------------------------------
|
||||
all: prod_test_due
|
||||
|
||||
prod_test_due: create_output $(OUTPUT_BIN)
|
||||
|
||||
.PHONY: create_output
|
||||
create_output:
|
||||
@echo --- Preparing $(VARIANT) files in $(OUTPUT_PATH) $(OUTPUT_BIN)
|
||||
@echo -------------------------
|
||||
@echo *$(INCLUDES)
|
||||
@echo -------------------------
|
||||
@echo *$(C_SRC)
|
||||
@echo -------------------------
|
||||
@echo *$(C_OBJ)
|
||||
@echo -------------------------
|
||||
@echo *$(addprefix $(OUTPUT_PATH)/, $(C_OBJ))
|
||||
@echo -------------------------
|
||||
@echo *$(CPP_SRC)
|
||||
@echo -------------------------
|
||||
@echo *$(CPP_OBJ)
|
||||
@echo -------------------------
|
||||
@echo *$(addprefix $(OUTPUT_PATH)/, $(CPP_OBJ))
|
||||
@echo -------------------------
|
||||
@echo *$(A_SRC)
|
||||
@echo -------------------------
|
||||
|
||||
-@mkdir $(OUTPUT_PATH) 1>NUL 2>&1
|
||||
|
||||
$(addprefix $(OUTPUT_PATH)/,$(CPP_OBJ)): $(OUTPUT_PATH)/%.o: %.cpp
|
||||
# @$(CC) -c $(CPPFLAGS) $< -o $@
|
||||
@$(CXX) -c $(CPPFLAGS) $< -o $@
|
||||
# @$(CXX) -v -c $(CPPFLAGS) $< -o $@
|
||||
|
||||
$(OUTPUT_BIN): $(addprefix $(OUTPUT_PATH)/, $(C_OBJ)) $(addprefix $(OUTPUT_PATH)/, $(CPP_OBJ)) $(addprefix $(OUTPUT_PATH)/, $(A_OBJ))
|
||||
@$(CC) $(LIB_PATH) $(LDFLAGS) -T"$(VARIANT_PATH)/linker_scripts/gcc/flash.ld" -Wl,-Map,$(OUTPUT_PATH)/$@.map -o $(OUTPUT_PATH)/$@.elf $^ $(LIBS)
|
||||
# @$(CC) $(LIB_PATH) $(LDFLAGS) -T"$(VARIANT_PATH)/linker_scripts/gcc/sram.ld" -Wl,-Map,$(OUTPUT_PATH)/$@.map -o $(OUTPUT_PATH)/$@.elf $^ $(LIBS)
|
||||
@$(NM) $(OUTPUT_PATH)/$@.elf >$(OUTPUT_PATH)/$@.elf.txt
|
||||
@$(OBJCOPY) -O binary $(OUTPUT_PATH)/$@.elf $(OUTPUT_PATH)/$@.bin
|
||||
$(SIZE) $^ $(OUTPUT_PATH)/$@.elf
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
@echo --- Cleaning test files
|
||||
-@$(RM) $(OUTPUT_PATH)/test.o 1>NUL 2>&1
|
||||
-@$(RM) $(OUTPUT_PATH)/$(OUTPUT_BIN).elf 1>NUL 2>&1
|
||||
-@$(RM) $(OUTPUT_PATH)/$(OUTPUT_BIN).elf.txt 1>NUL 2>&1
|
||||
-@$(RM) $(OUTPUT_PATH)/$(OUTPUT_BIN).bin 1>NUL 2>&1
|
||||
-@$(RM) $(OUTPUT_PATH)/$(OUTPUT_BIN).map 1>NUL 2>&1
|
||||
|
||||
debug: test
|
||||
@$(GDB) -x "$(VARIANT_PATH)/debug_scripts/gcc/$(VARIANT)_flash.gdb" -ex "reset" -readnow -se $(OUTPUT_PATH)/$(OUTPUT_BIN).elf
|
||||
# @$(GDB) -w -x "$(VARIANT_PATH)/debug_scripts/gcc/$(VARIANT)_sram.gdb" -ex "reset" -readnow -se $(OUTPUT_PATH)/$(OUTPUT_BIN).elf
|
@ -1,25 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2011 Arduino. All right reserved.
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2.1 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
|
||||
# Optimization level
|
||||
# -O1 Optimize
|
||||
# -O2 Optimize even more
|
||||
# -O3 Optimize yet more
|
||||
# -O0 Reduce compilation time and make debugging produce the expected results
|
||||
# -Os Optimize for size
|
||||
OPTIMIZATION = -Os
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,219 +0,0 @@
|
||||
/*
|
||||
Copyright (c) 2011 Arduino. All right reserved.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
See the GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "variant.h"
|
||||
|
||||
/* Ensure we are compiling this for Arduino Due */
|
||||
#if !defined( arduino_due )
|
||||
#error "Error: wrong variant chosen"
|
||||
#endif
|
||||
|
||||
typedef enum _ePins
|
||||
{
|
||||
/* LEDs */
|
||||
PIN_13=0,
|
||||
PIN_RXL=1,
|
||||
PIN_TXL=2,
|
||||
|
||||
/* UART */
|
||||
PIN_URXD=3,
|
||||
PIN_UTXD=4,
|
||||
PIN_UART=5,
|
||||
|
||||
/* USART0 */
|
||||
PIN_RXD0=6,
|
||||
PIN_TXD0=7,
|
||||
PIN_USART0=8,
|
||||
|
||||
/* USART1 */
|
||||
PIN_RXD1=9,
|
||||
PIN_TXD1=10,
|
||||
PIN_USART1=11,
|
||||
|
||||
/* USART2 */
|
||||
PIN_RXD2=12,
|
||||
PIN_TXD2=13,
|
||||
PIN_USART2=14,
|
||||
|
||||
/* SPI */
|
||||
PIN_MISO=15,
|
||||
PIN_MOSI=16,
|
||||
PIN_SPCK=17,
|
||||
PIN_NPCS0=18,
|
||||
|
||||
/* TWI0 */
|
||||
PIN_SDA1=19,
|
||||
PIN_SCL1=20,
|
||||
PIN_TWI0=21,
|
||||
|
||||
/* TWI1 */
|
||||
PIN_SDA0=22,
|
||||
PIN_SCL0=23,
|
||||
PIN_TWI1=24,
|
||||
|
||||
/* Analog */
|
||||
PIN_AD0=25,
|
||||
PIN_AD1=26,
|
||||
PIN_AD2=27,
|
||||
PIN_AD3=28,
|
||||
PIN_AD4=29,
|
||||
PIN_AD5=30,
|
||||
PIN_AD6=31,
|
||||
PIN_AD7=32,
|
||||
PIN_AD8=33,
|
||||
PIN_AD9=34,
|
||||
PIN_AD10=35,
|
||||
PIN_AD11=36,
|
||||
PIN_AD12=37,
|
||||
PIN_AD13=38,
|
||||
|
||||
/* External DAC */
|
||||
PIN_DAC_CS=39,
|
||||
PIN_DAC_SCK=40,
|
||||
PIN_DAC_DIN=41,
|
||||
|
||||
/* PWM */
|
||||
PIN_PWM=42,
|
||||
PIN_PWMH0=43,
|
||||
PIN_PWMH1=44,
|
||||
PIN_PWMH2=45,
|
||||
PIN_PWMH3=46,
|
||||
PIN_PWML0=47,
|
||||
PIN_PWML1=48,
|
||||
PIN_PWML2=49,
|
||||
PIN_PWML3=50,
|
||||
|
||||
PIN_10=51,
|
||||
|
||||
PIN_22=52,
|
||||
PIN_23=53,
|
||||
PIN_24=54,
|
||||
PIN_25=55,
|
||||
PIN_26=56,
|
||||
PIN_27=57,
|
||||
PIN_28=58,
|
||||
PIN_29=59,
|
||||
PIN_30=60,
|
||||
PIN_31=61,
|
||||
PIN_32=62,
|
||||
PIN_33=63,
|
||||
PIN_34=64,
|
||||
PIN_35=65,
|
||||
PIN_36=66,
|
||||
PIN_37=67,
|
||||
PIN_38=68,
|
||||
PIN_39=69,
|
||||
PIN_40=70,
|
||||
PIN_41=71,
|
||||
PIN_42=72,
|
||||
PIN_43=73,
|
||||
PIN_44=74,
|
||||
PIN_45=75,
|
||||
PIN_46=76,
|
||||
PIN_47=77,
|
||||
PIN_48=78,
|
||||
PIN_49=79,
|
||||
PIN_50=80,
|
||||
PIN_51=81,
|
||||
PIN_52=82,
|
||||
PIN_53=83
|
||||
} ePins ;
|
||||
|
||||
#define PIN_FIRST PIN_13
|
||||
#define PIN_LAST PIN_53
|
||||
|
||||
void setup( void )
|
||||
{
|
||||
// Initialize all digital pins in output mode.
|
||||
for ( dwIndex=PIN_FIRST ; dwIndex <= PIN_LAST ; dwIndex++ )
|
||||
{
|
||||
if ( ((g_APinDescription[dwIndex].ulPinAttribute & PIN_ATTR_COMBO) == 0) && ((g_APinDescription[dwIndex].ulPinAttribute & PIN_ATTR_ANALOG) == 0) )
|
||||
{
|
||||
pinMode( dwIndex, OUTPUT ) ;
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize all analog pins
|
||||
|
||||
}
|
||||
|
||||
void loop( void )
|
||||
{
|
||||
uint32_t dwIndex ;
|
||||
uint32_t adwAnalogValues[PIN_AD13-PIN_AD0+1] ;
|
||||
uint32_t dwChaserIndex=PIN_FIRST ;
|
||||
uint32_t dwChaserIndexLast=PIN_FIRST ;
|
||||
|
||||
// production test loop
|
||||
for ( ;; )
|
||||
{
|
||||
// Read analog values
|
||||
for ( dwIndex=PIN_AD0 ; dwIndex <= PIN_AD13 ; dwIndex++ )
|
||||
{
|
||||
// adwAnalogValues[dwIndex]= ;
|
||||
}
|
||||
|
||||
// Transmit analog values on USB CDC
|
||||
for ( dwIndex=PIN_AD0 ; dwIndex <= PIN_AD13 ; dwIndex++ )
|
||||
{
|
||||
// CDC_Print( adwAnalogValues[dwIndex] ) ;
|
||||
}
|
||||
|
||||
// Do chaser
|
||||
// set the current pin output to VCC
|
||||
digitalWrite( dwChaserIndex, HIGH ) ;
|
||||
|
||||
// set the previous pin output to GND
|
||||
if ( dwChaserIndexLast != dwChaserIndex )
|
||||
{
|
||||
digitalWrite( dwChaserIndex, LOW ) ;
|
||||
}
|
||||
|
||||
// backup current chaser pin index
|
||||
dwChaserIndexLast=dwChaserIndex ;
|
||||
dwChaserIndex++ ;
|
||||
|
||||
// find next chaser pin
|
||||
for ( ; ; )
|
||||
{
|
||||
// Go circular if we reached the end of pins
|
||||
if ( dwChaserIndex > PIN_LAST )
|
||||
{
|
||||
dwChaserIndex=PIN_FIRST ;
|
||||
}
|
||||
|
||||
// bypass combo and analog pins
|
||||
if ( ((g_APinDescription[dwChaserIndex].ulPinAttribute & PIN_ATTR_COMBO) != 0) || ((g_APinDescription[dwChaserIndex].ulPinAttribute & PIN_ATTR_ANALOG) != 0) )
|
||||
{
|
||||
dwChaserIndex++ ;
|
||||
}
|
||||
else
|
||||
{
|
||||
break ;
|
||||
}
|
||||
}
|
||||
|
||||
// Go circular if we reached the end of pins
|
||||
if ( dwChaserIndex > PIN_LAST )
|
||||
{
|
||||
dwChaserIndex=PIN_FIRST ;
|
||||
}
|
||||
|
||||
delay( 500 ) ; // wait for a second
|
||||
}
|
||||
}
|
@ -1,116 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2011 Arduino. All right reserved.
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2.1 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
|
||||
SUBMAKE_OPTIONS=--no-builtin-rules --no-builtin-variables --no-print-directory
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Rules
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
all: test
|
||||
|
||||
test: test_arduino_due_x test_sam3x_ek test_adk2
|
||||
@echo ------------------------------------------------------------------------------------
|
||||
@echo --- Making test
|
||||
@$(MAKE) DEBUG=1 VARIANT=arduino_due_x $(SUBMAKE_OPTIONS) -f test.mk
|
||||
# @$(MAKE) DEBUG=1 VARIANT=sam3s_ek $(SUBMAKE_OPTIONS) -f test.mk
|
||||
# @$(MAKE) DEBUG=1 VARIANT=sam3u_ek $(SUBMAKE_OPTIONS) -f test.mk
|
||||
@$(MAKE) DEBUG=1 VARIANT=sam3x_ek $(SUBMAKE_OPTIONS) -f test.mk
|
||||
@$(MAKE) DEBUG=1 VARIANT=adk2 $(SUBMAKE_OPTIONS) -f test.mk
|
||||
@echo ------------------------------------------------------------------------------------
|
||||
|
||||
.PHONY: test_arduino_due_x
|
||||
test_arduino_due_x:
|
||||
@echo ------------------------------------------------------------------------------------
|
||||
@echo --- Making test_arduino_due_x
|
||||
@$(MAKE) DEBUG=1 VARIANT=arduino_due_x $(SUBMAKE_OPTIONS) -f test.mk
|
||||
@echo ------------------------------------------------------------------------------------
|
||||
|
||||
.PHONY: test_adk2
|
||||
test_adk2:
|
||||
@echo ------------------------------------------------------------------------------------
|
||||
@echo --- Making test_adk2
|
||||
@$(MAKE) DEBUG=1 VARIANT=adk2 $(SUBMAKE_OPTIONS) -f test.mk
|
||||
@echo ------------------------------------------------------------------------------------
|
||||
|
||||
.PHONY: test_sam3s_ek
|
||||
test_sam3s_ek:
|
||||
@echo ------------------------------------------------------------------------------------
|
||||
@echo --- Making test_sam3s_ek
|
||||
@$(MAKE) DEBUG=1 VARIANT=sam3s_ek $(SUBMAKE_OPTIONS) -f test.mk
|
||||
@echo ------------------------------------------------------------------------------------
|
||||
|
||||
.PHONY: test_sam3u_ek
|
||||
test_sam3u_ek:
|
||||
@echo ------------------------------------------------------------------------------------
|
||||
@echo --- Making test_sam3u_ek
|
||||
@$(MAKE) DEBUG=1 VARIANT=sam3u_ek $(SUBMAKE_OPTIONS) -f test.mk
|
||||
@echo ------------------------------------------------------------------------------------
|
||||
|
||||
.PHONY: test_sam3x_ek
|
||||
test_sam3x_ek:
|
||||
@echo ------------------------------------------------------------------------------------
|
||||
@echo --- Making test_sam3x_ek
|
||||
@$(MAKE) DEBUG=1 VARIANT=sam3x_ek $(SUBMAKE_OPTIONS) -f test.mk
|
||||
@echo ------------------------------------------------------------------------------------
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
@echo ------------------------------------------------------------------------------------
|
||||
@echo --- Cleaning test
|
||||
@$(MAKE) DEBUG=1 VARIANT=arduino_due_x $(SUBMAKE_OPTIONS) -f test.mk $@
|
||||
@$(MAKE) DEBUG=1 VARIANT=adk2 $(SUBMAKE_OPTIONS) -f test.mk $@
|
||||
@$(MAKE) DEBUG=1 VARIANT=sam3s_ek $(SUBMAKE_OPTIONS) -f test.mk $@
|
||||
@$(MAKE) DEBUG=1 VARIANT=sam3u_ek $(SUBMAKE_OPTIONS) -f test.mk $@
|
||||
@$(MAKE) DEBUG=1 VARIANT=sam3x_ek $(SUBMAKE_OPTIONS) -f test.mk $@
|
||||
@echo ------------------------------------------------------------------------------------
|
||||
|
||||
.PHONY: debug_arduino_due_x
|
||||
debug_arduino_due_x:
|
||||
@echo ------------------------------------------------------------------------------------
|
||||
@echo --- Debugging test arduino_due_x
|
||||
@$(MAKE) DEBUG=1 VARIANT=arduino_due_x $(SUBMAKE_OPTIONS) -f test.mk $@
|
||||
@echo ------------------------------------------------------------------------------------
|
||||
|
||||
.PHONY: debug_adk2
|
||||
debug_adk2:
|
||||
@echo ------------------------------------------------------------------------------------
|
||||
@echo --- Debugging test adk2
|
||||
@$(MAKE) DEBUG=1 VARIANT=adk2 $(SUBMAKE_OPTIONS) -f test.mk $@
|
||||
@echo ------------------------------------------------------------------------------------
|
||||
|
||||
.PHONY: debug_sam3s_ek
|
||||
debug_sam3s_ek:
|
||||
@echo ------------------------------------------------------------------------------------
|
||||
@echo --- Debugging test sam3s_ek
|
||||
@$(MAKE) DEBUG=1 VARIANT=sam3s_ek $(SUBMAKE_OPTIONS) -f test.mk $@
|
||||
@echo ------------------------------------------------------------------------------------
|
||||
|
||||
.PHONY: debug_sam3u_ek
|
||||
debug_sam3u_ek:
|
||||
@echo ------------------------------------------------------------------------------------
|
||||
@echo --- Debugging test sam3u_ek
|
||||
@$(MAKE) DEBUG=1 VARIANT=sam3u_ek $(SUBMAKE_OPTIONS) -f test.mk $@
|
||||
@echo ------------------------------------------------------------------------------------
|
||||
|
||||
.PHONY: debug_sam3x_ek
|
||||
debug_sam3x_ek:
|
||||
@echo ------------------------------------------------------------------------------------
|
||||
@echo --- Debugging test sam3x_ek
|
||||
@$(MAKE) DEBUG=1 VARIANT=sam3x_ek $(SUBMAKE_OPTIONS) -f test.mk $@
|
||||
@echo ------------------------------------------------------------------------------------
|
@ -1,25 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2011 Arduino. All right reserved.
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2.1 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
|
||||
# Optimization level
|
||||
# -O1 Optimize
|
||||
# -O2 Optimize even more
|
||||
# -O3 Optimize yet more
|
||||
# -O0 Reduce compilation time and make debugging produce the expected results
|
||||
# -Os Optimize for size
|
||||
OPTIMIZATION = -g -O0 -DDEBUG
|
@ -1,85 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2011 Arduino. All right reserved.
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2.1 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
|
||||
# Tool suffix when cross-compiling
|
||||
#CROSS_COMPILE = ../../../../tools/CodeSourcery_arm/bin/arm-none-eabi-
|
||||
#CROSS_COMPILE = C:/CodeSourcery_2011.03-42/bin/arm-none-eabi-
|
||||
CROSS_COMPILE = $(ARM_GCC_TOOLCHAIN)/arm-none-eabi-
|
||||
|
||||
# Compilation tools
|
||||
AR = $(CROSS_COMPILE)ar
|
||||
CC = $(CROSS_COMPILE)gcc
|
||||
CXX = $(CROSS_COMPILE)g++
|
||||
AS = $(CROSS_COMPILE)as
|
||||
GDB = $(CROSS_COMPILE)gdb
|
||||
SIZE = $(CROSS_COMPILE)size
|
||||
NM = $(CROSS_COMPILE)nm
|
||||
OBJCOPY = $(CROSS_COMPILE)objcopy
|
||||
|
||||
ifeq ($(OS),Windows_NT)
|
||||
RM=cs-rm -Rf
|
||||
else
|
||||
RM=rm -Rf
|
||||
endif
|
||||
|
||||
SEP=\\
|
||||
|
||||
# ---------------------------------------------------------------------------------------
|
||||
# C Flags
|
||||
|
||||
CFLAGS += -Wall -Wchar-subscripts -Wcomment -Wformat=2 -Wimplicit-int
|
||||
CFLAGS += -Werror-implicit-function-declaration -Wmain -Wparentheses
|
||||
CFLAGS += -Wsequence-point -Wreturn-type -Wswitch -Wtrigraphs -Wunused
|
||||
CFLAGS += -Wuninitialized -Wunknown-pragmas -Wfloat-equal -Wundef
|
||||
CFLAGS += -Wshadow -Wpointer-arith -Wbad-function-cast -Wwrite-strings
|
||||
CFLAGS += -Wsign-compare -Waggregate-return -Wstrict-prototypes
|
||||
CFLAGS += -Wmissing-prototypes -Wmissing-declarations
|
||||
CFLAGS += -Wformat -Wmissing-format-attribute -Wno-deprecated-declarations
|
||||
CFLAGS += -Wpacked -Wredundant-decls -Wnested-externs -Winline -Wlong-long
|
||||
CFLAGS += -Wunreachable-code
|
||||
CFLAGS += -Wcast-align
|
||||
|
||||
CFLAGS += --param max-inline-insns-single=500 -mcpu=cortex-m3 -mthumb -mlong-calls -ffunction-sections -nostdlib -std=c99
|
||||
CFLAGS += $(OPTIMIZATION) $(INCLUDES) -D$(CHIP) -D$(VARIANT)
|
||||
|
||||
# To reduce application size use only integer printf function.
|
||||
CFLAGS += -Dprintf=iprintf
|
||||
|
||||
# ---------------------------------------------------------------------------------------
|
||||
# CPP Flags
|
||||
|
||||
CPPFLAGS += -Wall -Wchar-subscripts -Wcomment -Wformat=2
|
||||
CPPFLAGS += -Wmain -Wparentheses -Wcast-align -Wunreachable-code
|
||||
CPPFLAGS += -Wsequence-point -Wreturn-type -Wswitch -Wtrigraphs -Wunused
|
||||
CPPFLAGS += -Wuninitialized -Wunknown-pragmas -Wfloat-equal -Wundef
|
||||
CPPFLAGS += -Wshadow -Wpointer-arith -Wwrite-strings
|
||||
CPPFLAGS += -Wsign-compare -Waggregate-return -Wmissing-declarations
|
||||
CPPFLAGS += -Wformat -Wmissing-format-attribute -Wno-deprecated-declarations
|
||||
CPPFLAGS += -Wpacked -Wredundant-decls -Winline -Wlong-long
|
||||
|
||||
#-fno-rtti -fno-exceptions
|
||||
CPPFLAGS += --param max-inline-insns-single=500 -mcpu=cortex-m3 -mthumb -mlong-calls -ffunction-sections -std=c++98
|
||||
CPPFLAGS += $(OPTIMIZATION) $(INCLUDES) -D$(CHIP)
|
||||
|
||||
# To reduce application size use only integer printf function.
|
||||
CPPFLAGS += -Dprintf=iprintf
|
||||
|
||||
# ---------------------------------------------------------------------------------------
|
||||
# ASM Flags
|
||||
|
||||
ASFLAGS = -mcpu=cortex-m3 -mthumb -Wall -g $(OPTIMIZATION) $(INCLUDES)
|
@ -1,25 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2011 Arduino. All right reserved.
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2.1 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
|
||||
# Optimization level
|
||||
# -O1 Optimize
|
||||
# -O2 Optimize even more
|
||||
# -O3 Optimize yet more
|
||||
# -O0 Reduce compilation time and make debugging produce the expected results
|
||||
# -Os Optimize for size
|
||||
OPTIMIZATION = -Os
|
@ -1,241 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2011 Arduino. All right reserved.
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2.1 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
|
||||
# Makefile for compiling validation application
|
||||
.SUFFIXES: .o .a .c .cpp .s
|
||||
|
||||
# putting default variant
|
||||
ifeq ("$(VARIANT)", "")
|
||||
#VARIANT=sam3s_ek
|
||||
#VARIANT=sam3u_ek
|
||||
#VARIANT=sam3x_ek
|
||||
VARIANT=adk2
|
||||
#VARIANT=arduino_due_x
|
||||
endif
|
||||
|
||||
ifeq ("$(VARIANT)", "sam3s_ek")
|
||||
CHIP=__SAM3S4C__
|
||||
VARIANT_PATH = ../../../../../../atmel/sam/variants/$(VARIANT)
|
||||
else ifeq ("$(VARIANT)", "sam3u_ek")
|
||||
CHIP=__SAM3U4E__
|
||||
VARIANT_PATH = ../../../../../../atmel/sam/variants/$(VARIANT)
|
||||
else ifeq ("$(VARIANT)", "sam3x_ek")
|
||||
CHIP=__SAM3X8H__
|
||||
VARIANT_PATH = ../../../../../../atmel/sam/variants/$(VARIANT)
|
||||
else ifeq ("$(VARIANT)", "arduino_due_u")
|
||||
CHIP=__SAM3U4E__
|
||||
VARIANT_PATH = ../../../../variants/$(VARIANT)
|
||||
else ifeq ("$(VARIANT)", "arduino_due_x")
|
||||
CHIP=__SAM3X8E__
|
||||
VARIANT_PATH = ../../../../variants/$(VARIANT)
|
||||
else ifeq ("$(VARIANT)", "adk2")
|
||||
CHIP=__SAM3X8E__
|
||||
VARIANT_PATH = ../../../../../../google/sam/variants/$(VARIANT)
|
||||
endif
|
||||
|
||||
TOOLCHAIN=gcc
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Path
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
# Libraries
|
||||
PROJECT_BASE_PATH = ..
|
||||
SYSTEM_PATH = ../../../../system
|
||||
|
||||
ifeq ($(CHIP), __SAM3S4C__)
|
||||
CHIP_NAME=sam3s4c
|
||||
CHIP_SERIE=sam3s
|
||||
else ifeq ($(CHIP), __SAM3U4E__)
|
||||
CHIP_NAME=sam3u4e
|
||||
CHIP_SERIE=sam3u
|
||||
else ifeq ($(CHIP), __SAM3N4C__)
|
||||
CHIP_NAME=sam3n4c
|
||||
CHIP_SERIE=sam3n
|
||||
else ifeq ($(CHIP), __SAM3X8H__)
|
||||
CHIP_NAME=sam3x8h
|
||||
CHIP_SERIE=sam3xa
|
||||
else ifeq ($(CHIP), __SAM3X8E__)
|
||||
CHIP_NAME=sam3x8e
|
||||
CHIP_SERIE=sam3xa
|
||||
else
|
||||
endif
|
||||
|
||||
CMSIS_ROOT_PATH = $(SYSTEM_PATH)/CMSIS
|
||||
CMSIS_ARM_PATH=$(CMSIS_ROOT_PATH)/CMSIS/Include
|
||||
CMSIS_ATMEL_PATH=$(CMSIS_ROOT_PATH)/Device/ATMEL
|
||||
CMSIS_CHIP_PATH=$(CMSIS_ROOT_PATH)/Device/ATMEL/$(CHIP_SERIE)
|
||||
|
||||
ARDUINO_CORE_PATH=../../../../cores/arduino
|
||||
ARDUINO_USB_PATH=$(ARDUINO_CORE_PATH)/USB
|
||||
|
||||
# Output directories
|
||||
OUTPUT_PATH = debug_$(VARIANT)
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Files
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
#vpath %.h $(PROJECT_BASE_PATH)/.. $(PROJECT_BASE_PATH)/../USB $(VARIANT_PATH) $(SYSTEM_PATH) $(CMSIS_ARM_PATH)
|
||||
vpath %.cpp $(PROJECT_BASE_PATH)
|
||||
|
||||
#VPATH+=$(PROJECT_BASE_PATH)
|
||||
|
||||
INCLUDES = -I$(ARDUINO_CORE_PATH)
|
||||
INCLUDES += -I$(ARDUINO_CORE_PATH)/USB
|
||||
INCLUDES += -I$(VARIANT_PATH)
|
||||
INCLUDES += -I$(SYSTEM_PATH)/libsam
|
||||
INCLUDES += -I$(CMSIS_ARM_PATH)
|
||||
INCLUDES += -I$(CMSIS_ATMEL_PATH)
|
||||
INCLUDES += -I$(CMSIS_CHIP_PATH)
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
ifdef DEBUG
|
||||
include debug.mk
|
||||
else
|
||||
include release.mk
|
||||
endif
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Tools
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
include $(TOOLCHAIN).mk
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
ifdef DEBUG
|
||||
OUTPUT_OBJ=debug
|
||||
LIBS_POSTFIX=dbg
|
||||
else
|
||||
OUTPUT_OBJ=release
|
||||
LIBS_POSTFIX=rel
|
||||
endif
|
||||
|
||||
OUTPUT_BIN=test_$(TOOLCHAIN)_$(LIBS_POSTFIX)
|
||||
LIBS=-Wl,--start-group -lgcc -lc -lstdc++ -lsam_$(CHIP_NAME)_$(TOOLCHAIN)_$(LIBS_POSTFIX) -larduino_$(VARIANT)_$(TOOLCHAIN)_$(LIBS_POSTFIX) -lvariant_$(VARIANT)_$(TOOLCHAIN)_$(LIBS_POSTFIX) -Wl,--end-group
|
||||
|
||||
LIB_PATH =-L$(PROJECT_BASE_PATH)/..
|
||||
LIB_PATH+=-L=/lib/thumb2
|
||||
#LIB_PATH+=-L=/../lib/gcc/arm-none-eabi/4.5.2/thumb2
|
||||
|
||||
LDFLAGS= -mcpu=cortex-m3 -mthumb -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--entry=Reset_Handler -Wl,--unresolved-symbols=report-all -Wl,--warn-common -Wl,--warn-section-align -Wl,--warn-unresolved-symbols
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# CPP source files and objects
|
||||
#-------------------------------------------------------------------------------
|
||||
CPP_SRC=$(wildcard $(PROJECT_BASE_PATH)/*.cpp)
|
||||
|
||||
CPP_OBJ_TEMP = $(patsubst %.cpp, %.o, $(notdir $(CPP_SRC)))
|
||||
|
||||
# during development, remove some files
|
||||
CPP_OBJ_FILTER=
|
||||
|
||||
CPP_OBJ=$(filter-out $(CPP_OBJ_FILTER), $(CPP_OBJ_TEMP))
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Rules
|
||||
#-------------------------------------------------------------------------------
|
||||
all: test
|
||||
|
||||
test: create_output libsam_$(CHIP_NAME)_$(TOOLCHAIN)_$(LIBS_POSTFIX).a libarduino_$(VARIANT)_$(TOOLCHAIN)_$(LIBS_POSTFIX).a libvariant_$(VARIANT)_$(TOOLCHAIN)_$(LIBS_POSTFIX).a $(OUTPUT_BIN)
|
||||
|
||||
|
||||
.PHONY: create_output
|
||||
create_output:
|
||||
@echo ------------------------------------------------------------------------------------
|
||||
@echo --- Preparing $(VARIANT) files in $(OUTPUT_PATH) $(OUTPUT_BIN)
|
||||
# @echo -------------------------
|
||||
# @echo *$(INCLUDES)
|
||||
# @echo -------------------------
|
||||
# @echo *$(C_SRC)
|
||||
# @echo -------------------------
|
||||
# @echo *$(C_OBJ)
|
||||
# @echo -------------------------
|
||||
# @echo *$(addprefix $(OUTPUT_PATH)/, $(C_OBJ))
|
||||
# @echo -------------------------
|
||||
# @echo *$(CPP_SRC)
|
||||
# @echo -------------------------
|
||||
# @echo *$(CPP_OBJ)
|
||||
# @echo -------------------------
|
||||
# @echo *$(addprefix $(OUTPUT_PATH)/, $(CPP_OBJ))
|
||||
# @echo -------------------------
|
||||
# @echo *$(A_SRC)
|
||||
# @echo -------------------------
|
||||
|
||||
-@mkdir $(OUTPUT_PATH) 1>NUL 2>&1
|
||||
@echo ------------------------------------------------------------------------------------
|
||||
|
||||
$(addprefix $(OUTPUT_PATH)/,$(CPP_OBJ)): $(OUTPUT_PATH)/%.o: %.cpp
|
||||
@echo *** Current folder is $(shell cd)
|
||||
@"$(CXX)" -c $(CPPFLAGS) $< -o $@
|
||||
# "$(CXX)" -v -c $(CPPFLAGS) $< -o $@
|
||||
|
||||
$(OUTPUT_BIN): $(addprefix $(OUTPUT_PATH)/, $(C_OBJ)) $(addprefix $(OUTPUT_PATH)/, $(CPP_OBJ)) $(addprefix $(OUTPUT_PATH)/, $(A_OBJ))
|
||||
@"$(CC)" $(LIB_PATH) $(LDFLAGS) -T"$(VARIANT_PATH)/linker_scripts/gcc/flash.ld" -Wl,-Map,$(OUTPUT_PATH)/$@.map -o $(OUTPUT_PATH)/$@.elf $^ $(LIBS)
|
||||
# @"$(CC)" $(LIB_PATH) $(LDFLAGS) -T"$(VARIANT_PATH)/linker_scripts/gcc/sram.ld" -Wl,-Map,$(OUTPUT_PATH)/$@.map -o $(OUTPUT_PATH)/$@.elf $^ $(LIBS)
|
||||
@"$(NM)" $(OUTPUT_PATH)/$@.elf >$(OUTPUT_PATH)/$@.elf.txt
|
||||
@"$(OBJCOPY)" -O binary $(OUTPUT_PATH)/$@.elf $(OUTPUT_PATH)/$@.bin
|
||||
$(SIZE) $^ $(OUTPUT_PATH)/$@.elf
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
@echo ------------------------------------------------------------------------------------
|
||||
@echo --- Cleaning test files for $(VARIANT)
|
||||
-@$(RM) $(OUTPUT_PATH) 1>NUL 2>&1
|
||||
@echo ------------------------------------------------------------------------------------
|
||||
@echo ------------------------------------------------------------------------------------
|
||||
@echo Sub-making clean for libsam
|
||||
@$(MAKE) -C $(SYSTEM_PATH)/libsam/build_gcc -f Makefile clean
|
||||
@echo ------------------------------------------------------------------------------------
|
||||
@echo ------------------------------------------------------------------------------------
|
||||
@echo Sub-making clean for Arduino core
|
||||
$(MAKE) -C $(ARDUINO_CORE_PATH)/build_gcc -f Makefile clean
|
||||
@echo ------------------------------------------------------------------------------------
|
||||
@echo ------------------------------------------------------------------------------------
|
||||
@echo Sub-making clean for variant $(VARIANT)
|
||||
$(MAKE) -C $(VARIANT_PATH)/build_gcc -f Makefile clean
|
||||
@echo ------------------------------------------------------------------------------------
|
||||
|
||||
# -$(RM) $(OUTPUT_PATH)/test.o
|
||||
# -$(RM) $(OUTPUT_PATH)/$(OUTPUT_BIN).elf
|
||||
# -$(RM) $(OUTPUT_PATH)/$(OUTPUT_BIN).elf.txt
|
||||
# -$(RM) $(OUTPUT_PATH)/$(OUTPUT_BIN).bin
|
||||
# -$(RM) $(OUTPUT_PATH)/$(OUTPUT_BIN).map
|
||||
|
||||
debug: test
|
||||
@"$(GDB)" -x "$(VARIANT_PATH)/debug_scripts/gcc/$(VARIANT)_flash.gdb" -ex "reset" -readnow -se $(OUTPUT_PATH)/$(OUTPUT_BIN).elf
|
||||
# @"$(GDB)" -w -x "$(VARIANT_PATH)/debug_scripts/gcc/$(VARIANT)_sram.gdb" -ex "reset" -readnow -se $(OUTPUT_PATH)/$(OUTPUT_BIN).elf
|
||||
|
||||
libsam_$(CHIP_NAME)_$(TOOLCHAIN)_$(LIBS_POSTFIX).a:
|
||||
@echo ------------------------------------------------------------------------------------
|
||||
@echo Sub-making $@
|
||||
@$(MAKE) -C $(SYSTEM_PATH)/libsam/build_gcc -f Makefile $@
|
||||
@echo ------------------------------------------------------------------------------------
|
||||
|
||||
libarduino_$(VARIANT)_$(TOOLCHAIN)_$(LIBS_POSTFIX).a:
|
||||
@echo ------------------------------------------------------------------------------------
|
||||
@echo Sub-making $@
|
||||
$(MAKE) -C $(ARDUINO_CORE_PATH)/build_gcc -f Makefile $(VARIANT)
|
||||
@echo ------------------------------------------------------------------------------------
|
||||
|
||||
libvariant_$(VARIANT)_$(TOOLCHAIN)_$(LIBS_POSTFIX).a:
|
||||
@echo ------------------------------------------------------------------------------------
|
||||
@echo Sub-making $@
|
||||
$(MAKE) -C $(VARIANT_PATH)/build_gcc -f Makefile $(VARIANT)
|
||||
@echo ------------------------------------------------------------------------------------
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,98 +0,0 @@
|
||||
/*
|
||||
Copyright (c) 2011 Arduino. All right reserved.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
See the GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "Arduino.h"
|
||||
|
||||
#ifdef _VARIANT_SAM3X_EK_
|
||||
#define MAX_ANALOG A0
|
||||
#elif defined _VARIANT_ARDUINO_DUE_X_
|
||||
#define MAX_ANALOG A10
|
||||
#elif defined _VARIANT_ADK2_
|
||||
#define MAX_ANALOG A9
|
||||
#endif
|
||||
|
||||
void setup( void )
|
||||
{
|
||||
// Initialize the digital pin as an output.
|
||||
// Pin PIN_LED has a LED connected on most Arduino boards:
|
||||
pinMode( PIN_LED, OUTPUT ) ;
|
||||
digitalWrite( PIN_LED, LOW ) ;
|
||||
|
||||
// Initialize the PIN_LED2 digital pin as an output.
|
||||
pinMode( PIN_LED2, OUTPUT ) ;
|
||||
digitalWrite( PIN_LED2, HIGH ) ;
|
||||
|
||||
Serial1.begin( 115200 ) ;
|
||||
}
|
||||
|
||||
static void led_step1( void )
|
||||
{
|
||||
#if defined sam3s_ek
|
||||
digitalWrite( PIN_LED, HIGH ) ; // set the LED on
|
||||
digitalWrite( PIN_LED2, LOW ) ; // set the red LED off
|
||||
#endif /* sam3s_ek */
|
||||
|
||||
#if defined sam3u_ek
|
||||
digitalWrite( PIN_LED, HIGH ) ; // set the LED on
|
||||
digitalWrite( PIN_LED2, LOW ) ; // set the red LED off
|
||||
#endif /* sam3u_ek */
|
||||
|
||||
#if defined arduino_due_x
|
||||
digitalWrite( PIN_LED, LOW ) ; // set the LED on
|
||||
digitalWrite( PIN_LED2, LOW ) ; // set the red LED off
|
||||
#endif /* arduino_due_x */
|
||||
}
|
||||
|
||||
static void led_step2( void )
|
||||
{
|
||||
#if defined sam3s_ek
|
||||
digitalWrite( PIN_LED, LOW ) ; // set the LED off
|
||||
digitalWrite( PIN_LED2, HIGH ) ; // set the red LED on
|
||||
#endif /* sam3s_ek */
|
||||
|
||||
#if defined sam3u_ek
|
||||
digitalWrite( PIN_LED, LOW ) ; // set the LED off
|
||||
digitalWrite( PIN_LED2, HIGH ) ; // set the red LED on
|
||||
#endif /* sam3u_ek */
|
||||
|
||||
#if defined arduino_due_x
|
||||
digitalWrite( PIN_LED, HIGH ) ; // set the LED off
|
||||
digitalWrite( PIN_LED2, HIGH ) ; // set the red LED on
|
||||
#endif /* arduino_due_x */
|
||||
}
|
||||
|
||||
void loop( void )
|
||||
{
|
||||
led_step1() ;
|
||||
delay( 1000 ) ; // wait for a second
|
||||
led_step2() ;
|
||||
delay( 1000 ) ; // wait for a second
|
||||
|
||||
Serial1.write( '-' ) ; // send a char
|
||||
// Serial1.write( "test1\n" ) ; // send a string
|
||||
// Serial1.write( "test2" ) ; // send another string
|
||||
|
||||
Serial1.print("Analog pins: ");
|
||||
for (int i=A0; i<=MAX_ANALOG; i++) {
|
||||
int a = analogRead(i);
|
||||
Serial1.print(a, DEC);
|
||||
Serial1.print(" ");
|
||||
}
|
||||
Serial1.println();
|
||||
delay(100);
|
||||
}
|
@ -1,41 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2011 Arduino. All right reserved.
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2.1 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
|
||||
SUBMAKE_OPTIONS=--no-builtin-rules --no-builtin-variables
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Rules
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
all: test_usb_device
|
||||
|
||||
.PHONY: test_usb_device
|
||||
test:
|
||||
@echo --- Making test_usb_device
|
||||
@$(MAKE) DEBUG=1 $(SUBMAKE_OPTIONS) -f test_usb_device.mk
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
@echo --- Cleaning test_usb_device
|
||||
@$(MAKE) DEBUG=1 $(SUBMAKE_OPTIONS) -f test_usb_device.mk $@
|
||||
|
||||
.PHONY: debug
|
||||
debug:
|
||||
@echo --- Debugging test_usb_device
|
||||
@$(MAKE) DEBUG=1 $(SUBMAKE_OPTIONS) -f test_usb_device.mk $@
|
||||
|
@ -1,25 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2011 Arduino. All right reserved.
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2.1 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
|
||||
# Optimization level
|
||||
# -O1 Optimize
|
||||
# -O2 Optimize even more
|
||||
# -O3 Optimize yet more
|
||||
# -O0 Reduce compilation time and make debugging produce the expected results
|
||||
# -Os Optimize for size
|
||||
OPTIMIZATION = -g -O0 -DDEBUG
|
@ -1,85 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2011 Arduino. All right reserved.
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2.1 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
|
||||
# Tool suffix when cross-compiling
|
||||
#CROSS_COMPILE = ../../../../tools/CodeSourcery_arm/bin/arm-none-eabi-
|
||||
#CROSS_COMPILE = C:/CodeSourcery_2011.03-42/bin/arm-none-eabi-
|
||||
CROSS_COMPILE = $(ARM_GCC_TOOLCHAIN)/arm-none-eabi-
|
||||
|
||||
# Compilation tools
|
||||
AR = $(CROSS_COMPILE)ar
|
||||
CC = $(CROSS_COMPILE)gcc
|
||||
CXX = $(CROSS_COMPILE)g++
|
||||
AS = $(CROSS_COMPILE)as
|
||||
GDB = $(CROSS_COMPILE)gdb
|
||||
SIZE = $(CROSS_COMPILE)size
|
||||
NM = $(CROSS_COMPILE)nm
|
||||
OBJCOPY = $(CROSS_COMPILE)objcopy
|
||||
|
||||
ifeq ($(OS),Windows_NT)
|
||||
RM=cs-rm -Rf
|
||||
else
|
||||
RM=rm -Rf
|
||||
endif
|
||||
|
||||
SEP=\\
|
||||
|
||||
# ---------------------------------------------------------------------------------------
|
||||
# C Flags
|
||||
|
||||
CFLAGS += -Wall -Wchar-subscripts -Wcomment -Wformat=2 -Wimplicit-int
|
||||
CFLAGS += -Werror-implicit-function-declaration -Wmain -Wparentheses
|
||||
CFLAGS += -Wsequence-point -Wreturn-type -Wswitch -Wtrigraphs -Wunused
|
||||
CFLAGS += -Wuninitialized -Wunknown-pragmas -Wfloat-equal -Wundef
|
||||
CFLAGS += -Wshadow -Wpointer-arith -Wbad-function-cast -Wwrite-strings
|
||||
CFLAGS += -Wsign-compare -Waggregate-return -Wstrict-prototypes
|
||||
CFLAGS += -Wmissing-prototypes -Wmissing-declarations
|
||||
CFLAGS += -Wformat -Wmissing-format-attribute -Wno-deprecated-declarations
|
||||
CFLAGS += -Wpacked -Wredundant-decls -Wnested-externs -Winline -Wlong-long
|
||||
CFLAGS += -Wunreachable-code
|
||||
CFLAGS += -Wcast-align
|
||||
|
||||
CFLAGS += --param max-inline-insns-single=500 -mcpu=cortex-m3 -mthumb -mlong-calls -ffunction-sections -nostdlib -std=c99
|
||||
CFLAGS += $(OPTIMIZATION) $(INCLUDES) -D$(CHIP) -D$(VARIANT)
|
||||
|
||||
# To reduce application size use only integer printf function.
|
||||
CFLAGS += -Dprintf=iprintf
|
||||
|
||||
# ---------------------------------------------------------------------------------------
|
||||
# CPP Flags
|
||||
|
||||
CPPFLAGS += -Wall -Wchar-subscripts -Wcomment -Wformat=2
|
||||
CPPFLAGS += -Wmain -Wparentheses -Wcast-align -Wunreachable-code
|
||||
CPPFLAGS += -Wsequence-point -Wreturn-type -Wswitch -Wtrigraphs -Wunused
|
||||
CPPFLAGS += -Wuninitialized -Wunknown-pragmas -Wfloat-equal -Wundef
|
||||
CPPFLAGS += -Wshadow -Wpointer-arith -Wwrite-strings
|
||||
CPPFLAGS += -Wsign-compare -Waggregate-return -Wmissing-declarations
|
||||
CPPFLAGS += -Wformat -Wmissing-format-attribute -Wno-deprecated-declarations
|
||||
CPPFLAGS += -Wpacked -Wredundant-decls -Winline -Wlong-long
|
||||
|
||||
#-fno-rtti -fno-exceptions
|
||||
CPPFLAGS += --param max-inline-insns-single=500 -mcpu=cortex-m3 -mthumb -mlong-calls -ffunction-sections -std=c++98
|
||||
CPPFLAGS += $(OPTIMIZATION) $(INCLUDES) -D$(CHIP)
|
||||
|
||||
# To reduce application size use only integer printf function.
|
||||
CPPFLAGS += -Dprintf=iprintf
|
||||
|
||||
# ---------------------------------------------------------------------------------------
|
||||
# ASM Flags
|
||||
|
||||
ASFLAGS = -mcpu=cortex-m3 -mthumb -Wall -g $(OPTIMIZATION) $(INCLUDES)
|
@ -1,25 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2011 Arduino. All right reserved.
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2.1 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
|
||||
# Optimization level
|
||||
# -O1 Optimize
|
||||
# -O2 Optimize even more
|
||||
# -O3 Optimize yet more
|
||||
# -O0 Reduce compilation time and make debugging produce the expected results
|
||||
# -Os Optimize for size
|
||||
OPTIMIZATION = -Os
|
@ -1,218 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2011 Arduino. All right reserved.
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2.1 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
|
||||
# Makefile for compiling libArduino
|
||||
.SUFFIXES: .o .a .c .s
|
||||
|
||||
# putting default variant
|
||||
ifeq ("$(VARIANT)", "")
|
||||
#VARIANT=sam3s_ek
|
||||
#VARIANT=sam3u_ek
|
||||
VARIANT=arduino_due_x
|
||||
endif
|
||||
|
||||
ifeq ("$(VARIANT)", "sam3s_ek")
|
||||
CHIP=__SAM3S4C__
|
||||
VARIANT_PATH = ../../../../atmel/sam/variants/$(VARIANT)
|
||||
else ifeq ("$(VARIANT)", "sam3u_ek")
|
||||
CHIP=__SAM3U4E__
|
||||
VARIANT_PATH = ../../../../atmel/sam/variants/$(VARIANT)
|
||||
else ifeq ("$(VARIANT)", "sam3x_ek")
|
||||
CHIP=__SAM3X8H__
|
||||
VARIANT_PATH = ../../../../atmel/sam/variants/$(VARIANT)
|
||||
else ifeq ("$(VARIANT)", "arduino_due_u")
|
||||
CHIP=__SAM3U4E__
|
||||
VARIANT_PATH = ../../../../variants/$(VARIANT)
|
||||
else ifeq ("$(VARIANT)", "arduino_due_x")
|
||||
CHIP=__SAM3X8E__
|
||||
VARIANT_PATH = ../../../../variants/$(VARIANT)
|
||||
endif
|
||||
|
||||
TOOLCHAIN=gcc
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Path
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
# Libraries
|
||||
PROJECT_BASE_PATH = ./..
|
||||
SYSTEM_PATH = ../../../../system
|
||||
|
||||
ifeq ($(CHIP), __SAM3S4C__)
|
||||
CHIP_NAME=sam3s4c
|
||||
CHIP_SERIE=sam3s
|
||||
else ifeq ($(CHIP), __SAM3U4E__)
|
||||
CHIP_NAME=sam3u4e
|
||||
CHIP_SERIE=sam3u
|
||||
else ifeq ($(CHIP), __SAM3N4C__)
|
||||
CHIP_NAME=sam3n4c
|
||||
CHIP_SERIE=sam3n
|
||||
else ifeq ($(CHIP), __SAM3X8H__)
|
||||
CHIP_NAME=sam3x8h
|
||||
CHIP_SERIE=sam3xa
|
||||
else ifeq ($(CHIP), __SAM3X8E__)
|
||||
CHIP_NAME=sam3x8e
|
||||
CHIP_SERIE=sam3xa
|
||||
else
|
||||
endif
|
||||
|
||||
CMSIS_ROOT_PATH = $(SYSTEM_PATH)/CMSIS
|
||||
CMSIS_ARM_PATH=$(CMSIS_ROOT_PATH)/CMSIS/Include
|
||||
CMSIS_ATMEL_PATH=$(CMSIS_ROOT_PATH)/Device/ATMEL
|
||||
CMSIS_CHIP_PATH=$(CMSIS_ROOT_PATH)/Device/ATMEL/$(CHIP_SERIE)
|
||||
|
||||
ARDUINO_CORE_PATH=$(PROJECT_BASE_PATH)/..
|
||||
ARDUINO_USB_PATH=$(PROJECT_BASE_PATH)/../USB
|
||||
ARDUINO_USB_HOST_PATH=$(PROJECT_BASE_PATH)/../../../system/USBHost
|
||||
|
||||
# Output directories
|
||||
OUTPUT_PATH = debug_$(VARIANT)
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Files
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
vpath %.h $(PROJECT_BASE_PATH)/.. $(VARIANT_PATH) $(SYSTEM_PATH) $(CMSIS_ARM_PATH)
|
||||
vpath %.cpp $(PROJECT_BASE_PATH)
|
||||
|
||||
VPATH+=$(PROJECT_BASE_PATH)
|
||||
|
||||
INCLUDES = -I$(PROJECT_BASE_PATH)/..
|
||||
INCLUDES += -I$(VARIANT_PATH)
|
||||
#INCLUDES += -I$(VARIANT_PATH)/..
|
||||
#INCLUDES += -I$(SYSTEM_PATH)
|
||||
INCLUDES += -I$(SYSTEM_PATH)/libsam
|
||||
INCLUDES += -I$(CMSIS_ARM_PATH)
|
||||
INCLUDES += -I$(CMSIS_ATMEL_PATH)
|
||||
INCLUDES += -I$(CMSIS_CHIP_PATH)
|
||||
INCLUDES += -I$(ARDUINO_USB_PATH)
|
||||
INCLUDES += -I$(ARDUINO_USB_HOST_PATH)
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
ifdef DEBUG
|
||||
include debug.mk
|
||||
else
|
||||
include release.mk
|
||||
endif
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Tools
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
include $(TOOLCHAIN).mk
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
ifdef DEBUG
|
||||
OUTPUT_OBJ=debug
|
||||
LIBS_POSTFIX=dbg
|
||||
else
|
||||
OUTPUT_OBJ=release
|
||||
LIBS_POSTFIX=rel
|
||||
endif
|
||||
|
||||
OUTPUT_BIN=test_$(TOOLCHAIN)_$(LIBS_POSTFIX)
|
||||
LIBS=-Wl,--start-group -lgcc -lc -lstdc++ -lsam_$(CHIP_NAME)_$(TOOLCHAIN)_$(LIBS_POSTFIX) -larduino_$(VARIANT)_$(TOOLCHAIN)_$(LIBS_POSTFIX) -lvariant_$(VARIANT)_$(TOOLCHAIN)_$(LIBS_POSTFIX) -Wl,--end-group
|
||||
|
||||
LIB_PATH =-L$(PROJECT_BASE_PATH)/..
|
||||
LIB_PATH+=-L=/lib/thumb2
|
||||
#LIB_PATH+=-L=/../lib/gcc/arm-none-eabi/4.5.2/thumb2
|
||||
|
||||
LDFLAGS= -mcpu=cortex-m3 -mthumb -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--entry=Reset_Handler -Wl,--unresolved-symbols=report-all -Wl,--warn-common -Wl,--warn-section-align -Wl,--warn-unresolved-symbols
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# CPP source files and objects
|
||||
#-------------------------------------------------------------------------------
|
||||
CPP_SRC=$(wildcard $(PROJECT_BASE_PATH)/*.cpp)
|
||||
|
||||
CPP_OBJ_TEMP = $(patsubst %.cpp, %.o, $(notdir $(CPP_SRC)))
|
||||
|
||||
# during development, remove some files
|
||||
CPP_OBJ_FILTER=
|
||||
|
||||
CPP_OBJ=$(filter-out $(CPP_OBJ_FILTER), $(CPP_OBJ_TEMP))
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Rules
|
||||
#-------------------------------------------------------------------------------
|
||||
all: test
|
||||
|
||||
test: create_output libsam_$(CHIP_NAME)_$(TOOLCHAIN)_$(LIBS_POSTFIX).a libarduino_$(VARIANT)_$(TOOLCHAIN)_$(LIBS_POSTFIX).a libvariant_$(VARIANT)_$(TOOLCHAIN)_$(LIBS_POSTFIX).a $(OUTPUT_BIN)
|
||||
|
||||
|
||||
.PHONY: create_output
|
||||
create_output:
|
||||
@echo --- Preparing $(VARIANT) files in $(OUTPUT_PATH) $(OUTPUT_BIN)
|
||||
# @echo -------------------------
|
||||
# @echo *$(INCLUDES)
|
||||
# @echo -------------------------
|
||||
# @echo *$(C_SRC)
|
||||
# @echo -------------------------
|
||||
# @echo *$(C_OBJ)
|
||||
# @echo -------------------------
|
||||
# @echo *$(addprefix $(OUTPUT_PATH)/, $(C_OBJ))
|
||||
# @echo -------------------------
|
||||
# @echo *$(CPP_SRC)
|
||||
# @echo -------------------------
|
||||
# @echo *$(CPP_OBJ)
|
||||
# @echo -------------------------
|
||||
# @echo *$(addprefix $(OUTPUT_PATH)/, $(CPP_OBJ))
|
||||
# @echo -------------------------
|
||||
# @echo *$(A_SRC)
|
||||
# @echo -------------------------
|
||||
|
||||
-@mkdir $(OUTPUT_PATH) 1>NUL 2>&1
|
||||
|
||||
$(addprefix $(OUTPUT_PATH)/,$(CPP_OBJ)): $(OUTPUT_PATH)/%.o: %.cpp
|
||||
# @"$(CC)" -c $(CPPFLAGS) $< -o $@
|
||||
@"$(CXX)" -c $(CPPFLAGS) $< -o $@
|
||||
# @"$(CXX)" -v -c $(CPPFLAGS) $< -o $@
|
||||
|
||||
$(OUTPUT_BIN): $(addprefix $(OUTPUT_PATH)/, $(C_OBJ)) $(addprefix $(OUTPUT_PATH)/, $(CPP_OBJ)) $(addprefix $(OUTPUT_PATH)/, $(A_OBJ))
|
||||
@"$(CC)" $(LIB_PATH) $(LDFLAGS) -T"$(VARIANT_PATH)/linker_scripts/gcc/flash.ld" -Wl,-Map,$(OUTPUT_PATH)/$@.map -o $(OUTPUT_PATH)/$@.elf $^ $(LIBS)
|
||||
# @"$(CC)" $(LIB_PATH) $(LDFLAGS) -T"$(VARIANT_PATH)/linker_scripts/gcc/sram.ld" -Wl,-Map,$(OUTPUT_PATH)/$@.map -o $(OUTPUT_PATH)/$@.elf $^ $(LIBS)
|
||||
@"$(NM)" $(OUTPUT_PATH)/$@.elf >$(OUTPUT_PATH)/$@.elf.txt
|
||||
@"$(OBJCOPY)" -O binary $(OUTPUT_PATH)/$@.elf $(OUTPUT_PATH)/$@.bin
|
||||
$(SIZE) $^ $(OUTPUT_PATH)/$@.elf
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
@echo --- Cleaning test files
|
||||
-@$(RM) $(OUTPUT_PATH) 1>NUL 2>&1
|
||||
|
||||
# -$(RM) $(OUTPUT_PATH)/test.o
|
||||
# -$(RM) $(OUTPUT_PATH)/$(OUTPUT_BIN).elf
|
||||
# -$(RM) $(OUTPUT_PATH)/$(OUTPUT_BIN).elf.txt
|
||||
# -$(RM) $(OUTPUT_PATH)/$(OUTPUT_BIN).bin
|
||||
# -$(RM) $(OUTPUT_PATH)/$(OUTPUT_BIN).map
|
||||
|
||||
debug: test
|
||||
@"$(GDB)" -x "$(VARIANT_PATH)/debug_scripts/gcc/$(VARIANT)_flash.gdb" -ex "reset" -readnow -se $(OUTPUT_PATH)/$(OUTPUT_BIN).elf
|
||||
# @"$(GDB)" -w -x "$(VARIANT_PATH)/debug_scripts/gcc/$(VARIANT)_sram.gdb" -ex "reset" -readnow -se $(OUTPUT_PATH)/$(OUTPUT_BIN).elf
|
||||
|
||||
libsam_$(CHIP_NAME)_$(TOOLCHAIN)_$(LIBS_POSTFIX).a:
|
||||
@echo Building $@
|
||||
@$(MAKE) -C $(SYSTEM_PATH)/libsam/build_gcc -f Makefile $@
|
||||
|
||||
libarduino_$(VARIANT)_$(TOOLCHAIN)_$(LIBS_POSTFIX).a:
|
||||
@echo Building $@
|
||||
$(MAKE) -C $(ARDUINO_CORE_PATH)/build_gcc -f Makefile $(VARIANT)
|
||||
|
||||
libvariant_$(VARIANT)_$(TOOLCHAIN)_$(LIBS_POSTFIX).a:
|
||||
@echo Building $@
|
||||
$(MAKE) -C $(VARIANT_PATH)/build_gcc -f Makefile $(VARIANT)
|
||||
|
@ -1,38 +0,0 @@
|
||||
/*
|
||||
Copyright (c) 2012 Arduino. All right reserved.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
See the GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "variant.h"
|
||||
#include <stdio.h>
|
||||
|
||||
void setup() {
|
||||
Serial.begin(57600);
|
||||
Mouse.begin();
|
||||
}
|
||||
|
||||
void loop() {
|
||||
Mouse.move(1, 0, 0);
|
||||
|
||||
if (Serial.available() > 0)
|
||||
{
|
||||
char inChar = Serial.read();
|
||||
Serial.print(inChar);
|
||||
Serial1.print(inChar);
|
||||
}
|
||||
|
||||
delay(10);
|
||||
}
|
@ -1,41 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2011 Arduino. All right reserved.
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2.1 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
|
||||
SUBMAKE_OPTIONS=--no-builtin-rules --no-builtin-variables
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Rules
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
all: test_usb_host
|
||||
|
||||
.PHONY: test_usb_host
|
||||
test:
|
||||
@echo --- Making test_usb_host
|
||||
@$(MAKE) DEBUG=1 $(SUBMAKE_OPTIONS) -f test_usb_host.mk
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
@echo --- Cleaning test_usb_host
|
||||
@$(MAKE) DEBUG=1 $(SUBMAKE_OPTIONS) -f test_usb_host.mk $@
|
||||
|
||||
.PHONY: debug
|
||||
debug:
|
||||
@echo --- Debugging test_usb_host
|
||||
@$(MAKE) DEBUG=1 $(SUBMAKE_OPTIONS) -f test_usb_host.mk $@
|
||||
|
@ -1,25 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2011 Arduino. All right reserved.
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2.1 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
|
||||
# Optimization level
|
||||
# -O1 Optimize
|
||||
# -O2 Optimize even more
|
||||
# -O3 Optimize yet more
|
||||
# -O0 Reduce compilation time and make debugging produce the expected results
|
||||
# -Os Optimize for size
|
||||
OPTIMIZATION = -g -O0 -DDEBUG
|
@ -1,85 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2011 Arduino. All right reserved.
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2.1 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
|
||||
# Tool suffix when cross-compiling
|
||||
#CROSS_COMPILE = ../../../../tools/CodeSourcery_arm/bin/arm-none-eabi-
|
||||
#CROSS_COMPILE = C:/CodeSourcery_2011.03-42/bin/arm-none-eabi-
|
||||
CROSS_COMPILE = $(ARM_GCC_TOOLCHAIN)/arm-none-eabi-
|
||||
|
||||
# Compilation tools
|
||||
AR = $(CROSS_COMPILE)ar
|
||||
CC = $(CROSS_COMPILE)gcc
|
||||
CXX = $(CROSS_COMPILE)g++
|
||||
AS = $(CROSS_COMPILE)as
|
||||
GDB = $(CROSS_COMPILE)gdb
|
||||
SIZE = $(CROSS_COMPILE)size
|
||||
NM = $(CROSS_COMPILE)nm
|
||||
OBJCOPY = $(CROSS_COMPILE)objcopy
|
||||
|
||||
ifeq ($(OS),Windows_NT)
|
||||
RM=cs-rm -Rf
|
||||
else
|
||||
RM=rm -Rf
|
||||
endif
|
||||
|
||||
SEP=\\
|
||||
|
||||
# ---------------------------------------------------------------------------------------
|
||||
# C Flags
|
||||
|
||||
CFLAGS += -Wall -Wchar-subscripts -Wcomment -Wformat=2 -Wimplicit-int
|
||||
CFLAGS += -Werror-implicit-function-declaration -Wmain -Wparentheses
|
||||
CFLAGS += -Wsequence-point -Wreturn-type -Wswitch -Wtrigraphs -Wunused
|
||||
CFLAGS += -Wuninitialized -Wunknown-pragmas -Wfloat-equal -Wundef
|
||||
CFLAGS += -Wshadow -Wpointer-arith -Wbad-function-cast -Wwrite-strings
|
||||
CFLAGS += -Wsign-compare -Waggregate-return -Wstrict-prototypes
|
||||
CFLAGS += -Wmissing-prototypes -Wmissing-declarations
|
||||
CFLAGS += -Wformat -Wmissing-format-attribute -Wno-deprecated-declarations
|
||||
CFLAGS += -Wpacked -Wredundant-decls -Wnested-externs -Winline -Wlong-long
|
||||
CFLAGS += -Wunreachable-code
|
||||
CFLAGS += -Wcast-align
|
||||
|
||||
CFLAGS += --param max-inline-insns-single=500 -mcpu=cortex-m3 -mthumb -mlong-calls -ffunction-sections -nostdlib -std=c99
|
||||
CFLAGS += $(OPTIMIZATION) $(INCLUDES) -D$(CHIP) -D$(VARIANT)
|
||||
|
||||
# To reduce application size use only integer printf function.
|
||||
CFLAGS += -Dprintf=iprintf
|
||||
|
||||
# ---------------------------------------------------------------------------------------
|
||||
# CPP Flags
|
||||
|
||||
CPPFLAGS += -Wall -Wchar-subscripts -Wcomment -Wformat=2
|
||||
CPPFLAGS += -Wmain -Wparentheses -Wcast-align -Wunreachable-code
|
||||
CPPFLAGS += -Wsequence-point -Wreturn-type -Wswitch -Wtrigraphs -Wunused
|
||||
CPPFLAGS += -Wuninitialized -Wunknown-pragmas -Wfloat-equal -Wundef
|
||||
CPPFLAGS += -Wshadow -Wpointer-arith -Wwrite-strings
|
||||
CPPFLAGS += -Wsign-compare -Waggregate-return -Wmissing-declarations
|
||||
CPPFLAGS += -Wformat -Wmissing-format-attribute -Wno-deprecated-declarations
|
||||
CPPFLAGS += -Wpacked -Wredundant-decls -Winline -Wlong-long
|
||||
|
||||
#-fno-rtti -fno-exceptions
|
||||
CPPFLAGS += --param max-inline-insns-single=500 -mcpu=cortex-m3 -mthumb -mlong-calls -ffunction-sections -std=c++98
|
||||
CPPFLAGS += $(OPTIMIZATION) $(INCLUDES) -D$(CHIP)
|
||||
|
||||
# To reduce application size use only integer printf function.
|
||||
CPPFLAGS += -Dprintf=iprintf
|
||||
|
||||
# ---------------------------------------------------------------------------------------
|
||||
# ASM Flags
|
||||
|
||||
ASFLAGS = -mcpu=cortex-m3 -mthumb -Wall -g $(OPTIMIZATION) $(INCLUDES)
|
@ -1,25 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2011 Arduino. All right reserved.
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2.1 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
|
||||
# Optimization level
|
||||
# -O1 Optimize
|
||||
# -O2 Optimize even more
|
||||
# -O3 Optimize yet more
|
||||
# -O0 Reduce compilation time and make debugging produce the expected results
|
||||
# -Os Optimize for size
|
||||
OPTIMIZATION = -Os
|
@ -1,218 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2011 Arduino. All right reserved.
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2.1 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
|
||||
# Makefile for compiling libArduino
|
||||
.SUFFIXES: .o .a .c .s
|
||||
|
||||
# putting default variant
|
||||
ifeq ("$(VARIANT)", "")
|
||||
#VARIANT=sam3s_ek
|
||||
#VARIANT=sam3u_ek
|
||||
VARIANT=arduino_due_x
|
||||
endif
|
||||
|
||||
ifeq ("$(VARIANT)", "sam3s_ek")
|
||||
CHIP=__SAM3S4C__
|
||||
VARIANT_PATH = ../../../../atmel/sam/variants/$(VARIANT)
|
||||
else ifeq ("$(VARIANT)", "sam3u_ek")
|
||||
CHIP=__SAM3U4E__
|
||||
VARIANT_PATH = ../../../../atmel/sam/variants/$(VARIANT)
|
||||
else ifeq ("$(VARIANT)", "sam3x_ek")
|
||||
CHIP=__SAM3X8H__
|
||||
VARIANT_PATH = ../../../../atmel/sam/variants/$(VARIANT)
|
||||
else ifeq ("$(VARIANT)", "arduino_due_u")
|
||||
CHIP=__SAM3U4E__
|
||||
VARIANT_PATH = ../../../../variants/$(VARIANT)
|
||||
else ifeq ("$(VARIANT)", "arduino_due_x")
|
||||
CHIP=__SAM3X8E__
|
||||
VARIANT_PATH = ../../../../variants/$(VARIANT)
|
||||
endif
|
||||
|
||||
TOOLCHAIN=gcc
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Path
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
# Libraries
|
||||
PROJECT_BASE_PATH = ./..
|
||||
SYSTEM_PATH = ../../../../system
|
||||
|
||||
ifeq ($(CHIP), __SAM3S4C__)
|
||||
CHIP_NAME=sam3s4c
|
||||
CHIP_SERIE=sam3s
|
||||
else ifeq ($(CHIP), __SAM3U4E__)
|
||||
CHIP_NAME=sam3u4e
|
||||
CHIP_SERIE=sam3u
|
||||
else ifeq ($(CHIP), __SAM3N4C__)
|
||||
CHIP_NAME=sam3n4c
|
||||
CHIP_SERIE=sam3n
|
||||
else ifeq ($(CHIP), __SAM3X8H__)
|
||||
CHIP_NAME=sam3x8h
|
||||
CHIP_SERIE=sam3xa
|
||||
else ifeq ($(CHIP), __SAM3X8E__)
|
||||
CHIP_NAME=sam3x8e
|
||||
CHIP_SERIE=sam3xa
|
||||
else
|
||||
endif
|
||||
|
||||
CMSIS_ROOT_PATH = $(SYSTEM_PATH)/CMSIS
|
||||
CMSIS_ARM_PATH=$(CMSIS_ROOT_PATH)/CMSIS/Include
|
||||
CMSIS_ATMEL_PATH=$(CMSIS_ROOT_PATH)/Device/ATMEL
|
||||
CMSIS_CHIP_PATH=$(CMSIS_ROOT_PATH)/Device/ATMEL/$(CHIP_SERIE)
|
||||
|
||||
ARDUINO_CORE_PATH=$(PROJECT_BASE_PATH)/..
|
||||
ARDUINO_USB_PATH=$(PROJECT_BASE_PATH)/../USB
|
||||
ARDUINO_USB_HOST_PATH=$(PROJECT_BASE_PATH)/../../../system/USBHost
|
||||
|
||||
# Output directories
|
||||
OUTPUT_PATH = debug_$(VARIANT)
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Files
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
vpath %.h $(PROJECT_BASE_PATH)/.. $(VARIANT_PATH) $(SYSTEM_PATH) $(CMSIS_ARM_PATH)
|
||||
vpath %.cpp $(PROJECT_BASE_PATH)
|
||||
|
||||
VPATH+=$(PROJECT_BASE_PATH)
|
||||
|
||||
INCLUDES = -I$(PROJECT_BASE_PATH)/..
|
||||
INCLUDES += -I$(VARIANT_PATH)
|
||||
#INCLUDES += -I$(VARIANT_PATH)/..
|
||||
#INCLUDES += -I$(SYSTEM_PATH)
|
||||
INCLUDES += -I$(SYSTEM_PATH)/libsam
|
||||
INCLUDES += -I$(CMSIS_ARM_PATH)
|
||||
INCLUDES += -I$(CMSIS_ATMEL_PATH)
|
||||
INCLUDES += -I$(CMSIS_CHIP_PATH)
|
||||
INCLUDES += -I$(ARDUINO_USB_PATH)
|
||||
INCLUDES += -I$(ARDUINO_USB_HOST_PATH)
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
ifdef DEBUG
|
||||
include debug.mk
|
||||
else
|
||||
include release.mk
|
||||
endif
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Tools
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
include $(TOOLCHAIN).mk
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
ifdef DEBUG
|
||||
OUTPUT_OBJ=debug
|
||||
LIBS_POSTFIX=dbg
|
||||
else
|
||||
OUTPUT_OBJ=release
|
||||
LIBS_POSTFIX=rel
|
||||
endif
|
||||
|
||||
OUTPUT_BIN=test_$(TOOLCHAIN)_$(LIBS_POSTFIX)
|
||||
LIBS=-Wl,--start-group -lgcc -lc -lstdc++ -lsam_$(CHIP_NAME)_$(TOOLCHAIN)_$(LIBS_POSTFIX) -larduino_$(VARIANT)_$(TOOLCHAIN)_$(LIBS_POSTFIX) -lvariant_$(VARIANT)_$(TOOLCHAIN)_$(LIBS_POSTFIX) -Wl,--end-group
|
||||
|
||||
LIB_PATH =-L$(PROJECT_BASE_PATH)/..
|
||||
LIB_PATH+=-L=/lib/thumb2
|
||||
#LIB_PATH+=-L=/../lib/gcc/arm-none-eabi/4.5.2/thumb2
|
||||
|
||||
LDFLAGS= -mcpu=cortex-m3 -mthumb -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--entry=Reset_Handler -Wl,--unresolved-symbols=report-all -Wl,--warn-common -Wl,--warn-section-align -Wl,--warn-unresolved-symbols
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# CPP source files and objects
|
||||
#-------------------------------------------------------------------------------
|
||||
CPP_SRC=$(wildcard $(PROJECT_BASE_PATH)/*.cpp)
|
||||
|
||||
CPP_OBJ_TEMP = $(patsubst %.cpp, %.o, $(notdir $(CPP_SRC)))
|
||||
|
||||
# during development, remove some files
|
||||
CPP_OBJ_FILTER=
|
||||
|
||||
CPP_OBJ=$(filter-out $(CPP_OBJ_FILTER), $(CPP_OBJ_TEMP))
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Rules
|
||||
#-------------------------------------------------------------------------------
|
||||
all: test
|
||||
|
||||
test: create_output libsam_$(CHIP_NAME)_$(TOOLCHAIN)_$(LIBS_POSTFIX).a libarduino_$(VARIANT)_$(TOOLCHAIN)_$(LIBS_POSTFIX).a libvariant_$(VARIANT)_$(TOOLCHAIN)_$(LIBS_POSTFIX).a $(OUTPUT_BIN)
|
||||
|
||||
|
||||
.PHONY: create_output
|
||||
create_output:
|
||||
@echo --- Preparing $(VARIANT) files in $(OUTPUT_PATH) $(OUTPUT_BIN)
|
||||
# @echo -------------------------
|
||||
# @echo *$(INCLUDES)
|
||||
# @echo -------------------------
|
||||
# @echo *$(C_SRC)
|
||||
# @echo -------------------------
|
||||
# @echo *$(C_OBJ)
|
||||
# @echo -------------------------
|
||||
# @echo *$(addprefix $(OUTPUT_PATH)/, $(C_OBJ))
|
||||
# @echo -------------------------
|
||||
# @echo *$(CPP_SRC)
|
||||
# @echo -------------------------
|
||||
# @echo *$(CPP_OBJ)
|
||||
# @echo -------------------------
|
||||
# @echo *$(addprefix $(OUTPUT_PATH)/, $(CPP_OBJ))
|
||||
# @echo -------------------------
|
||||
# @echo *$(A_SRC)
|
||||
# @echo -------------------------
|
||||
|
||||
-@mkdir $(OUTPUT_PATH) 1>NUL 2>&1
|
||||
|
||||
$(addprefix $(OUTPUT_PATH)/,$(CPP_OBJ)): $(OUTPUT_PATH)/%.o: %.cpp
|
||||
# @"$(CC)" -c $(CPPFLAGS) $< -o $@
|
||||
@"$(CXX)" -c $(CPPFLAGS) $< -o $@
|
||||
# @"$(CXX)" -v -c $(CPPFLAGS) $< -o $@
|
||||
|
||||
$(OUTPUT_BIN): $(addprefix $(OUTPUT_PATH)/, $(C_OBJ)) $(addprefix $(OUTPUT_PATH)/, $(CPP_OBJ)) $(addprefix $(OUTPUT_PATH)/, $(A_OBJ))
|
||||
@"$(CC)" $(LIB_PATH) $(LDFLAGS) -T"$(VARIANT_PATH)/linker_scripts/gcc/flash.ld" -Wl,-Map,$(OUTPUT_PATH)/$@.map -o $(OUTPUT_PATH)/$@.elf $^ $(LIBS)
|
||||
# @"$(CC)" $(LIB_PATH) $(LDFLAGS) -T"$(VARIANT_PATH)/linker_scripts/gcc/sram.ld" -Wl,-Map,$(OUTPUT_PATH)/$@.map -o $(OUTPUT_PATH)/$@.elf $^ $(LIBS)
|
||||
@"$(NM)" $(OUTPUT_PATH)/$@.elf >$(OUTPUT_PATH)/$@.elf.txt
|
||||
@"$(OBJCOPY)" -O binary $(OUTPUT_PATH)/$@.elf $(OUTPUT_PATH)/$@.bin
|
||||
$(SIZE) $^ $(OUTPUT_PATH)/$@.elf
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
@echo --- Cleaning test files
|
||||
-@$(RM) $(OUTPUT_PATH) 1>NUL 2>&1
|
||||
|
||||
# -$(RM) $(OUTPUT_PATH)/test.o
|
||||
# -$(RM) $(OUTPUT_PATH)/$(OUTPUT_BIN).elf
|
||||
# -$(RM) $(OUTPUT_PATH)/$(OUTPUT_BIN).elf.txt
|
||||
# -$(RM) $(OUTPUT_PATH)/$(OUTPUT_BIN).bin
|
||||
# -$(RM) $(OUTPUT_PATH)/$(OUTPUT_BIN).map
|
||||
|
||||
debug: test
|
||||
@"$(GDB)" -x "$(VARIANT_PATH)/debug_scripts/gcc/$(VARIANT)_flash.gdb" -ex "reset" -readnow -se $(OUTPUT_PATH)/$(OUTPUT_BIN).elf
|
||||
# @"$(GDB)" -w -x "$(VARIANT_PATH)/debug_scripts/gcc/$(VARIANT)_sram.gdb" -ex "reset" -readnow -se $(OUTPUT_PATH)/$(OUTPUT_BIN).elf
|
||||
|
||||
libsam_$(CHIP_NAME)_$(TOOLCHAIN)_$(LIBS_POSTFIX).a:
|
||||
@echo Building $@
|
||||
@$(MAKE) -C $(SYSTEM_PATH)/libsam/build_gcc -f Makefile $@
|
||||
|
||||
libarduino_$(VARIANT)_$(TOOLCHAIN)_$(LIBS_POSTFIX).a:
|
||||
@echo Building $@
|
||||
$(MAKE) -C $(ARDUINO_CORE_PATH)/build_gcc -f Makefile $(VARIANT)
|
||||
|
||||
libvariant_$(VARIANT)_$(TOOLCHAIN)_$(LIBS_POSTFIX).a:
|
||||
@echo Building $@
|
||||
$(MAKE) -C $(VARIANT_PATH)/build_gcc -f Makefile $(VARIANT)
|
||||
|
@ -1,54 +0,0 @@
|
||||
#include "variant.h"
|
||||
#include <stdio.h>
|
||||
#include <adk.h>
|
||||
|
||||
// Accessory descriptor. It's how Arduino identifies itself to Android.
|
||||
char applicationName[] = "Arduino_Terminal"; // the app on your phone
|
||||
char accessoryName[] = "Arduino Due X"; // your Arduino board
|
||||
char companyName[] = "Arduino SA";
|
||||
|
||||
// Make up anything you want for these
|
||||
char versionNumber[] = "1.0";
|
||||
char serialNumber[] = "1";
|
||||
char url[] = "http://labs.arduino.cc/uploads/ADK/ArduinoTerminal/ThibaultTerminal_ICS_0001.apk";
|
||||
|
||||
USBHost Usb;
|
||||
ADK adk(&Usb, companyName, applicationName, accessoryName,versionNumber,url,serialNumber);
|
||||
|
||||
void setup()
|
||||
{
|
||||
cpu_irq_enable();
|
||||
printf("\r\nADK demo start\r\n");
|
||||
delay(200);
|
||||
}
|
||||
|
||||
#define RCVSIZE 128
|
||||
|
||||
void loop()
|
||||
{
|
||||
uint8_t buf[RCVSIZE];
|
||||
uint32_t nbread = 0;
|
||||
char helloworld[] = "Hello World!\r\n";
|
||||
|
||||
Usb.Task();
|
||||
|
||||
if (adk.isReady())
|
||||
{
|
||||
/* Write hello string to ADK */
|
||||
adk.write(strlen(helloworld), (uint8_t *)helloworld);
|
||||
|
||||
delay(1000);
|
||||
|
||||
/* Read data from ADK and print to UART */
|
||||
adk.read(&nbread, RCVSIZE, buf);
|
||||
if (nbread > 0)
|
||||
{
|
||||
printf("RCV: ");
|
||||
for (uint32_t i = 0; i < nbread; ++i)
|
||||
{
|
||||
printf("%c", (char)buf[i]);
|
||||
}
|
||||
printf("\r\n");
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user