From 8f8ce634dc068a85fff67689b41d0e10eab5be11 Mon Sep 17 00:00:00 2001 From: Thibaut VIARD Date: Tue, 11 Oct 2011 20:48:07 +0200 Subject: [PATCH] [sam] adding untested production test firmware --- .../sam/prod_test_due/build_gcc/Makefile | 23 + .../sam/prod_test_due/build_gcc/debug.mk | 7 + .../cores/sam/prod_test_due/build_gcc/gcc.mk | 62 + .../prod_test_due/build_gcc/prod_test_due.mk | 165 ++ .../sam/prod_test_due/build_gcc/release.mk | 8 + .../prod_test_due/build_iar/prod_test_due.ewd | 1769 ++++++++++++++++ .../prod_test_due/build_iar/prod_test_due.ewp | 1834 +++++++++++++++++ hardware/sam/cores/sam/prod_test_due/main.cpp | 227 ++ 8 files changed, 4095 insertions(+) create mode 100644 hardware/sam/cores/sam/prod_test_due/build_gcc/Makefile create mode 100644 hardware/sam/cores/sam/prod_test_due/build_gcc/debug.mk create mode 100644 hardware/sam/cores/sam/prod_test_due/build_gcc/gcc.mk create mode 100644 hardware/sam/cores/sam/prod_test_due/build_gcc/prod_test_due.mk create mode 100644 hardware/sam/cores/sam/prod_test_due/build_gcc/release.mk create mode 100644 hardware/sam/cores/sam/prod_test_due/build_iar/prod_test_due.ewd create mode 100644 hardware/sam/cores/sam/prod_test_due/build_iar/prod_test_due.ewp create mode 100644 hardware/sam/cores/sam/prod_test_due/main.cpp diff --git a/hardware/sam/cores/sam/prod_test_due/build_gcc/Makefile b/hardware/sam/cores/sam/prod_test_due/build_gcc/Makefile new file mode 100644 index 000000000..523e4c150 --- /dev/null +++ b/hardware/sam/cores/sam/prod_test_due/build_gcc/Makefile @@ -0,0 +1,23 @@ +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 $@ + diff --git a/hardware/sam/cores/sam/prod_test_due/build_gcc/debug.mk b/hardware/sam/cores/sam/prod_test_due/build_gcc/debug.mk new file mode 100644 index 000000000..3ab3f8066 --- /dev/null +++ b/hardware/sam/cores/sam/prod_test_due/build_gcc/debug.mk @@ -0,0 +1,7 @@ +# 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 diff --git a/hardware/sam/cores/sam/prod_test_due/build_gcc/gcc.mk b/hardware/sam/cores/sam/prod_test_due/build_gcc/gcc.mk new file mode 100644 index 000000000..827d15318 --- /dev/null +++ b/hardware/sam/cores/sam/prod_test_due/build_gcc/gcc.mk @@ -0,0 +1,62 @@ + +# 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) diff --git a/hardware/sam/cores/sam/prod_test_due/build_gcc/prod_test_due.mk b/hardware/sam/cores/sam/prod_test_due/build_gcc/prod_test_due.mk new file mode 100644 index 000000000..ad6b5f18e --- /dev/null +++ b/hardware/sam/cores/sam/prod_test_due/build_gcc/prod_test_due.mk @@ -0,0 +1,165 @@ +# 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 diff --git a/hardware/sam/cores/sam/prod_test_due/build_gcc/release.mk b/hardware/sam/cores/sam/prod_test_due/build_gcc/release.mk new file mode 100644 index 000000000..b4e815985 --- /dev/null +++ b/hardware/sam/cores/sam/prod_test_due/build_gcc/release.mk @@ -0,0 +1,8 @@ + +# 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 diff --git a/hardware/sam/cores/sam/prod_test_due/build_iar/prod_test_due.ewd b/hardware/sam/cores/sam/prod_test_due/build_iar/prod_test_due.ewd new file mode 100644 index 000000000..a8513fb89 --- /dev/null +++ b/hardware/sam/cores/sam/prod_test_due/build_iar/prod_test_due.ewd @@ -0,0 +1,1769 @@ + + + + 2 + + Debug + + ARM + + 1 + + C-SPY + 2 + + 22 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ARMSIM_ID + 2 + + 1 + 1 + 1 + + + + + + + + ANGEL_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + + GDBSERVER_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + IARROM_ID + 2 + + 1 + 1 + 1 + + + + + + + + + JLINK_ID + 2 + + 13 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LMIFTDI_ID + 2 + + 2 + 1 + 1 + + + + + + + + + + MACRAIGOR_ID + 2 + + 3 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + PEMICRO_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + + + + + + + RDI_ID + 2 + + 2 + 1 + 1 + + + + + + + + + + + + + + + + STLINK_ID + 2 + + 2 + 1 + 1 + + + + + + + + + + + THIRDPARTY_ID + 2 + + 0 + 1 + 1 + + + + + + + + XDS100_ID + 2 + + 0 + 1 + 1 + + + + + + + $TOOLKIT_DIR$\plugins\rtos\AVIX\AVIX.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\MQX\MQXRtosPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\PowerPac\PowerPacRTOS.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\Quadros\Quadros_EWB6_Plugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin + 0 + + + $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin + 0 + + + $EW_DIR$\common\plugins\SymList\SymList.ENU.ewplugin + 1 + + + + + Release + + ARM + + 0 + + C-SPY + 2 + + 22 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ARMSIM_ID + 2 + + 1 + 1 + 0 + + + + + + + + ANGEL_ID + 2 + + 0 + 1 + 0 + + + + + + + + + + + + GDBSERVER_ID + 2 + + 0 + 1 + 0 + + + + + + + + + + + IARROM_ID + 2 + + 1 + 1 + 0 + + + + + + + + + JLINK_ID + 2 + + 13 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LMIFTDI_ID + 2 + + 2 + 1 + 0 + + + + + + + + + + MACRAIGOR_ID + 2 + + 3 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + PEMICRO_ID + 2 + + 0 + 1 + 0 + + + + + + + + + + + + + + + + + RDI_ID + 2 + + 2 + 1 + 0 + + + + + + + + + + + + + + + + STLINK_ID + 2 + + 2 + 1 + 0 + + + + + + + + + + + THIRDPARTY_ID + 2 + + 0 + 1 + 0 + + + + + + + + XDS100_ID + 2 + + 0 + 1 + 0 + + + + + + + $TOOLKIT_DIR$\plugins\rtos\AVIX\AVIX.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\MQX\MQXRtosPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\PowerPac\PowerPacRTOS.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\Quadros\Quadros_EWB6_Plugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin + 0 + + + $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin + 0 + + + $EW_DIR$\common\plugins\SymList\SymList.ENU.ewplugin + 1 + + + + + + diff --git a/hardware/sam/cores/sam/prod_test_due/build_iar/prod_test_due.ewp b/hardware/sam/cores/sam/prod_test_due/build_iar/prod_test_due.ewp new file mode 100644 index 000000000..c22825fb8 --- /dev/null +++ b/hardware/sam/cores/sam/prod_test_due/build_iar/prod_test_due.ewp @@ -0,0 +1,1834 @@ + + + + 2 + + Debug + + ARM + + 1 + + General + 3 + + 21 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ICCARM + 2 + + 28 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AARM + 2 + + 8 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OBJCOPY + 0 + + 1 + 1 + 1 + + + + + + + + + CUSTOM + 3 + + + + + + + BICOMP + 0 + + + + BUILDACTION + 1 + + + + + + + ILINK + 0 + + 13 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + IARCHIVE + 0 + + 0 + 1 + 1 + + + + + + + BILINK + 0 + + + + + Release + + ARM + + 0 + + General + 3 + + 21 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ICCARM + 2 + + 28 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AARM + 2 + + 8 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OBJCOPY + 0 + + 1 + 1 + 0 + + + + + + + + + CUSTOM + 3 + + + + + + + BICOMP + 0 + + + + BUILDACTION + 1 + + + + + + + ILINK + 0 + + 13 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + IARCHIVE + 0 + + 0 + 1 + 0 + + + + + + + BILINK + 0 + + + + + resources + + arduino_due + + + sam3s_ek + + $PROJ_DIR$\..\..\..\..\variants\sam3s_ek\linker_scripts\iar\sam3s_ek_flash.icf + + + $PROJ_DIR$\..\..\..\..\variants\sam3s_ek\debug_scripts\iar\sam3s_ek_flash.mac + + + $PROJ_DIR$\..\..\..\..\variants\sam3s_ek\linker_scripts\iar\sam3s_ek_sram.icf + + + $PROJ_DIR$\..\..\..\..\variants\sam3s_ek\debug_scripts\iar\sam3s_ek_sram.mac + + + + sam3u_ek + + + + $PROJ_DIR$\..\..\libarduino_sam3s_ek_ewarm_dbg.a + + + $PROJ_DIR$\..\..\libsam_sam3s4c_ewarm_dbg.a + + + $PROJ_DIR$\..\..\libvariant_sam3s_ek_ewarm_dbg.a + + + $PROJ_DIR$\..\test.cpp + + + + diff --git a/hardware/sam/cores/sam/prod_test_due/main.cpp b/hardware/sam/cores/sam/prod_test_due/main.cpp new file mode 100644 index 000000000..9c8fdde77 --- /dev/null +++ b/hardware/sam/cores/sam/prod_test_due/main.cpp @@ -0,0 +1,227 @@ +/* ---------------------------------------------------------------------------- + * SAM Software Package License + * ---------------------------------------------------------------------------- + * Copyright (c) 2011, Atmel Corporation + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the disclaimer below. + * + * Atmel's name may not be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE + * DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * ---------------------------------------------------------------------------- + */ + +#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 ) ; + } + } +} + +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 + } +}