1
0
Fork 0
forked from nuttx/nuttx-update

boards/arm/samv7: Introduce common folder

This introduce common folder structre and rework scripts & tools
files. The linker scripts were reorganized to use best the current
infrastructure which uses a template to create a final samv7.ld
file based in the current SoC memories and bootloader definitions.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
This commit is contained in:
Gerson Fernando Budke 2021-12-11 20:51:31 -03:00 committed by Alan Carvalho de Assis
parent 463fbfe975
commit b5868aed6f
50 changed files with 367 additions and 1536 deletions

View file

@ -3326,6 +3326,9 @@ endif
comment "Board-Common Options" comment "Board-Common Options"
if ARCH_CHIP_SAMV7
source "boards/arm/samv7/common/Kconfig"
endif
if ARCH_CHIP_STM32 if ARCH_CHIP_STM32
source "boards/arm/stm32/common/Kconfig" source "boards/arm/stm32/common/Kconfig"
endif endif

View file

@ -0,0 +1,84 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfiglanguage.txt in the NuttX tools repository.
#
config BOARD_SAMV7_COMMON
bool "Board common logic"
default y
---help---
Board common logic located in each board/common folder.
if BOARD_SAMV7_COMMON
config SAMV7_PROGMEM_OTA_PARTITION
bool
default n
select ARCH_RAMFUNCS
select BCH
select MTD
select MTD_BYTE_WRITE
select MTD_PARTITION
select MTD_PROGMEM
select MTD_PROGMEM_ERASESTATE
select SAMV7_PROGMEM
select SAMV7_PROGMEM_ERASESTATE
config SAMV7_MCUBOOT_HEADER_SIZE
hex
default 0x200
depends on SAMV7_FORMAT_MCUBOOT
menuconfig SAMV7_FORMAT_MCUBOOT
bool "MCUboot bootable format"
default n
select SAMV7_PROGMEM_OTA_PARTITION
---help---
The MCUboot support of loading the firmware images.
if SAMV7_FORMAT_MCUBOOT
comment "MCUboot Application Image OTA Update support"
config SAMV7_OTA_PRIMARY_SLOT_OFFSET
hex "MCUboot application image primary slot offset"
default 0x20000
config SAMV7_OTA_PRIMARY_SLOT_DEVPATH
string "Application image primary slot device path"
default "/dev/ota0"
config SAMV7_OTA_SECONDARY_SLOT_OFFSET
hex "MCUboot application image secondary slot offset"
default 0x48000 if SAMV7_MEM_FLASH_512
default 0x80000 if SAMV7_MEM_FLASH_1024
default 0x100000 if SAMV7_MEM_FLASH_2048
config SAMV7_OTA_SECONDARY_SLOT_DEVPATH
string "Application image secondary slot device path"
default "/dev/ota1"
config SAMV7_OTA_SLOT_SIZE
hex "MCUboot application image slot size (in bytes)"
default 0x28000 if SAMV7_MEM_FLASH_512
default 0x60000 if SAMV7_MEM_FLASH_1024
default 0xe0000 if SAMV7_MEM_FLASH_2048
config SAMV7_OTA_SCRATCH_OFFSET
hex "MCUboot scratch partition offset"
default 0x70000 if SAMV7_MEM_FLASH_512
default 0xe0000 if SAMV7_MEM_FLASH_1024
default 0x1e0000 if SAMV7_MEM_FLASH_2048
config SAMV7_OTA_SCRATCH_DEVPATH
string "Scratch partition device path"
default "/dev/otascratch"
config SAMV7_OTA_SCRATCH_SIZE
hex "MCUboot scratch partition size (in bytes)"
default 0x10000 if SAMV7_MEM_FLASH_512
default 0x20000
endif # SAMV7_FORMAT_MCUBOOT
endif # BOARD_SAMV7_COMMON

View file

@ -0,0 +1,33 @@
#############################################################################
# boards/arm/samv7/common/Makefile
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership. The
# ASF licenses this file to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance with the
# License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
#############################################################################
include $(TOPDIR)/Make.defs
include board/Make.defs
include src/Make.defs
DEPPATH += --dep-path board
DEPPATH += --dep-path src
include $(TOPDIR)/boards/Board.mk
ARCHSRCDIR = $(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src
BOARDDIR = $(ARCHSRCDIR)$(DELIM)board
CFLAGS += $(shell $(INCDIR) "$(CC)" $(BOARDDIR)$(DELIM)include)

View file

@ -0,0 +1,71 @@
############################################################################
# boards/arm/samv7/common/scripts/Make.defs
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership. The
# ASF licenses this file to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance with the
# License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
############################################################################
ifneq ($(wildcard $(BOARD_DIR)$(DELIM)scripts$(DELIM)flat-template.ld),)
LDSCRIPT_TEMPLATE = $(BOARD_DIR)$(DELIM)scripts$(DELIM)flat-template.ld
else
LDSCRIPT_TEMPLATE = $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)flat-template.ld
endif
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
ARCHOPTIMIZATION = -g
endif
ifneq ($(CONFIG_DEBUG_NOOPT),y)
ARCHOPTIMIZATION += $(MAXOPTIMIZATION)
endif
ARCHCFLAGS = -fno-builtin
ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fcheck-new -fno-rtti
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef -fno-strict-aliasing
ARCHWARNINGSXX = -Wall -Wshadow -Wundef
ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
CFLAGS := $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe
CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
CXXFLAGS := $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe
CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
CPPFLAGS := $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS)
AFLAGS := $(CFLAGS) -D__ASSEMBLY__
NXFLATLDFLAGS1 = -r -d -warn-common
NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat-pcrel.ld -no-check-sections
LDNXFLATFLAGS = -e main -s 2048
# Loadable module definitions
CMODULEFLAGS = $(CFLAGS) -mlong-calls # --target1-abs
LDMODULEFLAGS = -r -e module_initialize
ifeq ($(CONFIG_CYGWIN_WINTOOL),y)
LDMODULEFLAGS += -T "${shell cygpath -w $(TOPDIR)/libs/libc/modlib/gnu-elf.ld}"
else
LDMODULEFLAGS += -T $(TOPDIR)/libs/libc/modlib/gnu-elf.ld
endif
ifeq ($(CONFIG_CYGWIN_WINTOOL),y)
LDFLAGS += -Map="${shell cygpath -w $(TOPDIR)/nuttx.map}" --cref
else
LDFLAGS += -Map=$(TOPDIR)/nuttx.map --cref
endif
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
LDFLAGS += -g
endif

View file

