mirror of
https://github.com/esp8266/Arduino.git
synced 2025-07-30 16:24:09 +03:00
[sam] introducing sam3u-ek and arduino due into variants, libsam is broken
This commit is contained in:
24
hardware/sam/variants/arduino_due/build_gcc/Makefile
Normal file
24
hardware/sam/variants/arduino_due/build_gcc/Makefile
Normal file
@ -0,0 +1,24 @@
|
||||
# Makefile for compiling libboard
|
||||
BOARD =
|
||||
|
||||
SUBMAKE_OPTIONS=--no-builtin-rules --no-builtin-variables
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Rules
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
all: arduino_due
|
||||
|
||||
.PHONY: arduino_due
|
||||
arduino_due:
|
||||
@echo --- Making arduino_due
|
||||
@$(MAKE) DEBUG=1 $(SUBMAKE_OPTIONS) -f libvariant_arduino_due.mk
|
||||
# @$(MAKE) $(SUBMAKE_OPTIONS) -f libvariant_arduino_due.mk
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
@echo --- Cleaning arduino_due
|
||||
@$(MAKE) DEBUG=1 $(SUBMAKE_OPTIONS) -f libvariant_arduino_due.mk $@
|
||||
# @$(MAKE) $(SUBMAKE_OPTIONS) -f libvariant_arduino_due.mk $@
|
||||
|
||||
|
7
hardware/sam/variants/arduino_due/build_gcc/debug.mk
Normal file
7
hardware/sam/variants/arduino_due/build_gcc/debug.mk
Normal file
@ -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
|
64
hardware/sam/variants/arduino_due/build_gcc/gcc.mk
Normal file
64
hardware/sam/variants/arduino_due/build_gcc/gcc.mk
Normal file
@ -0,0 +1,64 @@
|
||||
|
||||
# Tool suffix when cross-compiling
|
||||
#CROSS_COMPILE = ../../../../tools/CodeSourcery_arm/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
|
||||
#LD = $(CROSS_COMPILE)ld
|
||||
#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 += -Wmissing-noreturn
|
||||
#CFLAGS += -Wconversion
|
||||
|
||||
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
|
||||
#CPPFLAGS += -Wmissing-noreturn
|
||||
#CPPFLAGS += -Wconversion
|
||||
|
||||
CPPFLAGS += --param max-inline-insns-single=500 -mcpu=cortex-m3 -mthumb -mlong-calls -ffunction-sections -fno-rtti -fno-exceptions
|
||||
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)
|
@ -0,0 +1,156 @@
|
||||
# Makefile for compiling libArduino
|
||||
.SUFFIXES: .o .a .c .s
|
||||
|
||||
CHIP=__SAM3U4E__
|
||||
VARIANT=arduino_due
|
||||
LIBNAME=libvariant_$(VARIANT)
|
||||
TOOLCHAIN=gcc
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Path
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
# Output directories
|
||||
OUTPUT_BIN = ../../../cores/sam
|
||||
|
||||
# Libraries
|
||||
PROJECT_BASE_PATH = ..
|
||||
SYSTEM_PATH = ../../../system
|
||||
CMSIS_PATH = $(SYSTEM_PATH)/CMSIS/Include
|
||||
ARDUINO_PATH = ../../../cores/sam
|
||||
VARIANT_BASE_PATH = ../../../variants
|
||||
VARIANT_PATH = ../../../variants/$(VARIANT)
|
||||
VARIANT_COMMON_PATH = ../../common
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Files
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
vpath %.h $(PROJECT_BASE_PATH) $(SYSTEM_PATH) $(VARIANT_PATH) $(VARIANT_COMMON_PATH)
|
||||
#vpath %.c $(PROJECT_BASE_PATH) $(VARIANT_PATH)
|
||||
vpath %.cpp $(PROJECT_BASE_PATH) $(PROJECT_BASE_PATH) $(VARIANT_COMMON_PATH)
|
||||
|
||||
VPATH+=$(PROJECT_BASE_PATH)
|
||||
|
||||
INCLUDES =
|
||||
#INCLUDES += -I$(PROJECT_BASE_PATH)
|
||||
INCLUDES += -I$(ARDUINO_PATH)
|
||||
INCLUDES += -I$(SYSTEM_PATH)
|
||||
INCLUDES += -I$(SYSTEM_PATH)/libsam
|
||||
INCLUDES += -I$(VARIANT_BASE_PATH)
|
||||
INCLUDES += -I$(VARIANT_PATH)
|
||||
INCLUDES += -I$(CMSIS_PATH)
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
ifdef DEBUG
|
||||
include debug.mk
|
||||
else
|
||||
include release.mk
|
||||
endif
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Tools
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
include $(TOOLCHAIN).mk
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
ifdef DEBUG
|
||||
OUTPUT_OBJ=debug
|
||||
OUTPUT_LIB_POSTFIX=dbg
|
||||
else
|
||||
OUTPUT_OBJ=release
|
||||
OUTPUT_LIB_POSTFIX=rel
|
||||
endif
|
||||
|
||||
OUTPUT_LIB=$(LIBNAME)_$(TOOLCHAIN)_$(OUTPUT_LIB_POSTFIX).a
|
||||
OUTPUT_PATH=$(OUTPUT_OBJ)_$(VARIANT)
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# C source files and objects
|
||||
#-------------------------------------------------------------------------------
|
||||
C_SRC=$(wildcard $(PROJECT_BASE_PATH)/*.c)
|
||||
|
||||
C_OBJ_TEMP = $(patsubst %.c, %.o, $(notdir $(C_SRC)))
|
||||
|
||||
# during development, remove some files
|
||||
C_OBJ_FILTER=wiring_analog.o wiring_pulse.o
|
||||
|
||||
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 $(VARIANT_COMMON_PATH)/*.cpp)
|
||||
|
||||
CPP_OBJ_TEMP = $(patsubst %.cpp, %.o, $(notdir $(CPP_SRC)))
|
||||
|
||||
# during development, remove some files
|
||||
CPP_OBJ_FILTER=Tone.o
|
||||
|
||||
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 --- 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)/,$(C_OBJ)): $(OUTPUT_PATH)/%.o: %.c
|
||||
# @$(CC) -v -c $(CFLAGS) $< -o $@
|
||||
@$(CC) -c $(CFLAGS) $< -o $@
|
||||
|
||||
$(addprefix $(OUTPUT_PATH)/,$(CPP_OBJ)): $(OUTPUT_PATH)/%.o: %.cpp
|
||||
# @$(CC) -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))
|
||||
@$(AR) -v -r "$(OUTPUT_BIN)/$@" $^
|
||||
@$(NM) "$(OUTPUT_BIN)/$@" > "$(OUTPUT_BIN)/$@.txt"
|
||||
|
||||
|
||||
.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
|
8
hardware/sam/variants/arduino_due/build_gcc/release.mk
Normal file
8
hardware/sam/variants/arduino_due/build_gcc/release.mk
Normal file
@ -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
|
@ -0,0 +1,31 @@
|
||||
#*******************************************************
|
||||
#
|
||||
# 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
|
||||
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
|
||||
|
||||
# Initializing PC and stack pointer
|
||||
mon reg sp=(0x80000)
|
||||
set *0x80004 = *0x80004 & 0xFFFFFFFE
|
||||
mon reg pc=(0x80004)
|
||||
info reg
|
||||
|
||||
# end of 'reset' command
|
||||
end
|
@ -0,0 +1,23 @@
|
||||
#*************************************************
|
||||
#
|
||||
# Connect to J-Link and debug application in sram on SAM3U
|
||||
#
|
||||
# Note:
|
||||
# First,users should do Step1 and Step2 according to your project,
|
||||
# then do Step3.
|
||||
|
||||
# Step1: Connect to the J-Link gdb server
|
||||
#target remote localhost:2331
|
||||
#mon reset
|
||||
|
||||
# Step2: Load file(eg. getting-started project)
|
||||
#load bin/basic-dhrystone-project-at91sam3u-ek-at91sam3u4-sram.elf
|
||||
#symbol-file bin/basic-dhrystone-project-at91sam3u-ek-at91sam3u4-sram.elf
|
||||
|
||||
# Step3: Initializing PC and stack pointer
|
||||
# Perpheral reset RSTC_CR
|
||||
set *0x400e1200 = 0xA5000004
|
||||
# Modify pc value to even before writing pc register
|
||||
mon reg sp=(0x20000000)
|
||||
set *0x20000004 = *0x20000004 & 0xFFFFFFFE
|
||||
mon reg pc=(0x20000004)
|
@ -0,0 +1,44 @@
|
||||
// ---------------------------------------------------------
|
||||
// ATMEL Microcontroller Software Support - ROUSSET -
|
||||
// ---------------------------------------------------------
|
||||
// The software is delivered "AS IS" without warranty or
|
||||
// condition of any kind, either express, implied or
|
||||
// statutory. This includes without limitation any warranty
|
||||
// or condition with respect to merchantability or fitness
|
||||
// for any particular purpose, or against the infringements of
|
||||
// intellectual property rights of others.
|
||||
// ---------------------------------------------------------
|
||||
// File: at91sam3u-ek-flash.mac
|
||||
// User setup file for CSPY debugger.
|
||||
// ---------------------------------------------------------
|
||||
__var __mac_i;
|
||||
__var __mac_pt;
|
||||
|
||||
/*********************************************************************
|
||||
*
|
||||
* execUserReset()
|
||||
*/
|
||||
execUserReset()
|
||||
{
|
||||
__message "------------------------------ execUserReset ---------------------------------";
|
||||
__message "-------------------------------Set PC Reset ----------------------------------";
|
||||
|
||||
__hwReset(0);
|
||||
|
||||
// perpheral reset RSTC_CR
|
||||
__writeMemory32(0xA5000004,0x400e1200,"Memory");
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
*
|
||||
* execUserPreload()
|
||||
*/
|
||||
execUserPreload()
|
||||
{
|
||||
__message "------------------------------ execUserPreload ---------------------------------";
|
||||
|
||||
__hwReset(0); //* Hardware Reset: CPU is automatically halted after the reset
|
||||
|
||||
// perpheral reset RSTC_CR
|
||||
__writeMemory32(0xA5000004,0x400e1200,"Memory");
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
// ---------------------------------------------------------
|
||||
// ATMEL Microcontroller Software Support - ROUSSET -
|
||||
// ---------------------------------------------------------
|
||||
// The software is delivered "AS IS" without warranty or
|
||||
// condition of any kind, either express, implied or
|
||||
// statutory. This includes without limitation any warranty
|
||||
// or condition with respect to merchantability or fitness
|
||||
// for any particular purpose, or against the infringements of
|
||||
// intellectual property rights of others.
|
||||
// ---------------------------------------------------------
|
||||
// File: at91sam3u-ek-sram.mac
|
||||
// User setup file for CSPY debugger.
|
||||
// ---------------------------------------------------------
|
||||
__var __mac_i;
|
||||
__var __mac_pt;
|
||||
|
||||
/*********************************************************************
|
||||
*
|
||||
* execUserReset()
|
||||
*/
|
||||
execUserReset()
|
||||
{
|
||||
__message "------------------------------ execUserReset ---------------------------------";
|
||||
__message "-------------------------------Set PC Reset ----------------------------------";
|
||||
|
||||
//__hwReset(50);
|
||||
|
||||
// perpheral reset RSTC_CR
|
||||
__writeMemory32(0xA5000004,0x400e1200,"Memory");
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
*
|
||||
* execUserPreload()
|
||||
*/
|
||||
execUserPreload()
|
||||
{
|
||||
__message "------------------------------ execUserPreload ---------------------------------";
|
||||
|
||||
__hwReset(0); //* Hardware Reset: CPU is automatically halted after the reset
|
||||
|
||||
// perpheral reset RSTC_CR
|
||||
__writeMemory32(0xA5000004,0x400e1200,"Memory");
|
||||
}
|
144
hardware/sam/variants/arduino_due/linker_scripts/gcc/flash.ld
Normal file
144
hardware/sam/variants/arduino_due/linker_scripts/gcc/flash.ld
Normal file
@ -0,0 +1,144 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* ATMEL Microcontroller Software Support
|
||||
* ----------------------------------------------------------------------------
|
||||
* Copyright (c) 2009, 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.
|
||||
* ----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Linker script for running in internal FLASH on the SAM3U4
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
|
||||
OUTPUT_ARCH(arm)
|
||||
SEARCH_DIR(.)
|
||||
|
||||
/* Memory Spaces Definitions */
|
||||
MEMORY
|
||||
{
|
||||
flash0 (W!RX) : ORIGIN = 0x00080000, LENGTH = 0x00020000 /* Flash0, 128K */
|
||||
flash1 (W!RX) : ORIGIN = 0x00100000, LENGTH = 0x00020000 /* Flash1, 128K */
|
||||
sram0 (W!RX) : ORIGIN = 0x20000100, LENGTH = 0x00007F00 /* Sram0, 32K */
|
||||
sram1 (W!RX) : ORIGIN = 0x20080000, LENGTH = 0x00004000 /* Sram1, 16K */
|
||||
rom (rx) : ORIGIN = ORIGIN(flash1)-LENGTH(flash0), LENGTH = LENGTH(flash0)+LENGTH(flash1) /* Flash, 256K */
|
||||
ram (rwx) : ORIGIN = ORIGIN( sram1)-LENGTH( sram0), LENGTH = LENGTH( sram0)+LENGTH( sram1) /* sram, 64K */
|
||||
}
|
||||
|
||||
/* Section Definitions */
|
||||
SECTIONS
|
||||
{
|
||||
.text :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
_sfixed = .;
|
||||
KEEP(*(.vectors .vectors.*))
|
||||
*(.text .text.* .gnu.linkonce.t.*)
|
||||
*(.glue_7t) *(.glue_7)
|
||||
*(.rodata .rodata* .gnu.linkonce.r.*)
|
||||
*(.ARM.extab* .gnu.linkonce.armextab.*)
|
||||
|
||||
/* Support C constructors, and C destructors in both user code
|
||||
and the C library. This also provides support for C++ code. */
|
||||
. = ALIGN(4);
|
||||
KEEP(*(.init))
|
||||
. = ALIGN(4);
|
||||
__preinit_array_start = .;
|
||||
KEEP (*(.preinit_array))
|
||||
__preinit_array_end = .;
|
||||
|
||||
. = ALIGN(4);
|
||||
__init_array_start = .;
|
||||
KEEP (*(SORT(.init_array.*)))
|
||||
KEEP (*(.init_array))
|
||||
__init_array_end = .;
|
||||
|
||||
. = ALIGN(0x4);
|
||||
KEEP (*crtbegin.o(.ctors))
|
||||
KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
|
||||
KEEP (*(SORT(.ctors.*)))
|
||||
KEEP (*crtend.o(.ctors))
|
||||
|
||||
. = ALIGN(4);
|
||||
KEEP(*(.fini))
|
||||
|
||||
. = ALIGN(4);
|
||||
__fini_array_start = .;
|
||||
KEEP (*(.fini_array))
|
||||
KEEP (*(SORT(.fini_array.*)))
|
||||
__fini_array_end = .;
|
||||
|
||||
KEEP (*crtbegin.o(.dtors))
|
||||
KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
|
||||
KEEP (*(SORT(.dtors.*)))
|
||||
KEEP (*crtend.o(.dtors))
|
||||
|
||||
. = ALIGN(4);
|
||||
_efixed = .; /* End of text section */
|
||||
} > flash0
|
||||
|
||||
/* .ARM.exidx is sorted, so has to go in its own output section. */
|
||||
PROVIDE_HIDDEN (__exidx_start = .);
|
||||
.ARM.exidx :
|
||||
{
|
||||
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
|
||||
} > flash0
|
||||
PROVIDE_HIDDEN (__exidx_end = .);
|
||||
|
||||
. = ALIGN(4);
|
||||
_etext = .;
|
||||
|
||||
.relocate : AT (_etext)
|
||||
{
|
||||
. = ALIGN(4);
|
||||
_srelocate = .;
|
||||
*(.ramfunc .ramfunc.*);
|
||||
*(.data .data.*);
|
||||
. = ALIGN(4);
|
||||
_erelocate = .;
|
||||
} > sram0
|
||||
|
||||
/* .bss section which is used for uninitialized data */
|
||||
.bss (NOLOAD) :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
_sbss = . ;
|
||||
_szero = .;
|
||||
*(.bss .bss.*)
|
||||
*(COMMON)
|
||||
. = ALIGN(4);
|
||||
_ebss = . ;
|
||||
_ezero = .;
|
||||
} > sram0
|
||||
|
||||
/* stack section */
|
||||
.stack (NOLOAD):
|
||||
{
|
||||
. = ALIGN(8);
|
||||
*(.stack .stack.*)
|
||||
} > sram1
|
||||
|
||||
. = ALIGN(4);
|
||||
_end = . ;
|
||||
}
|
144
hardware/sam/variants/arduino_due/linker_scripts/gcc/sram.ld
Normal file
144
hardware/sam/variants/arduino_due/linker_scripts/gcc/sram.ld
Normal file
@ -0,0 +1,144 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* ATMEL Microcontroller Software Support
|
||||
* ----------------------------------------------------------------------------
|
||||
* Copyright (c) 2009, 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.
|
||||
* ----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Linker script for running in internal SRAM on the SAM3U4
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
|
||||
OUTPUT_ARCH(arm)
|
||||
SEARCH_DIR(.)
|
||||
|
||||
/* Memory Spaces Definitions */
|
||||
MEMORY
|
||||
{
|
||||
flash0 (W!RX) : ORIGIN = 0x00080000, LENGTH = 0x00020000 /* Flash0, 128K */
|
||||
flash1 (W!RX) : ORIGIN = 0x00100000, LENGTH = 0x00020000 /* Flash1, 128K */
|
||||
sram0 (W!RX) : ORIGIN = 0x20000100, LENGTH = 0x00007F00 /* Sram0, 32K */
|
||||
sram1 (W!RX) : ORIGIN = 0x20080000, LENGTH = 0x00004000 /* Sram1, 16K */
|
||||
rom (rx) : ORIGIN = ORIGIN(flash1)-LENGTH(flash0), LENGTH = LENGTH(flash0)+LENGTH(flash1) /* Flash, 256K */
|
||||
ram (rwx) : ORIGIN = ORIGIN( sram1)-LENGTH( sram0), LENGTH = LENGTH( sram0)+LENGTH( sram1) /* sram, 64K */
|
||||
}
|
||||
|
||||
/* Section Definitions */
|
||||
SECTIONS
|
||||
{
|
||||
.text :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
_sfixed = .;
|
||||
KEEP(*(.vectors .vectors.*))
|
||||
*(.text .text.* .gnu.linkonce.t.*)
|
||||
*(.glue_7t) *(.glue_7)
|
||||
*(.rodata .rodata* .gnu.linkonce.r.*)
|
||||
*(.ARM.extab* .gnu.linkonce.armextab.*)
|
||||
|
||||
/* Support C constructors, and C destructors in both user code
|
||||
and the C library. This also provides support for C++ code. */
|
||||
. = ALIGN(4);
|
||||
KEEP(*(.init))
|
||||
. = ALIGN(4);
|
||||
__preinit_array_start = .;
|
||||
KEEP (*(.preinit_array))
|
||||
__preinit_array_end = .;
|
||||
|
||||
. = ALIGN(4);
|
||||
__init_array_start = .;
|
||||
KEEP (*(SORT(.init_array.*)))
|
||||
KEEP (*(.init_array))
|
||||
__init_array_end = .;
|
||||
|
||||
. = ALIGN(0x4);
|
||||
KEEP (*crtbegin.o(.ctors))
|
||||
KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
|
||||
KEEP (*(SORT(.ctors.*)))
|
||||
KEEP (*crtend.o(.ctors))
|
||||
|
||||
. = ALIGN(4);
|
||||
KEEP(*(.fini))
|
||||
|
||||
. = ALIGN(4);
|
||||
__fini_array_start = .;
|
||||
KEEP (*(.fini_array))
|
||||
KEEP (*(SORT(.fini_array.*)))
|
||||
__fini_array_end = .;
|
||||
|
||||
KEEP (*crtbegin.o(.dtors))
|
||||
KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
|
||||
KEEP (*(SORT(.dtors.*)))
|
||||
KEEP (*crtend.o(.dtors))
|
||||
|
||||
. = ALIGN(4);
|
||||
_efixed = .; /* End of text section */
|
||||
} > sram0
|
||||
|
||||
. = ALIGN(4);
|
||||
_etext = .;
|
||||
|
||||
.relocate : AT (_etext)
|
||||
{
|
||||
. = ALIGN(4);
|
||||
_srelocate = .;
|
||||
*(.ramfunc .ramfunc.*);
|
||||
*(.data .data.*);
|
||||
. = ALIGN(4);
|
||||
_erelocate = .;
|
||||
} > sram1
|
||||
|
||||
/* .bss section which is used for uninitialized data */
|
||||
.bss (NOLOAD) :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
_sbss = . ;
|
||||
_szero = .;
|
||||
*(.bss .bss.*)
|
||||
*(COMMON)
|
||||
. = ALIGN(4);
|
||||
_ebss = . ;
|
||||
_ezero = .;
|
||||
} > sram1
|
||||
|
||||
/* stack section */
|
||||
.stack (NOLOAD):
|
||||
{
|
||||
. = ALIGN(8);
|
||||
*(.stack .stack.*)
|
||||
} > sram1
|
||||
|
||||
/* .ARM.exidx is sorted, so has to go in its own output section. */
|
||||
PROVIDE_HIDDEN (__exidx_start = .);
|
||||
.ARM.exidx :
|
||||
{
|
||||
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
|
||||
} > sram1
|
||||
PROVIDE_HIDDEN (__exidx_end = .);
|
||||
|
||||
. = ALIGN(4);
|
||||
_end = . ;
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
/*###ICF### Section handled by ICF editor, don't touch! ****/
|
||||
/*-Editor annotation file-*/
|
||||
/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\a_v1_0.xml" */
|
||||
/*-Vector table start*/
|
||||
define symbol __ICFEDIT_vector_start__ = 0x00080000; /*Add for CMSIS*/
|
||||
/*-Memory Regions-*/
|
||||
define symbol __ICFEDIT_region_RAM0_start__ = 0x20000000;
|
||||
define symbol __ICFEDIT_region_RAM0_end__ = 0x20007FFF;
|
||||
define symbol __ICFEDIT_region_RAM1_start__ = 0x20080000;
|
||||
define symbol __ICFEDIT_region_RAM1_end__ = 0x20083FFF;
|
||||
define symbol __ICFEDIT_region_ROM0_start__ = 0x00080000;
|
||||
define symbol __ICFEDIT_region_ROM0_end__ = 0x0009FFFF;
|
||||
define symbol __ICFEDIT_region_ROM1_start__ = 0x00100000;
|
||||
define symbol __ICFEDIT_region_ROM1_end__ = 0x0011FFFF;
|
||||
/*-Sizes-*/
|
||||
/*define symbol __ICFEDIT_size_cstack__ = 0x1000;*//*for nandflash*/
|
||||
define symbol __ICFEDIT_size_cstack__ = 0x2000;
|
||||
define symbol __ICFEDIT_size_heap__ = 0x200;
|
||||
/*-Specials-*/
|
||||
/*define symbol __ICFEDIT_region_RAM_VECT_start__ = __ICFEDIT_region_RAM0_start__;*/ /*Referenced for CMSIS*/
|
||||
/*define symbol __ICFEDIT_size_vectors__ = 0x100;*/ /*Referenced for CMSIS*/
|
||||
/*-Exports-*/
|
||||
/*export symbol __ICFEDIT_region_RAM_VECT_start__;*/
|
||||
export symbol __ICFEDIT_vector_start__; /*Add for CMSIS*/
|
||||
/**** End of ICF editor section. ###ICF###*/
|
||||
|
||||
define memory mem with size = 4G;
|
||||
/*define region RAM_VECT_region = mem:[from __ICFEDIT_region_RAM_VECT_start__ size __ICFEDIT_size_vectors__];*/ /*Referenced for CMSIS*/
|
||||
/*define region RAM0_region = mem:[from __ICFEDIT_region_RAM0_start__+__ICFEDIT_size_vectors__ to __ICFEDIT_region_RAM0_end__];*/ /*Referenced for CMSIS*/
|
||||
define region RAM0_region = mem:[from __ICFEDIT_region_RAM0_start__ to __ICFEDIT_region_RAM0_end__];
|
||||
define region RAM1_region = mem:[from __ICFEDIT_region_RAM1_start__ to __ICFEDIT_region_RAM1_end__];
|
||||
/*define region RAM_region = mem:[from __ICFEDIT_region_RAM0_start__+__ICFEDIT_size_vectors__ to __ICFEDIT_region_RAM0_end__] |
|
||||
mem:[from __ICFEDIT_region_RAM1_start__ to __ICFEDIT_region_RAM1_end__];*/ /*Referenced for CMSIS*/
|
||||
define region ROM0_region = mem:[from __ICFEDIT_region_ROM0_start__ to __ICFEDIT_region_ROM0_end__];
|
||||
define region ROM1_region = mem:[from __ICFEDIT_region_ROM1_start__ to __ICFEDIT_region_ROM1_end__];
|
||||
|
||||
/*define block RamVect with alignment = 8, size = __ICFEDIT_size_vectors__ { };*/
|
||||
define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
|
||||
define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { };
|
||||
|
||||
initialize by copy { readwrite };
|
||||
do not initialize { section .noinit };
|
||||
|
||||
/*place at start of ROM0_region { readonly section .vectors };*/ /*Referenced for CMSIS*/
|
||||
place at address mem:__ICFEDIT_vector_start__ { readonly section .intvec }; /*Add for CMSIS*/
|
||||
place in ROM0_region { readonly };
|
||||
place in RAM0_region { readwrite, block HEAP };
|
||||
place in RAM1_region { block CSTACK }; /* for nandflash*/
|
||||
/*place in RAM_VECT_region { block RamVect };*/ /*Referenced for CMSIS*/
|
@ -0,0 +1,33 @@
|
||||
/*###ICF### Section handled by ICF editor, don't touch! ****/
|
||||
/*-Editor annotation file-*/
|
||||
/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\a_v1_0.xml" */
|
||||
/*-Vector table start*/
|
||||
define symbol __ICFEDIT_vector_start__ = 0x20000000;
|
||||
/*-Memory Regions-*/
|
||||
define symbol __ICFEDIT_region_RAM0_start__ = 0x20000000;
|
||||
define symbol __ICFEDIT_region_RAM0_end__ = 0x20007FFF;
|
||||
define symbol __ICFEDIT_region_RAM1_start__ = 0x20080000;
|
||||
define symbol __ICFEDIT_region_RAM1_end__ = 0x20083FFF;
|
||||
/*-Sizes-*/
|
||||
define symbol __ICFEDIT_size_cstack__ = 0x900;
|
||||
define symbol __ICFEDIT_size_heap__ = 0x200;
|
||||
/*-Exports-*/
|
||||
export symbol __ICFEDIT_vector_start__;
|
||||
/**** End of ICF editor section. ###ICF###*/
|
||||
|
||||
define memory mem with size = 4G;
|
||||
define region RAM0_region = mem:[from __ICFEDIT_region_RAM0_start__ to __ICFEDIT_region_RAM0_end__];
|
||||
define region RAM1_region = mem:[from __ICFEDIT_region_RAM1_start__ to __ICFEDIT_region_RAM1_end__];
|
||||
/*define region RAM_region = mem:[from __ICFEDIT_region_RAM0_start__+__ICFEDIT_size_vectors__ to __ICFEDIT_region_RAM0_end__] |
|
||||
mem:[from __ICFEDIT_region_RAM1_start__ to __ICFEDIT_region_RAM1_end__];*/
|
||||
|
||||
/* define block RamVect with alignment = 8, size = __ICFEDIT_size_vectors__ { }; */
|
||||
define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
|
||||
define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { };
|
||||
|
||||
initialize by copy { readwrite };
|
||||
do not initialize { section .noinit };
|
||||
|
||||
place at address mem:__ICFEDIT_vector_start__ { readonly section .intvec };
|
||||
place in RAM0_region { readonly };
|
||||
place in RAM1_region { readwrite, block CSTACK, block HEAP };
|
Reference in New Issue
Block a user