switch to setup for Arduino Boards Manager

This commit is contained in:
Erik Tylek Kettenburg
2015-06-23 12:42:35 -07:00
parent bc55c9bb45
commit 6ca6b114d5
3581 changed files with 93 additions and 51 deletions

View File

@@ -0,0 +1,75 @@
# ----------------------------------------------------------------------------
# ATMEL Microcontroller Software Support
# ----------------------------------------------------------------------------
# Copyright (c) 2010, Atmel Corporation
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following condition is 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.
# ----------------------------------------------------------------------------
# make inner variables
.DEFAULT_GOAL := all
# custom variables
BUILD_NUMBER :=
BUILDS :=
CLEANS :=
# Build macro
define BUILD_SERIES
# output test number information
$(info Defining cmsis_example_$(1)_build and cmsis_example_$(1)_clean)
# add the incoming targets to global targets
BUILDS += cmsis_example_$(1)_build
CLEANS += cmsis_example_$(1)_clean
BUILD_NUMBER += x
.PHONY: cmsis_example_$(1)_build
cmsis_example_$(1)_build:
@echo ---
@echo ---
@echo --- Making $(1)
@echo ---
@$(MAKE) CHIP=$(1) -f cmsis_example.mk
.PHONY: cmsis_example_$(1)_clean
cmsis_example_$(1)_clean:
@echo ---
@echo ---
@echo --- Cleaning $(1)
@echo ---
@$(MAKE) CHIP=$(1) clean -f cmsis_example.mk
endef
# define SAM series
include sam_series.mk
$(foreach SERIES, $(SAM_SERIES), $(eval $(call BUILD_SERIES,$(SERIES))))
# output test number information
$(info Number of devices to be tested $(words $(BUILD_NUMBER)) / $(words $(SAM_SERIES)))
all: $(BUILDS)
clean: $(CLEANS)

View File

@@ -0,0 +1 @@
@cs-make --no-builtin-rules --no-builtin-variables >log.txt 2>&1

View File

@@ -0,0 +1 @@
@cs-make --no-builtin-rules --no-builtin-variables -d >log_debug.txt 2>&1

View File