@ -1,5 +1,5 @@
/**************************************************************************** /****************************************************************************
* boards/arm/samv7/same70-qmtech/scripts/flash.template.ld * boards/arm/samv7/common/scripts/flat-template.ld
* *
* Licensed to the Apache Software Foundation (ASF) under one or more * Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with * contributor license agreements. See the NOTICE file distributed with
@ -28,14 +28,14 @@
# define SRAM_START_ADDR 0x20400000 # define SRAM_START_ADDR 0x20400000
#endif #endif
#ifdef CONFIG_SAME70QMTECH_FORMAT_MCUBOOT #ifdef CONFIG_SAMV7_FORMAT_MCUBOOT
# define MCUBOOT_HEADER_SIZE 0x200 # define MCUBOOT_HEADER_SIZE CONFIG_SAMV7_MCUBOOT_HEADER_SIZE
# ifdef CONFIG_BOARDCTL_BOOT_IMAGE # ifdef CONFIG_BOARDCTL_BOOT_IMAGE
# define FLASH_OFFSET 0 # define FLASH_OFFSET 0
# define FLASH_IMG_SIZE CONFIG_SAME70QMTECH_OTA_PRIMARY_SLOT_OFFSET # define FLASH_IMG_SIZE CONFIG_SAMV7_OTA_PRIMARY_SLOT_OFFSET
# else # else
# define FLASH_OFFSET (CONFIG_SAME70QMTECH_OTA_PRIMARY_SLOT_OFFSET + MCUBOOT_HEADER_SIZE) # define FLASH_OFFSET (CONFIG_SAMV7_OTA_PRIMARY_SLOT_OFFSET + MCUBOOT_HEADER_SIZE)
# define FLASH_IMG_SIZE (CONFIG_SAME70QMTECH_OTA_SLOT_SIZE - MCUBOOT_HEADER_SIZE) # define FLASH_IMG_SIZE (CONFIG_SAMV7_OTA_SLOT_SIZE - MCUBOOT_HEADER_SIZE)
# endif # endif
#else #else
# define FLASH_OFFSET 0 # define FLASH_OFFSET 0

View file

@ -0,0 +1,31 @@
############################################################################
# boards/arm/samv7/common/scripts/flat.memory
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership. The
# ASF licenses this file to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance with the
# License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
############################################################################
include $(TOPDIR)/.config
include $(TOPDIR)/tools/Config.mk
include $(TOPDIR)/arch/arm/src/armv7-m/Toolchain.defs
ifeq ($(CONFIG_CYGWIN_WINTOOL),y)
ARCHSCRIPT = -T "${shell cygpath -w $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)samv7.ld}"
else
ARCHSCRIPT = -T$(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)samv7.ld
endif
include $(BOARD_COMMON_DIR)/scripts/Make.defs

View file

@ -1,5 +1,5 @@
/**************************************************************************** /****************************************************************************
* boards/arm/samv7/samv71-xult/scripts/gnu-elf.ld * boards/arm/samv7/common/scripts/gnu-elf.ld
* *
* Licensed to the Apache Software Foundation (ASF) under one or more * Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with * contributor license agreements. See the NOTICE file distributed with

View file

@ -1,5 +1,5 @@
/**************************************************************************** /****************************************************************************
* boards/arm/samv7/samv71-xult/scripts/kernel-space.ld * boards/arm/samv7/common/scripts/kernel-space.ld
* *
* Licensed to the Apache Software Foundation (ASF) under one or more * Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with * contributor license agreements. See the NOTICE file distributed with

View file

@ -1,5 +1,5 @@
/**************************************************************************** /****************************************************************************
* boards/arm/samv7/samv71-xult/scripts/memory.ld * boards/arm/samv7/common/scripts/memory.ld
* *
* Licensed to the Apache Software Foundation (ASF) under one or more * Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with * contributor license agreements. See the NOTICE file distributed with
@ -18,8 +18,8 @@
* *
****************************************************************************/ ****************************************************************************/
/* The SAMV71Q21 has 2048Kb of FLASH beginning at address 0x0040:0000 and /* The SAMV7 can have up to 2048Kb of FLASH beginning at address 0x0040:0000
* 384Kb of SRAM beginining at 0x2040:0000 * and 384Kb of SRAM beginining at 0x2040:0000
* *
* When booting from FLASH, FLASH memory is aliased to address 0x0000:0000 * When booting from FLASH, FLASH memory is aliased to address 0x0000:0000
* where the code expects to begin execution by jumping to the entry point in * where the code expects to begin execution by jumping to the entry point in

View file

@ -0,0 +1,36 @@
############################################################################
# boards/arm/samv7/common/scripts/protected.memory
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership. The
# ASF licenses this file to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance with the
# License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
############################################################################
include $(TOPDIR)/.config
include $(TOPDIR)/tools/Config.mk
include $(TOPDIR)/arch/arm/src/armv7-m/Toolchain.defs
LDSCRIPT1 = memory.ld
LDSCRIPT2 = kernel-space.ld
ifeq ($(CONFIG_CYGWIN_WINTOOL),y)
ARCHSCRIPT = -T "${shell cygpath -w $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)$(LDSCRIPT1)}"
ARCHSCRIPT += -T "${shell cygpath -w $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)$(LDSCRIPT2)}"
else
ARCHSCRIPT = -T$(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)$(LDSCRIPT1)
ARCHSCRIPT += -T$(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)$(LDSCRIPT2)
endif
include $(BOARD_COMMON_DIR)/scripts/Make.defs

View file

@ -1,5 +1,5 @@
/**************************************************************************** /****************************************************************************
* boards/arm/samv7/samv71-xult/scripts/user-space.ld * boards/arm/samv7/common/scripts/user-space.ld
* *
* Licensed to the Apache Software Foundation (ASF) under one or more * Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with * contributor license agreements. See the NOTICE file distributed with

View file

@ -0,0 +1,23 @@
#############################################################################
# boards/arm/samv7/common/src/Make.defs
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership. The
# ASF licenses this file to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance with the
# License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
#############################################################################
DEPPATH += --dep-path src
VPATH += :src
CFLAGS += $(shell $(INCDIR) "$(CC)" $(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)src)

View file

@ -3,7 +3,6 @@
# https://github.com/ChinaQMTECH/ATSAMS70_E70 # https://github.com/ChinaQMTECH/ATSAMS70_E70
# #
# Connect using the EDBG chip on the dev kit over USB # Connect using the EDBG chip on the dev kit over USB
source [find interface/cmsis-dap.cfg] source [find interface/cmsis-dap.cfg]
set CHIPNAME atsame70n19 set CHIPNAME atsame70n19

View file

@ -1,11 +1,11 @@
# #
# Atmel SAME70 QMTECH board. # Atmel SAMV71 Xplained Ultra evaluation kit.
# https://github.com/ChinaQMTECH/ATSAMS70_E70 # http://www.atmel.com/tools/ATSAMV71-XULT.aspx
# #
# Connect using the EDBG chip on the dev kit over USB # Connect using the EDBG chip on the dev kit over USB
source [find interface/cmsis-dap.cfg] source [find interface/cmsis-dap.cfg]
set CHIPNAME atsame70n19 set CHIPNAME atsamv71q21
source [find target/atsamv.cfg] source [find target/atsamv.cfg]

View file

@ -1,7 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# #
# See boards/atmel_same70_qmtech.cfg/README.txt for information about # See boards README.txt for information about this file.
# this file.
TOPDIR=$1 TOPDIR=$1
USAGE="$0 <TOPDIR> [-d]" USAGE="$0 <TOPDIR> [-d]"
@ -28,7 +27,7 @@ TARGET_PATH="/usr/local/share/openocd/scripts"
#OPENOCD_EXE=openocd.exe #OPENOCD_EXE=openocd.exe
OPENOCD_EXE=openocd OPENOCD_EXE=openocd
OPENOCD_CFG="${TOPDIR}/boards/arm/samv7/same70-qmtech/tools/atmel_same70_qmtech.cfg" OPENOCD_CFG="${TOPDIR}/boards/arm/samv7/common/tools/atmel-${TARGET_BOARD}.cfg"
OPENOCD_ARGS="-f ${OPENOCD_CFG} -s ${TARGET_PATH}" OPENOCD_ARGS="-f ${OPENOCD_CFG} -s ${TARGET_PATH}"
if [ "X$2" = "X-d" ]; then if [ "X$2" = "X-d" ]; then

View file

@ -34,65 +34,4 @@ config SAME70QMTECH_HSMCI0_AUTOMOUNT_UDELAY
endif # SAME70QMTECH_HSMCI0_AUTOMOUNT endif # SAME70QMTECH_HSMCI0_AUTOMOUNT
config SAME70QMTECH_PROGMEM_OTA_PARTITION
bool
default n
select MTD
select MTD_BYTE_WRITE
select MTD_PARTITION
select MTD_PROGMEM
select MTD_PROGMEM_ERASESTATE
menuconfig SAME70QMTECH_FORMAT_MCUBOOT
bool "MCUboot-bootable format"
default n
select SAME70QMTECH_PROGMEM_OTA_PARTITION
---help---
The MCUboot support of loading the firmware images.
if SAME70QMTECH_FORMAT_MCUBOOT
config SAME70QMTECH_MCUBOOT_BOOTLOADER
bool "MCUboot bootloader application"
default n
---help---
This switch between linker scripts to allow an application be
built to another entry point address.
comment "MCUboot Application Image OTA Update support"
config SAME70QMTECH_OTA_PRIMARY_SLOT_OFFSET
hex "MCUboot application image primary slot offset"
default "0x20000"
config SAME70QMTECH_OTA_PRIMARY_SLOT_DEVPATH
string "Application image primary slot device path"
default "/dev/ota0"
config SAME70QMTECH_OTA_SECONDARY_SLOT_OFFSET
hex "MCUboot application image secondary slot offset"
default "0x48000"
config SAME70QMTECH_OTA_SECONDARY_SLOT_DEVPATH
string "Application image secondary slot device path"
default "/dev/ota1"
config SAME70QMTECH_OTA_SLOT_SIZE
hex "MCUboot application image slot size (in bytes)"
default "0x28000"
config SAME70QMTECH_OTA_SCRATCH_OFFSET
hex "MCUboot scratch partition offset"
default "0x70000"
config SAME70QMTECH_OTA_SCRATCH_DEVPATH
string "Scratch partition device path"
default "/dev/otascratch"
config SAME70QMTECH_OTA_SCRATCH_SIZE
hex "MCUboot scratch partition size (in bytes)"
default "0x10000"
endif # SAME70QMTECH_FORMAT_MCUBOOT
endif # ARCH_BOARD_SAME70_QMTECH endif # ARCH_BOARD_SAME70_QMTECH

View file

@ -794,8 +794,7 @@ Configuration sub-directories
CONFIG_MCUBOOT_BOOTLOADER=y CONFIG_MCUBOOT_BOOTLOADER=y
CONFIG_MCUBOOT_ENABLE_LOGGING=y CONFIG_MCUBOOT_ENABLE_LOGGING=y
CONFIG_SAME70QMTECH_FORMAT_MCUBOOT=y CONFIG_SAMV7_FORMAT_MCUBOOT=y
CONFIG_SAME70QMTECH_MCUBOOT_BOOTLOADER=y
CONFIG_USER_ENTRYPOINT="mcuboot_loader_main" CONFIG_USER_ENTRYPOINT="mcuboot_loader_main"
mcuboot-confirm: mcuboot-confirm:

View file

@ -45,12 +45,11 @@ CONFIG_RAM_SIZE=262144
CONFIG_RAM_START=0x20400000 CONFIG_RAM_START=0x20400000
CONFIG_RAW_BINARY=y CONFIG_RAW_BINARY=y
CONFIG_RR_INTERVAL=200 CONFIG_RR_INTERVAL=200
CONFIG_SAME70QMTECH_FORMAT_MCUBOOT=y CONFIG_SAMV7_FORMAT_MCUBOOT=y
CONFIG_SAMV7_GPIOA_IRQ=y CONFIG_SAMV7_GPIOA_IRQ=y
CONFIG_SAMV7_GPIOD_IRQ=y CONFIG_SAMV7_GPIOD_IRQ=y
CONFIG_SAMV7_GPIO_IRQ=y CONFIG_SAMV7_GPIO_IRQ=y
CONFIG_SAMV7_HSMCI0=y CONFIG_SAMV7_HSMCI0=y
CONFIG_SAMV7_PROGMEM=y
CONFIG_SAMV7_USART1=y CONFIG_SAMV7_USART1=y
CONFIG_SAMV7_XDMAC=y CONFIG_SAMV7_XDMAC=y
CONFIG_SCHED_HPWORK=y CONFIG_SCHED_HPWORK=y

View file

@ -46,13 +46,11 @@ CONFIG_RAM_SIZE=262144
CONFIG_RAM_START=0x20400000 CONFIG_RAM_START=0x20400000
CONFIG_RAW_BINARY=y CONFIG_RAW_BINARY=y
CONFIG_RR_INTERVAL=200 CONFIG_RR_INTERVAL=200
CONFIG_SAME70QMTECH_FORMAT_MCUBOOT=y CONFIG_SAMV7_FORMAT_MCUBOOT=y
CONFIG_SAME70QMTECH_MCUBOOT_BOOTLOADER=y
CONFIG_SAMV7_GPIOA_IRQ=y CONFIG_SAMV7_GPIOA_IRQ=y
CONFIG_SAMV7_GPIOD_IRQ=y CONFIG_SAMV7_GPIOD_IRQ=y
CONFIG_SAMV7_GPIO_IRQ=y CONFIG_SAMV7_GPIO_IRQ=y
CONFIG_SAMV7_HSMCI0=y CONFIG_SAMV7_HSMCI0=y
CONFIG_SAMV7_PROGMEM=y
CONFIG_SAMV7_USART1=y CONFIG_SAMV7_USART1=y
CONFIG_SAMV7_XDMAC=y CONFIG_SAMV7_XDMAC=y
CONFIG_SCHED_HPWORK=y CONFIG_SCHED_HPWORK=y

View file

@ -31,16 +31,16 @@ ENTRYPT = $(patsubst "%",%,$(CONFIG_USER_ENTRYPOINT))
ifeq ($(CONFIG_CYGWIN_WINTOOL),y) ifeq ($(CONFIG_CYGWIN_WINTOOL),y)
# Windows-native toolchains # Windows-native toolchains
USER_LIBPATHS = ${shell for path in $(USERLIBS); do dir=`dirname $(TOPDIR)$(DELIM)$$path`;echo "-L\"`cygpath -w $$dir`\"";done} USER_LIBPATHS = ${shell for path in $(USERLIBS); do dir=`dirname $(TOPDIR)$(DELIM)$$path`;echo "-L\"`cygpath -w $$dir`\"";done}
USER_LDSCRIPT = -T "${shell cygpath -w $(BOARD_DIR)$(DELIM)scripts$(DELIM)memory.ld}" USER_LDSCRIPT = -T "${shell cygpath -w $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)memory.ld}"
USER_LDSCRIPT += -T "${shell cygpath -w $(BOARD_DIR)$(DELIM)scripts$(DELIM)user-space.ld}" USER_LDSCRIPT += -T "${shell cygpath -w $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)user-space.ld}"
USER_HEXFILE += "${shell cygpath -w $(TOPDIR)$(DELIM)nuttx_user.hex}" USER_HEXFILE += "${shell cygpath -w $(TOPDIR)$(DELIM)nuttx_user.hex}"
USER_SRECFILE += "${shell cygpath -w $(TOPDIR)$(DELIM)nuttx_user.srec}" USER_SRECFILE += "${shell cygpath -w $(TOPDIR)$(DELIM)nuttx_user.srec}"
USER_BINFILE += "${shell cygpath -w $(TOPDIR)$(DELIM)nuttx_user.bin}" USER_BINFILE += "${shell cygpath -w $(TOPDIR)$(DELIM)nuttx_user.bin}"
else else
# Linux/Cygwin-native toolchain # Linux/Cygwin-native toolchain
USER_LIBPATHS = $(addprefix -L$(TOPDIR)$(DELIM),$(dir $(USERLIBS))) USER_LIBPATHS = $(addprefix -L$(TOPDIR)$(DELIM),$(dir $(USERLIBS)))
USER_LDSCRIPT = -T$(BOARD_DIR)$(DELIM)scripts$(DELIM)memory.ld USER_LDSCRIPT = -T$(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)memory.ld
USER_LDSCRIPT += -T$(BOARD_DIR)$(DELIM)scripts$(DELIM)user-space.ld USER_LDSCRIPT += -T$(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)user-space.ld
USER_HEXFILE += "$(TOPDIR)$(DELIM)nuttx_user.hex" USER_HEXFILE += "$(TOPDIR)$(DELIM)nuttx_user.hex"
USER_SRECFILE += "$(TOPDIR)$(DELIM)nuttx_user.srec" USER_SRECFILE += "$(TOPDIR)$(DELIM)nuttx_user.srec"
USER_BINFILE += "$(TOPDIR)$(DELIM)nuttx_user.bin" USER_BINFILE += "$(TOPDIR)$(DELIM)nuttx_user.bin"

View file

@ -18,55 +18,4 @@
# #
############################################################################ ############################################################################
include $(TOPDIR)/.config include $(TOPDIR)/boards/arm/samv7/common/scripts/flat.memory
include $(TOPDIR)/tools/Config.mk
include $(TOPDIR)/arch/arm/src/armv7-m/Toolchain.defs
LDSCRIPT_TEMPLATE = $(BOARD_DIR)$(DELIM)scripts$(DELIM)flash.template.ld
LDSCRIPT = samv7.ld
ifeq ($(CONFIG_CYGWIN_WINTOOL),y)
ARCHSCRIPT = -T "${shell cygpath -w $(BOARD_DIR)$(DELIM)scripts$(DELIM)$(LDSCRIPT)}"
else
ARCHSCRIPT = -T$(BOARD_DIR)$(DELIM)scripts$(DELIM)$(LDSCRIPT)
endif
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
ARCHOPTIMIZATION = -g
endif
ifneq ($(CONFIG_DEBUG_NOOPT),y)
ARCHOPTIMIZATION += $(MAXOPTIMIZATION)
endif
ARCHCFLAGS = -fno-builtin
ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fcheck-new -fno-rtti
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef -fno-strict-aliasing
ARCHWARNINGSXX = -Wall -Wshadow -Wundef
ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
CFLAGS := $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe
CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
CXXFLAGS := $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe
CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
CPPFLAGS := $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS)
AFLAGS := $(CFLAGS) -D__ASSEMBLY__
NXFLATLDFLAGS1 = -r -d -warn-common
NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat-pcrel.ld -no-check-sections
LDNXFLATFLAGS = -e main -s 2048
# Loadable module definitions
CMODULEFLAGS = $(CFLAGS) -mlong-calls # --target1-abs
LDMODULEFLAGS = -r -e module_initialize
ifeq ($(CONFIG_CYGWIN_WINTOOL),y)
LDMODULEFLAGS += -T "${shell cygpath -w $(TOPDIR)/libs/libc/modlib/gnu-elf.ld}"
else
LDMODULEFLAGS += -T $(TOPDIR)/libs/libc/modlib/gnu-elf.ld
endif
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
LDFLAGS += -g
endif

View file

@ -1,115 +0,0 @@
/****************************************************************************
* boards/arm/samv7/same70-qmtech/scripts/gnu-elf.ld
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
SECTIONS
{
.text 0x00000000 :
{
_stext = . ;
*(.text)
*(.text.*)
*(.gnu.warning)
*(.stub)
*(.glue_7)
*(.glue_7t)
*(.jcr)
/* C++ support: The .init and .fini sections contain specific logic
* to manage static constructors and destructors.
*/
*(.gnu.linkonce.t.*)
*(.init) /* Old ABI */
*(.fini) /* Old ABI */
_etext = . ;
}
.rodata :
{
_srodata = . ;
*(.rodata)
*(.rodata1)
*(.rodata.*)
*(.gnu.linkonce.r*)
_erodata = . ;
}
.data :
{
_sdata = . ;
*(.data)
*(.data1)
*(.data.*)
*(.gnu.linkonce.d*)
. = ALIGN(4);
_edata = . ;
}
/* C++ support. For each global and static local C++ object,
* GCC creates a small subroutine to construct the object. Pointers
* to these routines (not the routines themselves) are stored as
* simple, linear arrays in the .ctors section of the object file.
* Similarly, pointers to global/static destructor routines are
* stored in .dtors.
*/
.ctors :
{
_sctors = . ;
*(.ctors) /* Old ABI: Unallocated */
*(.init_array) /* New ABI: Allocated */
_edtors = . ;
}
.dtors :
{
_sdtors = . ;
*(.dtors) /* Old ABI: Unallocated */
*(.fini_array) /* New ABI: Allocated */
_edtors = . ;
}
.bss :
{
_sbss = . ;
*(.bss)
*(.bss.*)
*(.sbss)
*(.sbss.*)
*(.gnu.linkonce.b*)
*(COMMON)
_ebss = . ;
}
/* Stabs debugging sections. */
.stab 0 : { *(.stab) }
.stabstr 0 : { *(.stabstr) }
.stab.excl 0 : { *(.stab.excl) }
.stab.exclstr 0 : { *(.stab.exclstr) }
.stab.index 0 : { *(.stab.index) }
.stab.indexstr 0 : { *(.stab.indexstr) }
.comment 0 : { *(.comment) }
.debug_abbrev 0 : { *(.debug_abbrev) }
.debug_info 0 : { *(.debug_info) }
.debug_line 0 : { *(.debug_line) }
.debug_pubnames 0 : { *(.debug_pubnames) }
.debug_aranges 0 : { *(.debug_aranges) }
}

View file

@ -1,106 +0,0 @@
/****************************************************************************
* boards/arm/samv7/same70-qmtech/scripts/kernel-space.ld
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/* NOTE: This depends on the memory.ld script having been included prior to
* this script.
*/
OUTPUT_ARCH(arm)
EXTERN(_vectors)
ENTRY(_stext)
SECTIONS
{
.text : {
_stext = ABSOLUTE(.);
*(.vectors)
*(.text .text.*)
*(.fixup)
*(.gnu.warning)
*(.rodata .rodata.*)
*(.gnu.linkonce.t.*)
*(.glue_7)
*(.glue_7t)
*(.got)
*(.gcc_except_table)
*(.gnu.linkonce.r.*)
_etext = ABSOLUTE(.);
} > kflash
.init_section : {
_sinit = ABSOLUTE(.);
*(.init_array .init_array.*)
_einit = ABSOLUTE(.);
} > kflash
.ARM.extab : {
*(.ARM.extab*)
} > kflash
__exidx_start = ABSOLUTE(.);
.ARM.exidx : {
*(.ARM.exidx*)
} > kflash
__exidx_end = ABSOLUTE(.);
_eronly = ABSOLUTE(.);
.data : {
_sdata = ABSOLUTE(.);
*(.data .data.*)
*(.gnu.linkonce.d.*)
CONSTRUCTORS
. = ALIGN(4);
_edata = ABSOLUTE(.);
} > ksram AT > kflash
.ramfunc ALIGN(4): {
_sramfuncs = ABSOLUTE(.);
*(.ramfunc .ramfunc.*)
_eramfuncs = ABSOLUTE(.);
} > ksram AT > kflash
_framfuncs = LOADADDR(.ramfunc);
.bss : {
_sbss = ABSOLUTE(.);
*(.bss .bss.*)
*(.gnu.linkonce.b.*)
*(COMMON)
. = ALIGN(4);
_ebss = ABSOLUTE(.);
} > ksram
/* Stabs debugging sections */
.stab 0 : { *(.stab) }
.stabstr 0 : { *(.stabstr) }
.stab.excl 0 : { *(.stab.excl) }
.stab.exclstr 0 : { *(.stab.exclstr) }
.stab.index 0 : { *(.stab.index) }
.stab.indexstr 0 : { *(.stab.indexstr) }
.comment 0 : { *(.comment) }
.debug_abbrev 0 : { *(.debug_abbrev) }
.debug_info 0 : { *(.debug_info) }
.debug_line 0 : { *(.debug_line) }
.debug_pubnames 0 : { *(.debug_pubnames) }
.debug_aranges 0 : { *(.debug_aranges) }
}

View file

@ -1,66 +0,0 @@
/****************************************************************************
* boards/arm/samv7/same70-qmtech/scripts/memory.ld
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/* The SAME70N19 has 512Kb of FLASH beginning at address 0x0040:0000 and
* 256Kb of SRAM beginining at 0x2040:0000
*
* When booting from FLASH, FLASH memory is aliased to address 0x0000:0000
* where the code expects to begin execution by jumping to the entry point in
* the 0x0400:0000 address range.
*
* The user space partition will be spanned with a single region of size
* 2**n bytes. The alignment of the user-space region must be the same.
* As a consequence, as the user-space increases in size, the alignment
* requirement also increases. The sizes below give the largest possible
* user address spaces (but leave far too much for the OS).
*
* The solution to this wasted memory is to (1) use more than one region to
* span the user spaces, or (2) poke holes in a larger region to trim it
* to fit better.
*
* A detailed memory map for the 256KB SRAM region is as follows:
*
* 0x2040 0000: Kernel .data region. Typical size: 0.1KB
* ------ ---- Kernel .bss region. Typical size: 1.8KB
* 0x2040 0800: Kernel IDLE thread stack (approximate). Size is
* determined by CONFIG_IDLETHREAD_STACKSIZE and
* adjustments for alignment. Typical is 1KB.
* ------ ---- Padded to 4KB
* 0x2041 0000: User .data region. Size is variable.
* ------- ---- User .bss region Size is variable.
* 0x2042 0000: Beginning of kernel heap. Size determined by
* CONFIG_MM_KERNEL_HEAPSIZE.
* ------ ---- Beginning of user heap. Can vary with other settings.
* 0x2044 0000: End+1 of mappable internal SRAM
*/
MEMORY
{
/* 512Kb of internal FLASH */
kflash (rx) : ORIGIN = 0x00400000, LENGTH = 256K
uflash (rx) : ORIGIN = 0x00440000, LENGTH = 256K
/* 256Kb of internal SRAM */
ksram (rwx) : ORIGIN = 0x20400000, LENGTH = 64K
usram (rwx) : ORIGIN = 0x20410000, LENGTH = 64K
xsram (rwx) : ORIGIN = 0x20420000, LENGTH = 128K
}

View file