@@ -0,0 +1,195 @@
# ----------------------------------------------------------------------------
# ATMEL Microcontroller Software Support
# ----------------------------------------------------------------------------
# Copyright (c) 2010, Atmel Corporation
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following condition is 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.
# ----------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# User-modifiable options
#-------------------------------------------------------------------------------
ifeq ('$(CHIP)','')
$(error CHIP not defined)
endif
include sam_series.mk
# fill the needed variables
ifeq ($(CHIP),$(findstring $(CHIP), $(SAM3N)))
BOARD:=SAM3N_EK
SERIES:=sam3n
else ifeq ($(CHIP),$(findstring $(CHIP), $(SAM3S)))
BOARD:=SAM3S_EK
SERIES:=sam3s
else ifeq ($(CHIP),$(findstring $(CHIP), $(SAM3SD8)))
BOARD:=SAM3S_EK2
SERIES:=sam3sd8
else ifeq ($(CHIP),$(findstring $(CHIP), $(SAM3U)))
BOARD:=SAM3U_EK
SERIES:=sam3u
else ifeq ($(CHIP),$(findstring $(CHIP), $(SAM3XA)))
BOARD:=SAM3X_EK
SERIES:=sam3xa
else ifeq ($(CHIP),$(findstring $(CHIP), $(SAM4S)))
BOARD:=SAM4S_EK
SERIES:=sam4s
endif
# Defines which are the available memory targets for the device.
MEMORIES = sram flash
# Optimization level, put in comment for debugging
OPTIMIZATION = -Os
# Output directories
BIN = $(CHIP)_bin
OBJ = $(CHIP)_obj
# Output file basename
OUTPUT_BIN = $(BIN)/cmsis_example_$(BOARD)_$(CHIP)
# GCC toolchain provider
GCC_TOOLCHAIN=gcc
#-------------------------------------------------------------------------------
# Tools
#-------------------------------------------------------------------------------
# Toolchain prefix when cross-compiling
CROSS_COMPILE = arm-none-eabi-
CMSIS_ROOT=../../..
CMSIS_PATH=$(CMSIS_ROOT)/CMSIS/Include
SAM_PATH=$(CMSIS_ROOT)/Device/ATMEL
DEVICE_PATH=$(SAM_PATH)/$(SERIES)/source
LIBS = -Wl,--start-group -lgcc -lc -Wl,--end-group
LIB_PATH+=-L=/lib/thumb2
LIB_PATH+=-L"$(realpath $(DEVICE_PATH)/$(GCC_TOOLCHAIN))"
# Compilation tools
CC = $(CROSS_COMPILE)gcc
LD = $(CROSS_COMPILE)ld
SIZE = $(CROSS_COMPILE)size
STRIP = $(CROSS_COMPILE)strip
OBJCOPY = $(CROSS_COMPILE)objcopy
GDB = $(CROSS_COMPILE)gdb
NM = $(CROSS_COMPILE)nm
RM = cs-rm
# Flags
INCLUDES := -I"$(CMSIS_PATH)"
INCLUDES += -I"$(SAM_PATH)"
INCLUDES += -I"$(SAM_PATH)/$(SERIES)/include"
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
# To reduce application size use only integer printf function.
CFLAGS += -Dprintf=iprintf
# -mlong-calls -Wall
CFLAGS += --param max-inline-insns-single=500 -mcpu=cortex-m3 -mthumb -ffunction-sections
CFLAGS += -g $(OPTIMIZATION) $(INCLUDES) -D__$(CHIP)__ -DBOARD=$(BOARD)
ASFLAGS = -mcpu=cortex-m3 -mthumb -Wall -g $(OPTIMIZATION) $(INCLUDES) -D__$(CHIP)__ -D__ASSEMBLY__
LDFLAGS= -mcpu=cortex-m3 -mthumb -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--entry=Reset_Handler -Wl,--defsym=STACK_SIZE=0x200 -Wl,--unresolved-symbols=report-all -Wl,--warn-common -Wl,--warn-section-align -Wl,--warn-unresolved-symbols
#LD_OPTIONAL=-Wl,--print-gc-sections -Wl,--stats
#-------------------------------------------------------------------------------
# Files
#-------------------------------------------------------------------------------
# Directories where source files can be found
VPATH += ..
VPATH += $(DEVICE_PATH)
VPATH += $(DEVICE_PATH)/$(GCC_TOOLCHAIN)
# Objects built from C source files
C_OBJECTS += main.o
C_OBJECTS += startup_$(SERIES).o
C_OBJECTS += system_$(SERIES).o
# Append OBJ and BIN directories to output filename
OUTPUT := $(BIN)/$(OUTPUT_BIN)
#-------------------------------------------------------------------------------
# Rules
#-------------------------------------------------------------------------------
all: $(BIN) $(OBJ) $(MEMORIES)
$(BIN) $(OBJ):
-@mkdir $@
define RULES
C_OBJECTS_$(1) = $(addprefix $(OBJ)/$(1)_, $(C_OBJECTS))
ASM_OBJECTS_$(1) = $(addprefix $(OBJ)/$(1)_, $(ASM_OBJECTS))
$(1): $$(ASM_OBJECTS_$(1)) $$(C_OBJECTS_$(1))
$(CC) $(LIB_PATH) $(LDFLAGS) $(LD_OPTIONAL) -T"$(realpath $(DEVICE_PATH)/$(GCC_TOOLCHAIN)/$(CHIP)_$$@.ld)" -Wl,-Map,"$(OUTPUT_BIN)_$$@.map" -o "$(OUTPUT_BIN)_$$@.elf" $$^ $(LIBS)
@$(NM) "$(OUTPUT_BIN)_$$@.elf" >"$(OUTPUT_BIN)_$$@.elf.txt"
@$(OBJCOPY) -O binary "$(OUTPUT_BIN)_$$@.elf" "$(OUTPUT_BIN)_$$@.bin"
@$(SIZE) $$^ "$(OUTPUT_BIN)_$$@.elf"
$$(C_OBJECTS_$(1)): $(OBJ)/$(1)_%.o: %.c Makefile $(OBJ) $(BIN)
@$(CC) $(CFLAGS) -D$(1) -c -o $$@ $$<
$$(ASM_OBJECTS_$(1)): $(OBJ)/$(1)_%.o: %.S Makefile $(OBJ) $(BIN)
@$(CC) $(ASFLAGS) -D$(1) -c -o $$@ $$<
debug_$(1): $(1)
$(GDB) -x "$(CHIP)_$(1).gdb" -ex "reset" -readnow -se "$(OUTPUT_BIN)_$(1).elf"
endef
$(foreach MEMORY, $(MEMORIES), $(eval $(call RULES,$(MEMORY))))
clean:
-$(RM) -fR $(OBJ) $(BIN)

View File