@ -1,111 +0,0 @@
/****************************************************************************
* boards/arm/samv7/same70-qmtech/scripts/user-space.ld
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/* NOTE: This depends on the memory.ld script having been included prior to
* this script.
*/
/* Make sure that the critical memory management functions are in user-space.
* the user heap memory manager will reside in user-space but be usable both
* by kernel- and user-space code
*/
EXTERN(umm_initialize)
EXTERN(umm_addregion)
EXTERN(malloc)
EXTERN(realloc)
EXTERN(zalloc)
EXTERN(free)
OUTPUT_ARCH(arm)
SECTIONS
{
.userspace : {
*(.userspace)
} > uflash
.text : {
_stext = ABSOLUTE(.);
*(.text .text.*)
*(.fixup)
*(.gnu.warning)
*(.rodata .rodata.*)
*(.gnu.linkonce.t.*)
*(.glue_7)
*(.glue_7t)
*(.got)
*(.gcc_except_table)
*(.gnu.linkonce.r.*)
_etext = ABSOLUTE(.);
} > uflash
.init_section : {
_sinit = ABSOLUTE(.);
*(.init_array .init_array.*)
_einit = ABSOLUTE(.);
} > uflash
.ARM.extab : {
*(.ARM.extab*)
} > uflash
__exidx_start = ABSOLUTE(.);
.ARM.exidx : {
*(.ARM.exidx*)
} > uflash
__exidx_end = ABSOLUTE(.);
_eronly = ABSOLUTE(.);
.data : {
_sdata = ABSOLUTE(.);
*(.data .data.*)
*(.gnu.linkonce.d.*)
CONSTRUCTORS
. = ALIGN(4);
_edata = ABSOLUTE(.);
} > usram AT > uflash
.bss : {
_sbss = ABSOLUTE(.);
*(.bss .bss.*)
*(.gnu.linkonce.b.*)
*(COMMON)
. = ALIGN(4);
_ebss = ABSOLUTE(.);
} > usram
/* Stabs debugging sections */
.stab 0 : { *(.stab) }
.stabstr 0 : { *(.stabstr) }
.stab.excl 0 : { *(.stab.excl) }
.stab.exclstr 0 : { *(.stab.exclstr) }
.stab.index 0 : { *(.stab.index) }
.stab.indexstr 0 : { *(.stab.indexstr) }
.comment 0 : { *(.comment) }
.debug_abbrev 0 : { *(.debug_abbrev) }
.debug_info 0 : { *(.debug_info) }
.debug_line 0 : { *(.debug_line) }
.debug_pubnames 0 : { *(.debug_pubnames) }
.debug_aranges 0 : { *(.debug_aranges) }
}

View file

@ -68,16 +68,18 @@ ifneq (,$(findstring y,$(CONFIG_SAMV7_DAC0) $(CONFIG_SAMV7_DAC1)))
CSRCS += sam_dac.c CSRCS += sam_dac.c
endif endif
SCRIPTOUT = $(BOARD_DIR)$(DELIM)scripts$(DELIM)samv7.ld SCRIPTOUT = $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)samv7.ld
.PHONY = context distclean .PHONY = context distclean
$(SCRIPTOUT): $(LDSCRIPT_TEMPLATE) $(CONFIGFILE) $(SCRIPTOUT): $(LDSCRIPT_TEMPLATE) $(CONFIGFILE)
$(Q) $(CC) -isystem $(TOPDIR)/include -I $(BOARD_DIR)$(DELIM)scripts -C -P -x c -E $(LDSCRIPT_TEMPLATE) -o $@ $(Q) $(CC) -isystem $(TOPDIR)/include -I $(BOARD_COMMON_DIR)$(DELIM)scripts -C -P -x c -E $(LDSCRIPT_TEMPLATE) -o $@
context:: $(SCRIPTOUT) context:: $(SCRIPTOUT)
distclean:: distclean::
$(call DELFILE, $(SCRIPTOUT)) $(call DELFILE, $(SCRIPTOUT))
include $(TOPDIR)/boards/Board.mk DEPPATH += --dep-path board
VPATH += :board
CFLAGS += $(shell $(INCDIR) "$(CC)" $(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)board)

View file

@ -54,7 +54,7 @@
* Private Types * Private Types
****************************************************************************/ ****************************************************************************/
#if defined(CONFIG_SAME70QMTECH_PROGMEM_OTA_PARTITION) #if defined(CONFIG_SAMV7_PROGMEM_OTA_PARTITION)
struct ota_partition_s struct ota_partition_s
{ {
@ -69,7 +69,7 @@ struct ota_partition_s
* Private Function Prototypes * Private Function Prototypes
****************************************************************************/ ****************************************************************************/
#if defined(CONFIG_SAME70QMTECH_PROGMEM_OTA_PARTITION) #if defined(CONFIG_SAMV7_PROGMEM_OTA_PARTITION)
static struct mtd_dev_s *sam_progmem_alloc_mtdpart(uint32_t mtd_offset, static struct mtd_dev_s *sam_progmem_alloc_mtdpart(uint32_t mtd_offset,
uint32_t mtd_size); uint32_t mtd_size);
static int init_ota_partitions(void); static int init_ota_partitions(void);
@ -81,23 +81,23 @@ static int init_ota_partitions(void);
static FAR struct mtd_dev_s *g_samv7_progmem_mtd; static FAR struct mtd_dev_s *g_samv7_progmem_mtd;
#if defined(CONFIG_SAME70QMTECH_PROGMEM_OTA_PARTITION) #if defined(CONFIG_SAMV7_PROGMEM_OTA_PARTITION)
static const struct ota_partition_s g_ota_partition_table[] = static const struct ota_partition_s g_ota_partition_table[] =
{ {
{ {
.offset = CONFIG_SAME70QMTECH_OTA_PRIMARY_SLOT_OFFSET, .offset = CONFIG_SAMV7_OTA_PRIMARY_SLOT_OFFSET,
.size = CONFIG_SAME70QMTECH_OTA_SLOT_SIZE, .size = CONFIG_SAMV7_OTA_SLOT_SIZE,
.devpath = CONFIG_SAME70QMTECH_OTA_PRIMARY_SLOT_DEVPATH .devpath = CONFIG_SAMV7_OTA_PRIMARY_SLOT_DEVPATH
}, },
{ {
.offset = CONFIG_SAME70QMTECH_OTA_SECONDARY_SLOT_OFFSET, .offset = CONFIG_SAMV7_OTA_SECONDARY_SLOT_OFFSET,
.size = CONFIG_SAME70QMTECH_OTA_SLOT_SIZE, .size = CONFIG_SAMV7_OTA_SLOT_SIZE,
.devpath = CONFIG_SAME70QMTECH_OTA_SECONDARY_SLOT_DEVPATH .devpath = CONFIG_SAMV7_OTA_SECONDARY_SLOT_DEVPATH
}, },
{ {
.offset = CONFIG_SAME70QMTECH_OTA_SCRATCH_OFFSET, .offset = CONFIG_SAMV7_OTA_SCRATCH_OFFSET,
.size = CONFIG_SAME70QMTECH_OTA_SCRATCH_SIZE, .size = CONFIG_SAMV7_OTA_SCRATCH_SIZE,
.devpath = CONFIG_SAME70QMTECH_OTA_SCRATCH_DEVPATH .devpath = CONFIG_SAMV7_OTA_SCRATCH_DEVPATH
} }
}; };
#endif #endif
@ -106,7 +106,7 @@ static const struct ota_partition_s g_ota_partition_table[] =
* Private Functions * Private Functions
****************************************************************************/ ****************************************************************************/
#if defined(CONFIG_SAME70QMTECH_PROGMEM_OTA_PARTITION) #if defined(CONFIG_SAMV7_PROGMEM_OTA_PARTITION)
/**************************************************************************** /****************************************************************************
* Name: sam_progmem_alloc_mtdpart * Name: sam_progmem_alloc_mtdpart
@ -225,7 +225,7 @@ int sam_progmem_init(void)
return -EFAULT; return -EFAULT;
} }
#if defined(CONFIG_SAME70QMTECH_PROGMEM_OTA_PARTITION) #if defined(CONFIG_SAMV7_PROGMEM_OTA_PARTITION)
ret = init_ota_partitions(); ret = init_ota_partitions();
if (ret < 0) if (ret < 0)
{ {

View file

@ -1 +0,0 @@
/scripts/samv7.ld

View file

@ -90,65 +90,4 @@ config SAME70XPLAINED_HSMCI0_AUTOMOUNT_UDELAY
endif # SAME70XPLAINED_HSMCI0_AUTOMOUNT endif # SAME70XPLAINED_HSMCI0_AUTOMOUNT
config SAME70XPLAINED_PROGMEM_OTA_PARTITION
bool
default n
select MTD
select MTD_BYTE_WRITE
select MTD_PARTITION
select MTD_PROGMEM
select MTD_PROGMEM_ERASESTATE
menuconfig SAME70XPLAINED_FORMAT_MCUBOOT
bool "MCUboot-bootable format"
default n
select SAME70XPLAINED_PROGMEM_OTA_PARTITION
---help---
The MCUboot support of loading the firmware images.
if SAME70XPLAINED_FORMAT_MCUBOOT
config SAME70XPLAINED_MCUBOOT_BOOTLOADER
bool "MCUboot bootloader application"
default n
---help---
This switch between linker scripts to allow an application be
built to another entry point address.
comment "MCUboot Application Image OTA Update support"
config SAME70XPLAINED_OTA_PRIMARY_SLOT_OFFSET
hex "MCUboot application image primary slot offset"
default "0x20000"
config SAME70XPLAINED_OTA_PRIMARY_SLOT_DEVPATH
string "Application image primary slot device path"
default "/dev/ota0"
config SAME70XPLAINED_OTA_SECONDARY_SLOT_OFFSET
hex "MCUboot application image secondary slot offset"
default "0x100000"
config SAME70XPLAINED_OTA_SECONDARY_SLOT_DEVPATH
string "Application image secondary slot device path"
default "/dev/ota1"
config SAME70XPLAINED_OTA_SLOT_SIZE
hex "MCUboot application image slot size (in bytes)"
default "0xe0000"
config SAME70XPLAINED_OTA_SCRATCH_OFFSET
hex "MCUboot scratch partition offset"
default "0x1e0000"
config SAME70XPLAINED_OTA_SCRATCH_DEVPATH
string "Scratch partition device path"
default "/dev/otascratch"
config SAME70XPLAINED_OTA_SCRATCH_SIZE
hex "MCUboot scratch partition size (in bytes)"
default "0x20000"
endif # SAME70XPLAINED_FORMAT_MCUBOOT
endif # ARCH_BOARD_SAME70_XPLAINED endif # ARCH_BOARD_SAME70_XPLAINED

View file

@ -1159,7 +1159,7 @@ Using OpenOCD and GDB to flash via the EDBG chip
OpenOCD requires a configuration file. I keep the one I used last here: OpenOCD requires a configuration file. I keep the one I used last here:
boards/arm/samv7/same70-xplained/tools/atmel_same70_xplained.cfg boards/arm/samv7/common/tools/atmel_same70_xplained.cfg
However, the "correct" configuration script to use with OpenOCD may However, the "correct" configuration script to use with OpenOCD may
change as the features of OpenOCD evolve. So you should at least change as the features of OpenOCD evolve. So you should at least
@ -1175,15 +1175,15 @@ Using OpenOCD and GDB to flash via the EDBG chip
the OpenOCD daemon on my system called oocd.sh. That script will the OpenOCD daemon on my system called oocd.sh. That script will
probably require some modifications to work in another environment: probably require some modifications to work in another environment:
- Possibly the value of OPENOCD_PATH and TARGET_PATH - Possibly the value of OPENOCD_PATH, TARGET_PATH and TARGET_BOARD
- It assumes that the correct script to use is the one at - It assumes that the correct script to use is the one at
boards/arm/samv7/same70-xplained/tools/atmel_same70_xplained.cfg boards/arm/samv7/common/tools/atmel_${TARGET_BOARD}.cfg
Starting OpenOCD Starting OpenOCD
Then you should be able to start the OpenOCD daemon like: Then you should be able to start the OpenOCD daemon like:
boards/arm/samv7/same70-xplained/tools/oocd.sh $PWD boards/arm/samv7/common/tools/oocd.sh $PWD
Connecting GDB Connecting GDB
@ -1716,8 +1716,7 @@ Configuration sub-directories
CONFIG_MCUBOOT_BOOTLOADER=y CONFIG_MCUBOOT_BOOTLOADER=y
CONFIG_MCUBOOT_ENABLE_LOGGING=y CONFIG_MCUBOOT_ENABLE_LOGGING=y
CONFIG_SAME70XPLAINED_FORMAT_MCUBOOT=y CONFIG_SAMV7_FORMAT_MCUBOOT=y
CONFIG_SAME70XPLAINED_MCUBOOT_BOOTLOADER=y
CONFIG_USER_ENTRYPOINT="mcuboot_loader_main" CONFIG_USER_ENTRYPOINT="mcuboot_loader_main"
mcuboot-confirm: mcuboot-confirm:

View file

@ -46,7 +46,6 @@ CONFIG_MMCSD_MULTIBLOCK_DISABLE=y
CONFIG_MMCSD_SDIO=y CONFIG_MMCSD_SDIO=y
CONFIG_MTD_AT24XX=y CONFIG_MTD_AT24XX=y
CONFIG_MTD_AT25=y CONFIG_MTD_AT25=y
CONFIG_MTD_CONFIG=y
CONFIG_NSH_ARCHINIT=y CONFIG_NSH_ARCHINIT=y
CONFIG_NSH_BUILTIN_APPS=y CONFIG_NSH_BUILTIN_APPS=y
CONFIG_NSH_FILEIOSIZE=512 CONFIG_NSH_FILEIOSIZE=512
@ -57,12 +56,11 @@ CONFIG_RAM_SIZE=393216
CONFIG_RAM_START=0x20400000 CONFIG_RAM_START=0x20400000
CONFIG_RAW_BINARY=y CONFIG_RAW_BINARY=y
CONFIG_RR_INTERVAL=200 CONFIG_RR_INTERVAL=200
CONFIG_SAME70XPLAINED_FORMAT_MCUBOOT=y CONFIG_SAMV7_FORMAT_MCUBOOT=y
CONFIG_SAMV7_GPIOA_IRQ=y CONFIG_SAMV7_GPIOA_IRQ=y
CONFIG_SAMV7_GPIOC_IRQ=y CONFIG_SAMV7_GPIOC_IRQ=y
CONFIG_SAMV7_GPIO_IRQ=y CONFIG_SAMV7_GPIO_IRQ=y
CONFIG_SAMV7_HSMCI0=y CONFIG_SAMV7_HSMCI0=y
CONFIG_SAMV7_PROGMEM=y
CONFIG_SAMV7_SDRAMC=y CONFIG_SAMV7_SDRAMC=y
CONFIG_SAMV7_SDRAMSIZE=2097152 CONFIG_SAMV7_SDRAMSIZE=2097152
CONFIG_SAMV7_TWIHS0=y CONFIG_SAMV7_TWIHS0=y

View file

@ -47,7 +47,6 @@ CONFIG_MMCSD_MULTIBLOCK_DISABLE=y
CONFIG_MMCSD_SDIO=y CONFIG_MMCSD_SDIO=y
CONFIG_MTD_AT24XX=y CONFIG_MTD_AT24XX=y
CONFIG_MTD_AT25=y CONFIG_MTD_AT25=y
CONFIG_MTD_CONFIG=y
CONFIG_NSH_ARCHINIT=y CONFIG_NSH_ARCHINIT=y
CONFIG_NSH_BUILTIN_APPS=y CONFIG_NSH_BUILTIN_APPS=y
CONFIG_NSH_FILEIOSIZE=512 CONFIG_NSH_FILEIOSIZE=512
@ -58,13 +57,11 @@ CONFIG_RAM_SIZE=393216
CONFIG_RAM_START=0x20400000 CONFIG_RAM_START=0x20400000
CONFIG_RAW_BINARY=y CONFIG_RAW_BINARY=y
CONFIG_RR_INTERVAL=200 CONFIG_RR_INTERVAL=200
CONFIG_SAME70XPLAINED_FORMAT_MCUBOOT=y CONFIG_SAMV7_FORMAT_MCUBOOT=y
CONFIG_SAME70XPLAINED_MCUBOOT_BOOTLOADER=y
CONFIG_SAMV7_GPIOA_IRQ=y CONFIG_SAMV7_GPIOA_IRQ=y
CONFIG_SAMV7_GPIOC_IRQ=y CONFIG_SAMV7_GPIOC_IRQ=y
CONFIG_SAMV7_GPIO_IRQ=y CONFIG_SAMV7_GPIO_IRQ=y
CONFIG_SAMV7_HSMCI0=y CONFIG_SAMV7_HSMCI0=y
CONFIG_SAMV7_PROGMEM=y
CONFIG_SAMV7_SDRAMC=y CONFIG_SAMV7_SDRAMC=y
CONFIG_SAMV7_SDRAMSIZE=2097152 CONFIG_SAMV7_SDRAMSIZE=2097152
CONFIG_SAMV7_TWIHS0=y CONFIG_SAMV7_TWIHS0=y

View file

@ -31,16 +31,16 @@ ENTRYPT = $(patsubst "%",%,$(CONFIG_USER_ENTRYPOINT))
ifeq ($(CONFIG_CYGWIN_WINTOOL),y) ifeq ($(CONFIG_CYGWIN_WINTOOL),y)
# Windows-native toolchains # Windows-native toolchains
USER_LIBPATHS = ${shell for path in $(USERLIBS); do dir=`dirname $(TOPDIR)$(DELIM)$$path`;echo "-L\"`cygpath -w $$dir`\"";done} USER_LIBPATHS = ${shell for path in $(USERLIBS); do dir=`dirname $(TOPDIR)$(DELIM)$$path`;echo "-L\"`cygpath -w $$dir`\"";done}
USER_LDSCRIPT = -T "${shell cygpath -w $(BOARD_DIR)$(DELIM)scripts$(DELIM)memory.ld}" USER_LDSCRIPT = -T "${shell cygpath -w $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)memory.ld}"
USER_LDSCRIPT += -T "${shell cygpath -w $(BOARD_DIR)$(DELIM)scripts$(DELIM)user-space.ld}" USER_LDSCRIPT += -T "${shell cygpath -w $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)user-space.ld}"
USER_HEXFILE += "${shell cygpath -w $(TOPDIR)$(DELIM)nuttx_user.hex}" USER_HEXFILE += "${shell cygpath -w $(TOPDIR)$(DELIM)nuttx_user.hex}"
USER_SRECFILE += "${shell cygpath -w $(TOPDIR)$(DELIM)nuttx_user.srec}" USER_SRECFILE += "${shell cygpath -w $(TOPDIR)$(DELIM)nuttx_user.srec}"
USER_BINFILE += "${shell cygpath -w $(TOPDIR)$(DELIM)nuttx_user.bin}" USER_BINFILE += "${shell cygpath -w $(TOPDIR)$(DELIM)nuttx_user.bin}"
else else
# Linux/Cygwin-native toolchain # Linux/Cygwin-native toolchain
USER_LIBPATHS = $(addprefix -L$(TOPDIR)$(DELIM),$(dir $(USERLIBS))) USER_LIBPATHS = $(addprefix -L$(TOPDIR)$(DELIM),$(dir $(USERLIBS)))
USER_LDSCRIPT = -T$(BOARD_DIR)$(DELIM)scripts$(DELIM)memory.ld USER_LDSCRIPT = -T$(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)memory.ld
USER_LDSCRIPT += -T$(BOARD_DIR)$(DELIM)scripts$(DELIM)user-space.ld USER_LDSCRIPT += -T$(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)user-space.ld
USER_HEXFILE += "$(TOPDIR)$(DELIM)nuttx_user.hex" USER_HEXFILE += "$(TOPDIR)$(DELIM)nuttx_user.hex"
USER_SRECFILE += "$(TOPDIR)$(DELIM)nuttx_user.srec" USER_SRECFILE += "$(TOPDIR)$(DELIM)nuttx_user.srec"
USER_BINFILE += "$(TOPDIR)$(DELIM)nuttx_user.bin" USER_BINFILE += "$(TOPDIR)$(DELIM)nuttx_user.bin"

View file

@ -18,55 +18,4 @@
# #
############################################################################ ############################################################################
include $(TOPDIR)/.config include $(TOPDIR)/boards/arm/samv7/common/scripts/flat.memory
include $(TOPDIR)/tools/Config.mk
include $(TOPDIR)/arch/arm/src/armv7-m/Toolchain.defs
LDSCRIPT_TEMPLATE = $(BOARD_DIR)$(DELIM)scripts$(DELIM)flash.template.ld
LDSCRIPT = samv7.ld
ifeq ($(CONFIG_CYGWIN_WINTOOL),y)
ARCHSCRIPT = -T "${shell cygpath -w $(BOARD_DIR)$(DELIM)scripts$(DELIM)$(LDSCRIPT)}"
else
ARCHSCRIPT = -T$(BOARD_DIR)$(DELIM)scripts$(DELIM)$(LDSCRIPT)
endif
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
ARCHOPTIMIZATION = -g
endif
ifneq ($(CONFIG_DEBUG_NOOPT),y)
ARCHOPTIMIZATION += $(MAXOPTIMIZATION)
endif
ARCHCFLAGS = -fno-builtin
ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fcheck-new -fno-rtti
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef -fno-strict-aliasing
ARCHWARNINGSXX = -Wall -Wshadow -Wundef
ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
CFLAGS := $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe
CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
CXXFLAGS := $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe
CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
CPPFLAGS := $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS)
AFLAGS := $(CFLAGS) -D__ASSEMBLY__
NXFLATLDFLAGS1 = -r -d -warn-common
NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat-pcrel.ld -no-check-sections
LDNXFLATFLAGS = -e main -s 2048
# Loadable module definitions
CMODULEFLAGS = $(CFLAGS) -mlong-calls # --target1-abs
LDMODULEFLAGS = -r -e module_initialize
ifeq ($(CONFIG_CYGWIN_WINTOOL),y)
LDMODULEFLAGS += -T "${shell cygpath -w $(TOPDIR)/libs/libc/modlib/gnu-elf.ld}"
else
LDMODULEFLAGS += -T $(TOPDIR)/libs/libc/modlib/gnu-elf.ld
endif
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
LDFLAGS += -g
endif

View file

@ -1,130 +0,0 @@
/****************************************************************************
* boards/arm/samv7/same70-xplained/scripts/flash.template.ld
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
#include <nuttx/config.h>
#define FLASH_START_ADDR 0x00400000
#ifdef CONFIG_ARMV7M_DTCM
# define SRAM_START_ADDR 0x20000000
#else
# define SRAM_START_ADDR 0x20400000
#endif
#ifdef CONFIG_SAME70XPLAINED_FORMAT_MCUBOOT
# define MCUBOOT_HEADER_SIZE 0x200
# ifdef CONFIG_BOARDCTL_BOOT_IMAGE
# define FLASH_OFFSET 0
# define FLASH_IMG_SIZE CONFIG_SAME70XPLAINED_OTA_PRIMARY_SLOT_OFFSET
# else
# define FLASH_OFFSET (CONFIG_SAME70XPLAINED_OTA_PRIMARY_SLOT_OFFSET + MCUBOOT_HEADER_SIZE)
# define FLASH_IMG_SIZE (CONFIG_SAME70XPLAINED_OTA_SLOT_SIZE - MCUBOOT_HEADER_SIZE)
# endif
#else
# define FLASH_OFFSET 0
# define FLASH_IMG_SIZE CONFIG_ARCH_CHIP_SAMV7_MEM_FLASH
#endif
MEMORY
{
flash (rx) : ORIGIN = FLASH_START_ADDR + FLASH_OFFSET, LENGTH = FLASH_IMG_SIZE
sram (rwx) : ORIGIN = SRAM_START_ADDR, LENGTH = CONFIG_ARCH_CHIP_SAMV7_MEM_RAM
}
OUTPUT_ARCH(arm)
EXTERN(_vectors)
ENTRY(_stext)
SECTIONS
{
.text : {
_stext = ABSOLUTE(.);
*(.vectors)
*(.text .text.*)
*(.fixup)
*(.gnu.warning)
*(.rodata .rodata.*)
*(.gnu.linkonce.t.*)
*(.glue_7)
*(.glue_7t)
*(.got)
*(.gcc_except_table)
*(.gnu.linkonce.r.*)
_etext = ABSOLUTE(.);
} > flash
.init_section : {
_sinit = ABSOLUTE(.);
*(.init_array .init_array.*)
_einit = ABSOLUTE(.);
} > flash
.ARM.extab : {
*(.ARM.extab*)
} > flash
__exidx_start = ABSOLUTE(.);
.ARM.exidx : {
*(.ARM.exidx*)
} > flash
__exidx_end = ABSOLUTE(.);
_eronly = ABSOLUTE(.);
.data : {
_sdata = ABSOLUTE(.);
*(.data .data.*)
*(.gnu.linkonce.d.*)
CONSTRUCTORS
. = ALIGN(4);
_edata = ABSOLUTE(.);
} > sram AT > flash
.ramfunc ALIGN(4): {
_sramfuncs = ABSOLUTE(.);
*(.ramfunc .ramfunc.*)
_eramfuncs = ABSOLUTE(.);
} > sram AT > flash
_framfuncs = LOADADDR(.ramfunc);
.bss : {
_sbss = ABSOLUTE(.);
*(.bss .bss.*)
*(.gnu.linkonce.b.*)
*(COMMON)
. = ALIGN(4);
_ebss = ABSOLUTE(.);
} > sram
/* Stabs debugging sections. */
.stab 0 : { *(.stab) }
.stabstr 0 : { *(.stabstr) }
.stab.excl 0 : { *(.stab.excl) }
.stab.exclstr 0 : { *(.stab.exclstr) }
.stab.index 0 : { *(.stab.index) }
.stab.indexstr 0 : { *(.stab.indexstr) }
.comment 0 : { *(.comment) }
.debug_abbrev 0 : { *(.debug_abbrev) }
.debug_info 0 : { *(.debug_info) }
.debug_line 0 : { *(.debug_line) }
.debug_pubnames 0 : { *(.debug_pubnames) }
.debug_aranges 0 : { *(.debug_aranges) }
}

View file

@ -1,115 +0,0 @@
/****************************************************************************
* boards/arm/samv7/same70-xplained/scripts/gnu-elf.ld
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
SECTIONS
{
.text 0x00000000 :
{
_stext = . ;
*(.text)
*(.text.*)
*(.gnu.warning)
*(.stub)
*(.glue_7)
*(.glue_7t)
*(.jcr)
/* C++ support: The .init and .fini sections contain specific logic
* to manage static constructors and destructors.
*/
*(.gnu.linkonce.t.*)
*(.init) /* Old ABI */
*(.fini) /* Old ABI */
_etext = . ;
}
.rodata :
{
_srodata = . ;
*(.rodata)
*(.rodata1)
*(.rodata.*)
*(.gnu.linkonce.r*)
_erodata = . ;
}
.data :
{
_sdata = . ;
*(.data)
*(.data1)
*(.data.*)
*(.gnu.linkonce.d*)
. = ALIGN(4);
_edata = . ;
}
/* C++ support. For each global and static local C++ object,
* GCC creates a small subroutine to construct the object. Pointers
* to these routines (not the routines themselves) are stored as
* simple, linear arrays in the .ctors section of the object file.
* Similarly, pointers to global/static destructor routines are
* stored in .dtors.
*/
.ctors :
{
_sctors = . ;
*(.ctors) /* Old ABI: Unallocated */
*(.init_array) /* New ABI: Allocated */
_edtors = . ;
}
.dtors :
{
_sdtors = . ;
*(.dtors) /* Old ABI: Unallocated */
*(.fini_array) /* New ABI: Allocated */
_edtors = . ;
}
.bss :
{
_sbss = . ;
*(.bss)
*(.bss.*)
*(.sbss)
*(.sbss.*)
*(.gnu.linkonce.b*)
*(COMMON)
_ebss = . ;
}
/* Stabs debugging sections. */
.stab 0 : { *(.stab) }
.stabstr 0 : { *(.stabstr) }
.stab.excl 0 : { *(.stab.excl) }
.stab.exclstr 0 : { *(.stab.exclstr) }
.stab.index 0 : { *(.stab.index) }
.stab.indexstr 0 : { *(.stab.indexstr) }
.comment 0 : { *(.comment) }
.debug_abbrev 0 : { *(.debug_abbrev) }
.debug_info 0 : { *(.debug_info) }
.debug_line 0 : { *(.debug_line) }
.debug_pubnames 0 : { *(.debug_pubnames) }
.debug_aranges 0 : { *(.debug_aranges) }
}