@@ -0,0 +1,35 @@
#*******************************************************
#
# Connect to J-Link and debug application in flash on SAM3N.
#
# Define 'reset' command
define reset
# Connect to the J-Link gdb server
target remote localhost:2331
# Reset the chip to get to a known state
monitor reset
# Select flash device
monitor flash device = AT91SAM3N4C
# Enable flash download and flash breakpoints
monitor flash download = 1
# Load the program
load
# Reset peripheral (RSTC_CR)
set *0x400e1400 = 0xA5000004
# Initialize PC and stack pointer
mon reg sp=(0x00400000)
#set *0x400004 = *0x400004 & 0xFFFFFFFE
mon reg pc=(0x00400004)
info reg
# End of 'reset' command
end

View File

@@ -0,0 +1,29 @@
#*******************************************************
#
# Connect to J-Link and debug application in sram on SAM3N.
#
# Define 'reset' command
define reset
# Connect to the J-Link gdb server
target remote localhost:2331
# Reset the chip to get to a known state
monitor reset
# Load the program
load
# Reset peripheral (RSTC_CR)
set *0x400e1400 = 0xA5000004
# Initialize PC and stack pointer
mon reg sp=(0x20000000)
#set *0x20000004 = *0x20000004 & 0xFFFFFFFE
mon reg pc=(0x20000004)
info reg
# End of 'reset' command
end

View File

@@ -0,0 +1,35 @@
#*******************************************************
#
# Connect to J-Link and debug application in flash on SAM3S.
#
# Define 'reset' command
define reset
# Connect to the J-Link gdb server
target remote localhost:2331
# Reset the chip to get to a known state
monitor reset
# Select flash device
monitor flash device = AT91SAM3S4C
# Enable flash download and flash breakpoints
monitor flash download = 1
# Load the program
load
# Reset peripheral (RSTC_CR)
set *0x400e1400 = 0xA5000004
# Initialize PC and stack pointer
mon reg sp=(0x400000)
#set *0x400004 = *0x400004 & 0xFFFFFFFE
mon reg pc=(0x400004)
info reg
# End of 'reset' command
end

View File

@@ -0,0 +1,29 @@
#*******************************************************
#
# Connect to J-Link and debug application in sram on SAM3S.
#
# Define 'reset' command
define reset
# Connect to the J-Link gdb server
target remote localhost:2331
# Reset the chip to get to a known state
monitor reset
# Load the program
load
# Reset peripheral (RSTC_CR)
set *0x400e1400 = 0xA5000004
# Initialize PC and stack pointer
mon reg sp=(0x20000000)
#set *0x20000004 = *0x20000004 & 0xFFFFFFFE
mon reg pc=(0x20000004)
info reg
# End of 'reset' command
end

View File

@@ -0,0 +1,35 @@
#*******************************************************
#
# Connect to J-Link and debug application in flash on SAM3S.
#
# Define 'reset' command
define reset
# Connect to the J-Link gdb server
target remote localhost:2331
# Reset the chip to get to a known state
monitor reset
# Select flash device
monitor flash device = AT91SAM3S4C
# Enable flash download and flash breakpoints
monitor flash download = 1
# Load the program
load
# Reset peripheral (RSTC_CR)
set *0x400e1400 = 0xA5000004
# Initialize PC and stack pointer
mon reg sp=(0x400000)
#set *0x400004 = *0x400004 & 0xFFFFFFFE
mon reg pc=(0x400004)
info reg
# End of 'reset' command
end

View File

@@ -0,0 +1,29 @@
#*******************************************************
#
# Connect to J-Link and debug application in sram on SAM3S.
#
# Define 'reset' command
define reset
# Connect to the J-Link gdb server
target remote localhost:2331
# Reset the chip to get to a known state
monitor reset
# Load the program
load
# Reset peripheral (RSTC_CR)
set *0x400e1400 = 0xA5000004
# Initialize PC and stack pointer
mon reg sp=(0x20000000)
#set *0x20000004 = *0x20000004 & 0xFFFFFFFE
mon reg pc=(0x20000004)
info reg
# End of 'reset' command
end

View File

@@ -0,0 +1,35 @@
#*******************************************************
#
# Connect to J-Link and debug application in flash on SAM3U.
#
# Define 'reset' command
define reset
# Connect to the J-Link gdb server
target remote localhost:2331
# Reset the chip to get to a known state
monitor reset
# Select flash device
monitor flash device = AT91SAM3U4E
# Enable flash download and flash breakpoints
monitor flash download = 1
# Load the program
load
# Reset peripheral (RSTC_CR)
set *0x400e1200 = 0xA5000004
# Initialize PC and stack pointer
mon reg sp=(0x80000)
#set *0x80004 = *0x80004 & 0xFFFFFFFE
mon reg pc=(0x80004)
info reg
# End of 'reset' command
end