View file

@ -1,106 +0,0 @@
/****************************************************************************
* boards/arm/samv7/same70-xplained/scripts/kernel-space.ld
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/* NOTE: This depends on the memory.ld script having been included prior to
* this script.
*/
OUTPUT_ARCH(arm)
EXTERN(_vectors)
ENTRY(_stext)
SECTIONS
{
.text : {
_stext = ABSOLUTE(.);
*(.vectors)
*(.text .text.*)
*(.fixup)
*(.gnu.warning)
*(.rodata .rodata.*)
*(.gnu.linkonce.t.*)
*(.glue_7)
*(.glue_7t)
*(.got)
*(.gcc_except_table)
*(.gnu.linkonce.r.*)
_etext = ABSOLUTE(.);
} > kflash
.init_section : {
_sinit = ABSOLUTE(.);
*(.init_array .init_array.*)
_einit = ABSOLUTE(.);
} > kflash
.ARM.extab : {
*(.ARM.extab*)
} > kflash
__exidx_start = ABSOLUTE(.);
.ARM.exidx : {
*(.ARM.exidx*)
} > kflash
__exidx_end = ABSOLUTE(.);
_eronly = ABSOLUTE(.);
.data : {
_sdata = ABSOLUTE(.);
*(.data .data.*)
*(.gnu.linkonce.d.*)
CONSTRUCTORS
. = ALIGN(4);
_edata = ABSOLUTE(.);
} > ksram AT > kflash
.ramfunc ALIGN(4): {
_sramfuncs = ABSOLUTE(.);
*(.ramfunc .ramfunc.*)
_eramfuncs = ABSOLUTE(.);
} > ksram AT > kflash
_framfuncs = LOADADDR(.ramfunc);
.bss : {
_sbss = ABSOLUTE(.);
*(.bss .bss.*)
*(.gnu.linkonce.b.*)
*(COMMON)
. = ALIGN(4);
_ebss = ABSOLUTE(.);
} > ksram
/* Stabs debugging sections */
.stab 0 : { *(.stab) }
.stabstr 0 : { *(.stabstr) }
.stab.excl 0 : { *(.stab.excl) }
.stab.exclstr 0 : { *(.stab.exclstr) }
.stab.index 0 : { *(.stab.index) }
.stab.indexstr 0 : { *(.stab.indexstr) }
.comment 0 : { *(.comment) }
.debug_abbrev 0 : { *(.debug_abbrev) }
.debug_info 0 : { *(.debug_info) }
.debug_line 0 : { *(.debug_line) }
.debug_pubnames 0 : { *(.debug_pubnames) }
.debug_aranges 0 : { *(.debug_aranges) }
}

View file

@ -1,66 +0,0 @@
/****************************************************************************
* boards/arm/samv7/same70-xplained/scripts/memory.ld
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/* The SAMe70Q21 has 2048Kb of FLASH beginning at address 0x0040:0000 and
* 384Kb of SRAM beginining at 0x2040:0000
*
* When booting from FLASH, FLASH memory is aliased to address 0x0000:0000
* where the code expects to begin execution by jumping to the entry point in
* the 0x0400:0000 address range.
*
* The user space partition will be spanned with a single region of size
* 2**n bytes. The alignment of the user-space region must be the same.
* As a consequence, as the user-space increases in size, the alignment
* requirement also increases. The sizes below give the largest possible
* user address spaces (but leave far too much for the OS).
*
* The solution to this wasted memory is to (1) use more than one region to
* span the user spaces, or (2) poke holes in a larger region to trim it
* to fit better.
*
* A detailed memory map for the 384KB SRAM region is as follows:
*
* 0x2040 0000: Kernel .data region. Typical size: 0.1KB
* ------ ---- Kernel .bss region. Typical size: 1.8KB
* 0x2040 0800: Kernel IDLE thread stack (approximate). Size is
* determined by CONFIG_IDLETHREAD_STACKSIZE and
* adjustments for alignment. Typical is 1KB.
* ------ ---- Padded to 4KB
* 0x2042 0000: User .data region. Size is variable.
* ------- ---- User .bss region Size is variable.
* 0x2044 0000: Beginning of kernel heap. Size determined by
* CONFIG_MM_KERNEL_HEAPSIZE.
* ------ ---- Beginning of user heap. Can vary with other settings.
* 0x2046 0000: End+1 of mappable internal SRAM
*/
MEMORY
{
/* 2048KiB of internal FLASH */
kflash (rx) : ORIGIN = 0x00400000, LENGTH = 1M
uflash (rx) : ORIGIN = 0x00500000, LENGTH = 1M
/* 384Kb of internal SRAM */
ksram (rwx) : ORIGIN = 0x20400000, LENGTH = 128K
usram (rwx) : ORIGIN = 0x20420000, LENGTH = 128K
xsram (rwx) : ORIGIN = 0x20440000, LENGTH = 128K
}

View file

@ -1,111 +0,0 @@
/****************************************************************************
* boards/arm/samv7/same70-xplained/scripts/user-space.ld
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/* NOTE: This depends on the memory.ld script having been included prior to
* this script.
*/
/* Make sure that the critical memory management functions are in user-space.
* the user heap memory manager will reside in user-space but be usable both
* by kernel- and user-space code
*/
EXTERN(umm_initialize)
EXTERN(umm_addregion)
EXTERN(malloc)
EXTERN(realloc)
EXTERN(zalloc)
EXTERN(free)
OUTPUT_ARCH(arm)
SECTIONS
{
.userspace : {
*(.userspace)
} > uflash
.text : {
_stext = ABSOLUTE(.);
*(.text .text.*)
*(.fixup)
*(.gnu.warning)
*(.rodata .rodata.*)
*(.gnu.linkonce.t.*)
*(.glue_7)
*(.glue_7t)
*(.got)
*(.gcc_except_table)
*(.gnu.linkonce.r.*)
_etext = ABSOLUTE(.);
} > uflash
.init_section : {
_sinit = ABSOLUTE(.);
*(.init_array .init_array.*)
_einit = ABSOLUTE(.);
} > uflash
.ARM.extab : {
*(.ARM.extab*)
} > uflash
__exidx_start = ABSOLUTE(.);
.ARM.exidx : {
*(.ARM.exidx*)
} > uflash
__exidx_end = ABSOLUTE(.);
_eronly = ABSOLUTE(.);
.data : {
_sdata = ABSOLUTE(.);
*(.data .data.*)
*(.gnu.linkonce.d.*)
CONSTRUCTORS
. = ALIGN(4);
_edata = ABSOLUTE(.);
} > usram AT > uflash
.bss : {
_sbss = ABSOLUTE(.);
*(.bss .bss.*)
*(.gnu.linkonce.b.*)
*(COMMON)
. = ALIGN(4);
_ebss = ABSOLUTE(.);
} > usram
/* Stabs debugging sections */
.stab 0 : { *(.stab) }
.stabstr 0 : { *(.stabstr) }
.stab.excl 0 : { *(.stab.excl) }
.stab.exclstr 0 : { *(.stab.exclstr) }
.stab.index 0 : { *(.stab.index) }
.stab.indexstr 0 : { *(.stab.indexstr) }
.comment 0 : { *(.comment) }
.debug_abbrev 0 : { *(.debug_abbrev) }
.debug_info 0 : { *(.debug_info) }
.debug_line 0 : { *(.debug_line) }
.debug_pubnames 0 : { *(.debug_pubnames) }
.debug_aranges 0 : { *(.debug_aranges) }
}

View file

@ -100,16 +100,18 @@ ifeq ($(CONFIG_IEEE802154_XBEE),y)
CSRCS += sam_xbee.c CSRCS += sam_xbee.c
endif endif
SCRIPTOUT = $(BOARD_DIR)$(DELIM)scripts$(DELIM)samv7.ld SCRIPTOUT = $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)samv7.ld
.PHONY = context distclean .PHONY = context distclean
$(SCRIPTOUT): $(LDSCRIPT_TEMPLATE) $(CONFIGFILE) $(SCRIPTOUT): $(LDSCRIPT_TEMPLATE) $(CONFIGFILE)
$(Q) $(CC) -isystem $(TOPDIR)/include -I $(BOARD_DIR)$(DELIM)scripts -C -P -x c -E $(LDSCRIPT_TEMPLATE) -o $@ $(Q) $(CC) -isystem $(TOPDIR)/include -I $(BOARD_COMMON_DIR)$(DELIM)scripts -C -P -x c -E $(LDSCRIPT_TEMPLATE) -o $@
context:: $(SCRIPTOUT) context:: $(SCRIPTOUT)
distclean:: distclean::
$(call DELFILE, $(SCRIPTOUT)) $(call DELFILE, $(SCRIPTOUT))
include $(TOPDIR)/boards/Board.mk DEPPATH += --dep-path board
VPATH += :board
CFLAGS += $(shell $(INCDIR) "$(CC)" $(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)board)

View file