View File

@@ -0,0 +1,29 @@
#*******************************************************
#
# Connect to J-Link and debug application in sram on SAM3U.
#
# Define 'reset' command
define reset
# Connect to the J-Link gdb server
target remote localhost:2331
# Reset the chip to get to a known state
monitor reset
# Load the program
load
# Reset peripheral (RSTC_CR)
set *0x400e1200 = 0xA5000004
# Initialize PC and stack pointer
mon reg sp=(0x20000000)
#set *0x20000004 = *0x20000004 & 0xFFFFFFFE
mon reg pc=(0x20000004)
info reg
# End of 'reset' command
end

View File

@@ -0,0 +1,35 @@
#*******************************************************
#
# Connect to J-Link and debug application in flash on SAM3X.
#
# Define 'reset' command
define reset
# Connect to the J-Link gdb server
target remote localhost:2331
# Reset the chip to get to a known state
monitor reset
# Select flash device
monitor flash device = AT91SAM3X8H
# Enable flash download and flash breakpoints
monitor flash download = 1
# Load the program
load
# Reset peripheral (RSTC_CR)
set *0x400e1a00 = 0xA5000004
# Initialize PC and stack pointer
mon reg sp=(0x80000)
#set *0x80004 = *0x80004 & 0xFFFFFFFE
mon reg pc=(0x80004)
info reg
# End of 'reset' command
end

View File

@@ -0,0 +1,29 @@
#*******************************************************
#
# Connect to J-Link and debug application in sram on SAM3X.
#
# Define 'reset' command
define reset
# Connect to the J-Link gdb server
target remote localhost:2331
# Reset the chip to get to a known state
monitor reset
# Load the program
load
# Reset peripheral (RSTC_CR)
set *0x400e1a00 = 0xA5000004
# Initialize PC and stack pointer
mon reg sp=(0x20000000)
#set *0x20000004 = *0x20000004 & 0xFFFFFFFE
mon reg pc=(0x20000004)
info reg
# End of 'reset' command
end

View File

@@ -0,0 +1,32 @@
#*******************************************************
#
# Connect to J-Link and debug application in flash.
#
# define 'reset' command
define reset
# Connect to the J-Link gdb server
target remote localhost:2331
# Reset the chip to get to a known state
monitor reset
# Select flash device (Should be AT91SAM4S16C, but it is not available now)
monitor flash device = AT91SAM4S16C
# Enable flash download and flash breakpoints
monitor flash download = 1
# Load the program
load
# Reset peripheral (RSTC_CR)
set *0x400e1400 = 0xA5000004
# Initializing PC and stack pointer
mon reg sp=(0x400000)
mon reg pc=(0x400004)
info reg
# end of 'reset' command
end

View File

@@ -0,0 +1,27 @@
#*************************************************
#
# Connect to J-Link and debug application in sram.
#
# define 'reset' command
define reset
# Connect to the J-Link gdb server
target remote localhost:2331
# Reset the chip to get to a known state
monitor reset
# Load the program
load
# Reset peripheral (RSTC_CR)
set *0x400e1400 = 0xA5000004
# Initializing PC and stack pointer
mon reg sp=(0x20000000)
mon reg pc=(0x20000004)
info reg
# end of 'reset' command
end

View File

@@ -0,0 +1,37 @@
# ----------------------------------------------------------------------------
# ATMEL Microcontroller Software Support
# ----------------------------------------------------------------------------
# Copyright (c) 2010, Atmel Corporation
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following condition is 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.
# ----------------------------------------------------------------------------
# define SAM series
SAM3N=SAM3N00A SAM3N00B SAM3N0A SAM3N0B SAM3N0C SAM3N1A SAM3N1B SAM3N1C SAM3N2A SAM3N2B SAM3N2C SAM3N4A SAM3N4B SAM3N4C
SAM3S=SAM3S1A SAM3S1B SAM3S1C SAM3S2A SAM3S2B SAM3S2C SAM3S4A SAM3S4B SAM3S4C
SAM3SD8=SAM3S8B SAM3S8C SAM3SD8B SAM3SD8C
SAM3U=SAM3U1C SAM3U1E SAM3U2C SAM3U2E SAM3U4C SAM3U4E
SAM3XA=SAM3A4C SAM3A8C SAM3X4C SAM3X4E SAM3X8C SAM3X8E SAM3X8H
SAM4S=SAM4S8B SAM4S8C SAM4S16B SAM4S16C
SAM_SERIES=$(SAM3N) $(SAM3S) $(SAM3SD8) $(SAM3U) $(SAM3XA) $(SAM4S)