@ -54,7 +54,7 @@
* Private Types * Private Types
****************************************************************************/ ****************************************************************************/
#if defined(CONFIG_SAME70XPLAINED_PROGMEM_OTA_PARTITION) #if defined(CONFIG_SAMV7_PROGMEM_OTA_PARTITION)
struct ota_partition_s struct ota_partition_s
{ {
@ -69,7 +69,7 @@ struct ota_partition_s
* Private Function Prototypes * Private Function Prototypes
****************************************************************************/ ****************************************************************************/
#if defined(CONFIG_SAME70XPLAINED_PROGMEM_OTA_PARTITION) #if defined(CONFIG_SAMV7_PROGMEM_OTA_PARTITION)
static struct mtd_dev_s *sam_progmem_alloc_mtdpart(uint32_t mtd_offset, static struct mtd_dev_s *sam_progmem_alloc_mtdpart(uint32_t mtd_offset,
uint32_t mtd_size); uint32_t mtd_size);
static int init_ota_partitions(void); static int init_ota_partitions(void);
@ -81,23 +81,23 @@ static int init_ota_partitions(void);
static FAR struct mtd_dev_s *g_samv7_progmem_mtd; static FAR struct mtd_dev_s *g_samv7_progmem_mtd;
#if defined(CONFIG_SAME70XPLAINED_PROGMEM_OTA_PARTITION) #if defined(CONFIG_SAMV7_PROGMEM_OTA_PARTITION)
static const struct ota_partition_s g_ota_partition_table[] = static const struct ota_partition_s g_ota_partition_table[] =
{ {
{ {
.offset = CONFIG_SAME70XPLAINED_OTA_PRIMARY_SLOT_OFFSET, .offset = CONFIG_SAMV7_OTA_PRIMARY_SLOT_OFFSET,
.size = CONFIG_SAME70XPLAINED_OTA_SLOT_SIZE, .size = CONFIG_SAMV7_OTA_SLOT_SIZE,
.devpath = CONFIG_SAME70XPLAINED_OTA_PRIMARY_SLOT_DEVPATH .devpath = CONFIG_SAMV7_OTA_PRIMARY_SLOT_DEVPATH
}, },
{ {
.offset = CONFIG_SAME70XPLAINED_OTA_SECONDARY_SLOT_OFFSET, .offset = CONFIG_SAMV7_OTA_SECONDARY_SLOT_OFFSET,
.size = CONFIG_SAME70XPLAINED_OTA_SLOT_SIZE, .size = CONFIG_SAMV7_OTA_SLOT_SIZE,
.devpath = CONFIG_SAME70XPLAINED_OTA_SECONDARY_SLOT_DEVPATH .devpath = CONFIG_SAMV7_OTA_SECONDARY_SLOT_DEVPATH
}, },
{ {
.offset = CONFIG_SAME70XPLAINED_OTA_SCRATCH_OFFSET, .offset = CONFIG_SAMV7_OTA_SCRATCH_OFFSET,
.size = CONFIG_SAME70XPLAINED_OTA_SCRATCH_SIZE, .size = CONFIG_SAMV7_OTA_SCRATCH_SIZE,
.devpath = CONFIG_SAME70XPLAINED_OTA_SCRATCH_DEVPATH .devpath = CONFIG_SAMV7_OTA_SCRATCH_DEVPATH
} }
}; };
#endif #endif
@ -106,7 +106,7 @@ static const struct ota_partition_s g_ota_partition_table[] =
* Private Functions * Private Functions
****************************************************************************/ ****************************************************************************/
#if defined(CONFIG_SAME70XPLAINED_PROGMEM_OTA_PARTITION) #if defined(CONFIG_SAMV7_PROGMEM_OTA_PARTITION)
/**************************************************************************** /****************************************************************************
* Name: sam_progmem_alloc_mtdpart * Name: sam_progmem_alloc_mtdpart
@ -225,7 +225,7 @@ int sam_progmem_init(void)
return -EFAULT; return -EFAULT;
} }
#if defined(CONFIG_SAME70XPLAINED_PROGMEM_OTA_PARTITION) #if defined(CONFIG_SAMV7_PROGMEM_OTA_PARTITION)
ret = init_ota_partitions(); ret = init_ota_partitions();
if (ret < 0) if (ret < 0)
{ {

View file

@ -1,13 +0,0 @@
#
# Atmel SAME70 Xplained evaluation kit.
# http://www.atmel.com/tools/ATSAME70-XPLD.aspx
#
# Connect using the EDBG chip on the dev kit over USB
source [find interface/cmsis-dap.cfg]
set CHIPNAME atsame70q21
source [find target/atsamv.cfg]
reset_config srst_only

View file

@ -1,57 +0,0 @@
#!/usr/bin/env bash
#
# See boards/atmel_same70_xplained.cfg/README.txt for information about
# this file.
TOPDIR=$1
USAGE="$0 <TOPDIR> [-d]"
if [ -z "${TOPDIR}" ]; then
echo "Missing argument"
echo $USAGE
exit 1
fi
# Assume that OpenOCD was installed and at /usr/local/bin. Uncomment
# the following to run directly from the build directory
# OPENOCD_PATH="/home/OpenOCD/openocd/src"
# OPENOCD_PATH="/usr/bin"
OPENOCD_PATH="/usr/local/bin"
# TARGET_PATH="/home/OpenOCD/openocd/tcl"
# TARGET_PATH="/usr/share/openocd/scripts"
TARGET_PATH="/usr/local/share/openocd/scripts"
# Assume a Unix development environment. Uncomment to use a Windows
# like environment
#OPENOCD_EXE=openocd.exe
OPENOCD_EXE=openocd
OPENOCD_CFG="${TOPDIR}/boards/arm/samv7/same70-xplained/tools/atmel_same70_xplained.cfg"
OPENOCD_ARGS="-f ${OPENOCD_CFG} -s ${TARGET_PATH}"
if [ "X$2" = "X-d" ]; then
OPENOCD_ARGS=$OPENOCD_ARGS" -d3"
set -x
fi
if [ ! -d ${OPENOCD_PATH} ]; then
echo "OpenOCD path does not exist: ${OPENOCD_PATH}"
exit 1
fi
if [ ! -x ${OPENOCD_PATH}/${OPENOCD_EXE} ]; then
echo "OpenOCD does not exist: ${OPENOCD_PATH}/${OPENOCD_EXE}"
exit 1
fi
if [ ! -f ${OPENOCD_CFG} ]; then
echo "OpenOCD config file does not exist: ${OPENOCD_CFG}"
exit 1
fi
echo "Starting OpenOCD"
cd ${OPENOCD_PATH} || { echo "Failed to CD to ${OPENOCD_PATH}"; exit 1; }
${OPENOCD_EXE} ${OPENOCD_ARGS} &
echo "OpenOCD daemon started"
ps -ef | grep openocd
echo "In GDB: target remote localhost:3333"

View file

@ -18,57 +18,4 @@
# #
############################################################################ ############################################################################
include $(TOPDIR)/.config include $(TOPDIR)/boards/arm/samv7/common/scripts/protected.memory
include $(TOPDIR)/tools/Config.mk
include $(TOPDIR)/arch/arm/src/armv7-m/Toolchain.defs
LDSCRIPT1 = memory.ld
LDSCRIPT2 = kernel-space.ld
ifeq ($(CONFIG_CYGWIN_WINTOOL),y)
ARCHSCRIPT = -T "${shell cygpath -w $(BOARD_DIR)$(DELIM)scripts$(DELIM)$(LDSCRIPT1)}"
ARCHSCRIPT += -T "${shell cygpath -w $(BOARD_DIR)$(DELIM)scripts$(DELIM)$(LDSCRIPT2)}"
else
ARCHSCRIPT = -T$(BOARD_DIR)$(DELIM)scripts$(DELIM)$(LDSCRIPT1)
ARCHSCRIPT += -T$(BOARD_DIR)$(DELIM)scripts$(DELIM)$(LDSCRIPT2)
endif
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
ARCHOPTIMIZATION = -g
endif
ifneq ($(CONFIG_DEBUG_NOOPT),y)
ARCHOPTIMIZATION += $(MAXOPTIMIZATION)
endif
ARCHCFLAGS = -fno-builtin
ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fcheck-new -fno-rtti
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef -fno-strict-aliasing
ARCHWARNINGSXX = -Wall -Wshadow -Wundef
ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
CFLAGS := $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe
CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
CXXFLAGS := $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe
CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
CPPFLAGS := $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS)
AFLAGS := $(CFLAGS) -D__ASSEMBLY__
NXFLATLDFLAGS1 = -r -d -warn-common
NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat-pcrel.ld -no-check-sections
LDNXFLATFLAGS = -e main -s 2048
# Loadable module definitions
CMODULEFLAGS = $(CFLAGS) -mlong-calls # --target1-abs
LDMODULEFLAGS = -r -e module_initialize
ifeq ($(CONFIG_CYGWIN_WINTOOL),y)
LDMODULEFLAGS += -T "${shell cygpath -w $(TOPDIR)/libs/libc/modlib/gnu-elf.ld}"
else
LDMODULEFLAGS += -T $(TOPDIR)/libs/libc/modlib/gnu-elf.ld
endif
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
LDFLAGS += -g
endif

View file

@ -31,16 +31,16 @@ ENTRYPT = $(patsubst "%",%,$(CONFIG_USER_ENTRYPOINT))
ifeq ($(CONFIG_CYGWIN_WINTOOL),y) ifeq ($(CONFIG_CYGWIN_WINTOOL),y)
# Windows-native toolchains # Windows-native toolchains
USER_LIBPATHS = ${shell for path in $(USERLIBS); do dir=`dirname $(TOPDIR)$(DELIM)$$path`;echo "-L\"`cygpath -w $$dir`\"";done} USER_LIBPATHS = ${shell for path in $(USERLIBS); do dir=`dirname $(TOPDIR)$(DELIM)$$path`;echo "-L\"`cygpath -w $$dir`\"";done}
USER_LDSCRIPT = -T "${shell cygpath -w $(BOARD_DIR)$(DELIM)scripts$(DELIM)memory.ld}" USER_LDSCRIPT = -T "${shell cygpath -w $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)memory.ld}"
USER_LDSCRIPT += -T "${shell cygpath -w $(BOARD_DIR)$(DELIM)scripts$(DELIM)user-space.ld}" USER_LDSCRIPT += -T "${shell cygpath -w $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)user-space.ld}"
USER_HEXFILE += "${shell cygpath -w $(TOPDIR)$(DELIM)nuttx_user.hex}" USER_HEXFILE += "${shell cygpath -w $(TOPDIR)$(DELIM)nuttx_user.hex}"
USER_SRECFILE += "${shell cygpath -w $(TOPDIR)$(DELIM)nuttx_user.srec}" USER_SRECFILE += "${shell cygpath -w $(TOPDIR)$(DELIM)nuttx_user.srec}"
USER_BINFILE += "${shell cygpath -w $(TOPDIR)$(DELIM)nuttx_user.bin}" USER_BINFILE += "${shell cygpath -w $(TOPDIR)$(DELIM)nuttx_user.bin}"
else else
# Linux/Cygwin-native toolchain # Linux/Cygwin-native toolchain
USER_LIBPATHS = $(addprefix -L$(TOPDIR)$(DELIM),$(dir $(USERLIBS))) USER_LIBPATHS = $(addprefix -L$(TOPDIR)$(DELIM),$(dir $(USERLIBS)))
USER_LDSCRIPT = -T$(BOARD_DIR)$(DELIM)scripts$(DELIM)memory.ld USER_LDSCRIPT = -T$(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)memory.ld
USER_LDSCRIPT += -T$(BOARD_DIR)$(DELIM)scripts$(DELIM)user-space.ld USER_LDSCRIPT += -T$(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)user-space.ld
USER_HEXFILE += "$(TOPDIR)$(DELIM)nuttx_user.hex" USER_HEXFILE += "$(TOPDIR)$(DELIM)nuttx_user.hex"
USER_SRECFILE += "$(TOPDIR)$(DELIM)nuttx_user.srec" USER_SRECFILE += "$(TOPDIR)$(DELIM)nuttx_user.srec"
USER_BINFILE += "$(TOPDIR)$(DELIM)nuttx_user.bin" USER_BINFILE += "$(TOPDIR)$(DELIM)nuttx_user.bin"

View file

@ -18,55 +18,4 @@
# #
############################################################################ ############################################################################
include $(TOPDIR)/.config include $(TOPDIR)/boards/arm/samv7/common/scripts/flat.memory
include $(TOPDIR)/tools/Config.mk
include $(TOPDIR)/arch/arm/src/armv7-m/Toolchain.defs
LDSCRIPT_TEMPLATE = $(BOARD_DIR)$(DELIM)scripts$(DELIM)flash.template.ld
LDSCRIPT = samv7.ld
ifeq ($(CONFIG_CYGWIN_WINTOOL),y)
ARCHSCRIPT = -T "${shell cygpath -w $(BOARD_DIR)$(DELIM)scripts$(DELIM)$(LDSCRIPT)}"
else
ARCHSCRIPT = -T$(BOARD_DIR)$(DELIM)scripts$(DELIM)$(LDSCRIPT)
endif
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
ARCHOPTIMIZATION = -g
endif
ifneq ($(CONFIG_DEBUG_NOOPT),y)
ARCHOPTIMIZATION += $(MAXOPTIMIZATION)
endif
ARCHCFLAGS = -fno-builtin
ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fcheck-new -fno-rtti
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef -fno-strict-aliasing
ARCHWARNINGSXX = -Wall -Wshadow -Wundef
ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
CFLAGS := $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe
CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
CXXFLAGS := $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe
CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
CPPFLAGS := $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS)
AFLAGS := $(CFLAGS) -D__ASSEMBLY__
NXFLATLDFLAGS1 = -r -d -warn-common
NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat-pcrel.ld -no-check-sections
LDNXFLATFLAGS = -e main -s 2048
# Loadable module definitions
CMODULEFLAGS = $(CFLAGS) -mlong-calls # --target1-abs
LDMODULEFLAGS = -r -e module_initialize
ifeq ($(CONFIG_CYGWIN_WINTOOL),y)
LDMODULEFLAGS += -T "${shell cygpath -w $(TOPDIR)/libs/libc/modlib/gnu-elf.ld}"
else
LDMODULEFLAGS += -T $(TOPDIR)/libs/libc/modlib/gnu-elf.ld
endif
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
LDFLAGS += -g
endif

View file

@ -1,119 +0,0 @@
/****************************************************************************
* boards/arm/samv7/samv71-xult/scripts/flash.template.ld
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
#include <nuttx/config.h>
#define FLASH_START_ADDR 0x00400000
#ifdef CONFIG_ARMV7M_DTCM
# define SRAM_START_ADDR 0x20000000
#else
# define SRAM_START_ADDR 0x20400000
#endif
#define FLASH_OFFSET 0
#define FLASH_IMG_SIZE CONFIG_ARCH_CHIP_SAMV7_MEM_FLASH
MEMORY
{
flash (rx) : ORIGIN = FLASH_START_ADDR + FLASH_OFFSET, LENGTH = FLASH_IMG_SIZE
sram (rwx) : ORIGIN = SRAM_START_ADDR, LENGTH = CONFIG_ARCH_CHIP_SAMV7_MEM_RAM
}
OUTPUT_ARCH(arm)
EXTERN(_vectors)
ENTRY(_stext)
SECTIONS
{
.text : {
_stext = ABSOLUTE(.);
*(.vectors)
*(.text .text.*)
*(.fixup)
*(.gnu.warning)
*(.rodata .rodata.*)
*(.gnu.linkonce.t.*)
*(.glue_7)
*(.glue_7t)
*(.got)
*(.gcc_except_table)
*(.gnu.linkonce.r.*)
_etext = ABSOLUTE(.);
} > flash
.init_section : {
_sinit = ABSOLUTE(.);
*(.init_array .init_array.*)
_einit = ABSOLUTE(.);
} > flash
.ARM.extab : {
*(.ARM.extab*)
} > flash
__exidx_start = ABSOLUTE(.);
.ARM.exidx : {
*(.ARM.exidx*)
} > flash
__exidx_end = ABSOLUTE(.);
_eronly = ABSOLUTE(.);
.data : {
_sdata = ABSOLUTE(.);
*(.data .data.*)
*(.gnu.linkonce.d.*)
CONSTRUCTORS
. = ALIGN(4);
_edata = ABSOLUTE(.);
} > sram AT > flash
.ramfunc ALIGN(4): {
_sramfuncs = ABSOLUTE(.);
*(.ramfunc .ramfunc.*)
_eramfuncs = ABSOLUTE(.);
} > sram AT > flash
_framfuncs = LOADADDR(.ramfunc);
.bss : {
_sbss = ABSOLUTE(.);
*(.bss .bss.*)
*(.gnu.linkonce.b.*)
*(COMMON)
. = ALIGN(4);
_ebss = ABSOLUTE(.);
} > sram
/* Stabs debugging sections. */
.stab 0 : { *(.stab) }
.stabstr 0 : { *(.stabstr) }
.stab.excl 0 : { *(.stab.excl) }
.stab.exclstr 0 : { *(.stab.exclstr) }
.stab.index 0 : { *(.stab.index) }
.stab.indexstr 0 : { *(.stab.indexstr) }
.comment 0 : { *(.comment) }
.debug_abbrev 0 : { *(.debug_abbrev) }
.debug_info 0 : { *(.debug_info) }
.debug_line 0 : { *(.debug_line) }
.debug_pubnames 0 : { *(.debug_pubnames) }
.debug_aranges 0 : { *(.debug_aranges) }
}

View file

@ -114,16 +114,18 @@ ifeq ($(CONFIG_LCD_ST7789),y)
CSRCS += sam_st7789.c CSRCS += sam_st7789.c
endif endif
SCRIPTOUT = $(BOARD_DIR)$(DELIM)scripts$(DELIM)samv7.ld SCRIPTOUT = $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)samv7.ld
.PHONY = context distclean .PHONY = context distclean
$(SCRIPTOUT): $(LDSCRIPT_TEMPLATE) $(CONFIGFILE) $(SCRIPTOUT): $(LDSCRIPT_TEMPLATE) $(CONFIGFILE)
$(Q) $(CC) -isystem $(TOPDIR)/include -I $(BOARD_DIR)$(DELIM)scripts -C -P -x c -E $(LDSCRIPT_TEMPLATE) -o $@ $(Q) $(CC) -isystem $(TOPDIR)/include -I $(BOARD_COMMON_DIR)$(DELIM)scripts -C -P -x c -E $(LDSCRIPT_TEMPLATE) -o $@
context:: $(SCRIPTOUT) context:: $(SCRIPTOUT)
distclean:: distclean::
$(call DELFILE, $(SCRIPTOUT)) $(call DELFILE, $(SCRIPTOUT))
include $(TOPDIR)/boards/Board.mk DEPPATH += --dep-path board
VPATH += :board
CFLAGS += $(shell $(INCDIR) "$(CC)" $(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)board)