This is an automated email from the ASF dual-hosted git repository. acassis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit b5868aed6ff1ae285fadb6cb3dc5f61f3d1ef0c9 Author: Gerson Fernando Budke <[email protected]> AuthorDate: Sat Dec 11 20:51:31 2021 -0300 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 <[email protected]> --- boards/Kconfig | 3 + .../samv7/{same70-xplained => common}/.gitignore | 0 boards/arm/samv7/common/Kconfig | 84 +++++++++++++ boards/arm/samv7/common/Makefile | 33 ++++++ .../{samv71-xult => common}/scripts/Make.defs | 21 ++-- .../scripts/flat-template.ld} | 12 +- boards/arm/samv7/common/scripts/flat.memory | 31 +++++ .../{samv71-xult => common}/scripts/gnu-elf.ld | 2 +- .../scripts/kernel-space.ld | 2 +- .../{samv71-xult => common}/scripts/memory.ld | 6 +- boards/arm/samv7/common/scripts/protected.memory | 36 ++++++ .../{samv71-xult => common}/scripts/user-space.ld | 2 +- boards/arm/samv7/common/src/Make.defs | 23 ++++ .../tools/atmel-same70-qmtech.cfg} | 1 - .../tools/atmel-same70-xplained.cfg} | 0 .../tools/atmel-samv71-xult.cfg} | 6 +- .../samv7/{same70-qmtech => common}/tools/oocd.sh | 5 +- boards/arm/samv7/same70-qmtech/.gitignore | 1 - boards/arm/samv7/same70-qmtech/Kconfig | 61 ---------- boards/arm/samv7/same70-qmtech/README.txt | 3 +- .../configs/mcuboot-confirm/defconfig | 3 +- .../same70-qmtech/configs/mcuboot-loader/defconfig | 4 +- boards/arm/samv7/same70-qmtech/kernel/Makefile | 8 +- boards/arm/samv7/same70-qmtech/scripts/Make.defs | 53 +-------- boards/arm/samv7/same70-qmtech/scripts/gnu-elf.ld | 115 ------------------ .../samv7/same70-qmtech/scripts/kernel-space.ld | 106 ----------------- boards/arm/samv7/same70-qmtech/scripts/memory.ld | 66 ----------- .../arm/samv7/same70-qmtech/scripts/user-space.ld | 111 ------------------ .../same70-qmtech/src/{Makefile => Make.defs} | 8 +- boards/arm/samv7/same70-qmtech/src/sam_progmem.c | 28 ++--- boards/arm/samv7/same70-xplained/Kconfig | 61 ---------- boards/arm/samv7/same70-xplained/README.txt | 11 +- .../configs/mcuboot-confirm/defconfig | 4 +- .../configs/mcuboot-loader/defconfig | 5 +- boards/arm/samv7/same70-xplained/kernel/Makefile | 8 +- boards/arm/samv7/same70-xplained/scripts/Make.defs | 53 +-------- .../same70-xplained/scripts/flash.template.ld | 130 --------------------- .../arm/samv7/same70-xplained/scripts/gnu-elf.ld | 115 ------------------ .../samv7/same70-xplained/scripts/kernel-space.ld | 106 ----------------- boards/arm/samv7/same70-xplained/scripts/memory.ld | 66 ----------- .../samv7/same70-xplained/scripts/user-space.ld | 111 ------------------ .../same70-xplained/src/{Makefile => Make.defs} | 8 +- boards/arm/samv7/same70-xplained/src/sam_progmem.c | 28 ++--- .../tools/atmel_same70_xplained.cfg | 13 --- boards/arm/samv7/same70-xplained/tools/oocd.sh | 57 --------- .../arm/samv7/samv71-xult/configs/knsh/Make.defs | 55 +-------- boards/arm/samv7/samv71-xult/kernel/Makefile | 8 +- boards/arm/samv7/samv71-xult/scripts/Make.defs | 53 +-------- .../samv7/samv71-xult/scripts/flash.template.ld | 119 ------------------- .../samv7/samv71-xult/src/{Makefile => Make.defs} | 8 +- 50 files changed, 306 insertions(+), 1547 deletions(-) diff --git a/boards/Kconfig b/boards/Kconfig index ec86157..a4b10ff 100644 --- a/boards/Kconfig +++ b/boards/Kconfig @@ -3326,6 +3326,9 @@ endif comment "Board-Common Options" +if ARCH_CHIP_SAMV7 +source "boards/arm/samv7/common/Kconfig" +endif if ARCH_CHIP_STM32 source "boards/arm/stm32/common/Kconfig" endif diff --git a/boards/arm/samv7/same70-xplained/.gitignore b/boards/arm/samv7/common/.gitignore similarity index 100% rename from boards/arm/samv7/same70-xplained/.gitignore rename to boards/arm/samv7/common/.gitignore diff --git a/boards/arm/samv7/common/Kconfig b/boards/arm/samv7/common/Kconfig new file mode 100644 index 0000000..fd23631 --- /dev/null +++ b/boards/arm/samv7/common/Kconfig @@ -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 diff --git a/boards/arm/samv7/common/Makefile b/boards/arm/samv7/common/Makefile new file mode 100644 index 0000000..00ea9fc --- /dev/null +++ b/boards/arm/samv7/common/Makefile @@ -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) diff --git a/boards/arm/samv7/samv71-xult/scripts/Make.defs b/boards/arm/samv7/common/scripts/Make.defs similarity index 85% copy from boards/arm/samv7/samv71-xult/scripts/Make.defs copy to boards/arm/samv7/common/scripts/Make.defs index 2a008ad..f40b615 100644 --- a/boards/arm/samv7/samv71-xult/scripts/Make.defs +++ b/boards/arm/samv7/common/scripts/Make.defs @@ -1,5 +1,5 @@ ############################################################################ -# boards/arm/samv7/samv71-xult/scripts/Make.defs +# 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 @@ -18,17 +18,10 @@ # ############################################################################ -include $(TOPDIR)/.config -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)}" +ifneq ($(wildcard $(BOARD_DIR)$(DELIM)scripts$(DELIM)flat-template.ld),) + LDSCRIPT_TEMPLATE = $(BOARD_DIR)$(DELIM)scripts$(DELIM)flat-template.ld else - ARCHSCRIPT = -T$(BOARD_DIR)$(DELIM)scripts$(DELIM)$(LDSCRIPT) + LDSCRIPT_TEMPLATE = $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)flat-template.ld endif ifeq ($(CONFIG_DEBUG_SYMBOLS),y) @@ -67,6 +60,12 @@ 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 diff --git a/boards/arm/samv7/same70-qmtech/scripts/flash.template.ld b/boards/arm/samv7/common/scripts/flat-template.ld similarity index 89% rename from boards/arm/samv7/same70-qmtech/scripts/flash.template.ld rename to boards/arm/samv7/common/scripts/flat-template.ld index f280071..40ae9b0 100644 --- a/boards/arm/samv7/same70-qmtech/scripts/flash.template.ld +++ b/boards/arm/samv7/common/scripts/flat-template.ld @@ -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 * contributor license agreements. See the NOTICE file distributed with @@ -28,14 +28,14 @@ # define SRAM_START_ADDR 0x20400000 #endif -#ifdef CONFIG_SAME70QMTECH_FORMAT_MCUBOOT -# define MCUBOOT_HEADER_SIZE 0x200 +#ifdef CONFIG_SAMV7_FORMAT_MCUBOOT +# define MCUBOOT_HEADER_SIZE CONFIG_SAMV7_MCUBOOT_HEADER_SIZE # ifdef CONFIG_BOARDCTL_BOOT_IMAGE # 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 -# define FLASH_OFFSET (CONFIG_SAME70QMTECH_OTA_PRIMARY_SLOT_OFFSET + MCUBOOT_HEADER_SIZE) -# define FLASH_IMG_SIZE (CONFIG_SAME70QMTECH_OTA_SLOT_SIZE - MCUBOOT_HEADER_SIZE) +# define FLASH_OFFSET (CONFIG_SAMV7_OTA_PRIMARY_SLOT_OFFSET + MCUBOOT_HEADER_SIZE) +# define FLASH_IMG_SIZE (CONFIG_SAMV7_OTA_SLOT_SIZE - MCUBOOT_HEADER_SIZE) # endif #else # define FLASH_OFFSET 0 diff --git a/boards/arm/samv7/common/scripts/flat.memory b/boards/arm/samv7/common/scripts/flat.memory new file mode 100644 index 0000000..d3e428f --- /dev/null +++ b/boards/arm/samv7/common/scripts/flat.memory @@ -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 diff --git a/boards/arm/samv7/samv71-xult/scripts/gnu-elf.ld b/boards/arm/samv7/common/scripts/gnu-elf.ld similarity index 98% rename from boards/arm/samv7/samv71-xult/scripts/gnu-elf.ld rename to boards/arm/samv7/common/scripts/gnu-elf.ld index d5ba8f5..bda1b92 100644 --- a/boards/arm/samv7/samv71-xult/scripts/gnu-elf.ld +++ b/boards/arm/samv7/common/scripts/gnu-elf.ld @@ -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 * contributor license agreements. See the NOTICE file distributed with diff --git a/boards/arm/samv7/samv71-xult/scripts/kernel-space.ld b/boards/arm/samv7/common/scripts/kernel-space.ld similarity index 98% rename from boards/arm/samv7/samv71-xult/scripts/kernel-space.ld rename to boards/arm/samv7/common/scripts/kernel-space.ld index e5ffc00..03cea6d 100644 --- a/boards/arm/samv7/samv71-xult/scripts/kernel-space.ld +++ b/boards/arm/samv7/common/scripts/kernel-space.ld @@ -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 * contributor license agreements. See the NOTICE file distributed with diff --git a/boards/arm/samv7/samv71-xult/scripts/memory.ld b/boards/arm/samv7/common/scripts/memory.ld similarity index 94% rename from boards/arm/samv7/samv71-xult/scripts/memory.ld rename to boards/arm/samv7/common/scripts/memory.ld index ae23b02..92da7ec 100644 --- a/boards/arm/samv7/samv71-xult/scripts/memory.ld +++ b/boards/arm/samv7/common/scripts/memory.ld @@ -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 * 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 - * 384Kb of SRAM beginining at 0x2040:0000 +/* The SAMV7 can have up to 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 diff --git a/boards/arm/samv7/common/scripts/protected.memory b/boards/arm/samv7/common/scripts/protected.memory new file mode 100644 index 0000000..4bc5df5 --- /dev/null +++ b/boards/arm/samv7/common/scripts/protected.memory @@ -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 diff --git a/boards/arm/samv7/samv71-xult/scripts/user-space.ld b/boards/arm/samv7/common/scripts/user-space.ld similarity index 98% rename from boards/arm/samv7/samv71-xult/scripts/user-space.ld rename to boards/arm/samv7/common/scripts/user-space.ld index edd0150..55c737f 100644 --- a/boards/arm/samv7/samv71-xult/scripts/user-space.ld +++ b/boards/arm/samv7/common/scripts/user-space.ld @@ -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 * contributor license agreements. See the NOTICE file distributed with diff --git a/boards/arm/samv7/common/src/Make.defs b/boards/arm/samv7/common/src/Make.defs new file mode 100644 index 0000000..ea09c16 --- /dev/null +++ b/boards/arm/samv7/common/src/Make.defs @@ -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) diff --git a/boards/arm/samv7/same70-qmtech/tools/atmel_same70_qmtech.cfg b/boards/arm/samv7/common/tools/atmel-same70-qmtech.cfg similarity index 99% rename from boards/arm/samv7/same70-qmtech/tools/atmel_same70_qmtech.cfg rename to boards/arm/samv7/common/tools/atmel-same70-qmtech.cfg index db63edd..4c2cbfb 100644 --- a/boards/arm/samv7/same70-qmtech/tools/atmel_same70_qmtech.cfg +++ b/boards/arm/samv7/common/tools/atmel-same70-qmtech.cfg @@ -3,7 +3,6 @@ # https://github.com/ChinaQMTECH/ATSAMS70_E70 # # Connect using the EDBG chip on the dev kit over USB - source [find interface/cmsis-dap.cfg] set CHIPNAME atsame70n19 diff --git a/boards/arm/samv7/same70-xplained/scripts/atmel_same70_xplained.cfg b/boards/arm/samv7/common/tools/atmel-same70-xplained.cfg similarity index 100% rename from boards/arm/samv7/same70-xplained/scripts/atmel_same70_xplained.cfg rename to boards/arm/samv7/common/tools/atmel-same70-xplained.cfg diff --git a/boards/arm/samv7/same70-qmtech/scripts/atmel_same70_qmtech.cfg b/boards/arm/samv7/common/tools/atmel-samv71-xult.cfg similarity index 56% rename from boards/arm/samv7/same70-qmtech/scripts/atmel_same70_qmtech.cfg rename to boards/arm/samv7/common/tools/atmel-samv71-xult.cfg index e986e6b..ca34007 100644 --- a/boards/arm/samv7/same70-qmtech/scripts/atmel_same70_qmtech.cfg +++ b/boards/arm/samv7/common/tools/atmel-samv71-xult.cfg @@ -1,11 +1,11 @@ # -# Atmel SAME70 QMTECH board. -# https://github.com/ChinaQMTECH/ATSAMS70_E70 +# Atmel SAMV71 Xplained Ultra evaluation kit. +# http://www.atmel.com/tools/ATSAMV71-XULT.aspx # # Connect using the EDBG chip on the dev kit over USB source [find interface/cmsis-dap.cfg] -set CHIPNAME atsame70n19 +set CHIPNAME atsamv71q21 source [find target/atsamv.cfg] diff --git a/boards/arm/samv7/same70-qmtech/tools/oocd.sh b/boards/arm/samv7/common/tools/oocd.sh similarity index 88% rename from boards/arm/samv7/same70-qmtech/tools/oocd.sh rename to boards/arm/samv7/common/tools/oocd.sh index 6147ec9..1199cd5 100755 --- a/boards/arm/samv7/same70-qmtech/tools/oocd.sh +++ b/boards/arm/samv7/common/tools/oocd.sh @@ -1,7 +1,6 @@ #!/usr/bin/env bash # -# See boards/atmel_same70_qmtech.cfg/README.txt for information about -# this file. +# See boards README.txt for information about this file. TOPDIR=$1 USAGE="$0 <TOPDIR> [-d]" @@ -28,7 +27,7 @@ TARGET_PATH="/usr/local/share/openocd/scripts" #OPENOCD_EXE=openocd.exe 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}" if [ "X$2" = "X-d" ]; then diff --git a/boards/arm/samv7/same70-qmtech/.gitignore b/boards/arm/samv7/same70-qmtech/.gitignore deleted file mode 100644 index a5638cb..0000000 --- a/boards/arm/samv7/same70-qmtech/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/scripts/samv7.ld diff --git a/boards/arm/samv7/same70-qmtech/Kconfig b/boards/arm/samv7/same70-qmtech/Kconfig index 0c665f6..039ea47 100644 --- a/boards/arm/samv7/same70-qmtech/Kconfig +++ b/boards/arm/samv7/same70-qmtech/Kconfig @@ -34,65 +34,4 @@ config SAME70QMTECH_HSMCI0_AUTOMOUNT_UDELAY 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 diff --git a/boards/arm/samv7/same70-qmtech/README.txt b/boards/arm/samv7/same70-qmtech/README.txt index 294f7ca..427078d 100644 --- a/boards/arm/samv7/same70-qmtech/README.txt +++ b/boards/arm/samv7/same70-qmtech/README.txt @@ -794,8 +794,7 @@ Configuration sub-directories CONFIG_MCUBOOT_BOOTLOADER=y CONFIG_MCUBOOT_ENABLE_LOGGING=y - CONFIG_SAME70QMTECH_FORMAT_MCUBOOT=y - CONFIG_SAME70QMTECH_MCUBOOT_BOOTLOADER=y + CONFIG_SAMV7_FORMAT_MCUBOOT=y CONFIG_USER_ENTRYPOINT="mcuboot_loader_main" mcuboot-confirm: diff --git a/boards/arm/samv7/same70-qmtech/configs/mcuboot-confirm/defconfig b/boards/arm/samv7/same70-qmtech/configs/mcuboot-confirm/defconfig index d27f7b5..0b848a6 100644 --- a/boards/arm/samv7/same70-qmtech/configs/mcuboot-confirm/defconfig +++ b/boards/arm/samv7/same70-qmtech/configs/mcuboot-confirm/defconfig @@ -45,12 +45,11 @@ CONFIG_RAM_SIZE=262144 CONFIG_RAM_START=0x20400000 CONFIG_RAW_BINARY=y CONFIG_RR_INTERVAL=200 -CONFIG_SAME70QMTECH_FORMAT_MCUBOOT=y +CONFIG_SAMV7_FORMAT_MCUBOOT=y CONFIG_SAMV7_GPIOA_IRQ=y CONFIG_SAMV7_GPIOD_IRQ=y CONFIG_SAMV7_GPIO_IRQ=y CONFIG_SAMV7_HSMCI0=y -CONFIG_SAMV7_PROGMEM=y CONFIG_SAMV7_USART1=y CONFIG_SAMV7_XDMAC=y CONFIG_SCHED_HPWORK=y diff --git a/boards/arm/samv7/same70-qmtech/configs/mcuboot-loader/defconfig b/boards/arm/samv7/same70-qmtech/configs/mcuboot-loader/defconfig index 9e15549..ec31b08 100644 --- a/boards/arm/samv7/same70-qmtech/configs/mcuboot-loader/defconfig +++ b/boards/arm/samv7/same70-qmtech/configs/mcuboot-loader/defconfig @@ -46,13 +46,11 @@ CONFIG_RAM_SIZE=262144 CONFIG_RAM_START=0x20400000 CONFIG_RAW_BINARY=y CONFIG_RR_INTERVAL=200 -CONFIG_SAME70QMTECH_FORMAT_MCUBOOT=y -CONFIG_SAME70QMTECH_MCUBOOT_BOOTLOADER=y +CONFIG_SAMV7_FORMAT_MCUBOOT=y CONFIG_SAMV7_GPIOA_IRQ=y CONFIG_SAMV7_GPIOD_IRQ=y CONFIG_SAMV7_GPIO_IRQ=y CONFIG_SAMV7_HSMCI0=y -CONFIG_SAMV7_PROGMEM=y CONFIG_SAMV7_USART1=y CONFIG_SAMV7_XDMAC=y CONFIG_SCHED_HPWORK=y diff --git a/boards/arm/samv7/same70-qmtech/kernel/Makefile b/boards/arm/samv7/same70-qmtech/kernel/Makefile index 95f8c76..1cf8976 100644 --- a/boards/arm/samv7/same70-qmtech/kernel/Makefile +++ b/boards/arm/samv7/same70-qmtech/kernel/Makefile @@ -31,16 +31,16 @@ ENTRYPT = $(patsubst "%",%,$(CONFIG_USER_ENTRYPOINT)) ifeq ($(CONFIG_CYGWIN_WINTOOL),y) # Windows-native toolchains 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_DIR)$(DELIM)scripts$(DELIM)user-space.ld}" + USER_LDSCRIPT = -T "${shell cygpath -w $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)memory.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_SRECFILE += "${shell cygpath -w $(TOPDIR)$(DELIM)nuttx_user.srec}" USER_BINFILE += "${shell cygpath -w $(TOPDIR)$(DELIM)nuttx_user.bin}" else # Linux/Cygwin-native toolchain USER_LIBPATHS = $(addprefix -L$(TOPDIR)$(DELIM),$(dir $(USERLIBS))) - USER_LDSCRIPT = -T$(BOARD_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)memory.ld + USER_LDSCRIPT += -T$(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)user-space.ld USER_HEXFILE += "$(TOPDIR)$(DELIM)nuttx_user.hex" USER_SRECFILE += "$(TOPDIR)$(DELIM)nuttx_user.srec" USER_BINFILE += "$(TOPDIR)$(DELIM)nuttx_user.bin" diff --git a/boards/arm/samv7/same70-qmtech/scripts/Make.defs b/boards/arm/samv7/same70-qmtech/scripts/Make.defs index 8a764e6..888c23f 100644 --- a/boards/arm/samv7/same70-qmtech/scripts/Make.defs +++ b/boards/arm/samv7/same70-qmtech/scripts/Make.defs @@ -18,55 +18,4 @@ # ############################################################################ -include $(TOPDIR)/.config -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 +include $(TOPDIR)/boards/arm/samv7/common/scripts/flat.memory diff --git a/boards/arm/samv7/same70-qmtech/scripts/gnu-elf.ld b/boards/arm/samv7/same70-qmtech/scripts/gnu-elf.ld deleted file mode 100644 index a904824..0000000 --- a/boards/arm/samv7/same70-qmtech/scripts/gnu-elf.ld +++ /dev/null @@ -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) } -} diff --git a/boards/arm/samv7/same70-qmtech/scripts/kernel-space.ld b/boards/arm/samv7/same70-qmtech/scripts/kernel-space.ld deleted file mode 100644 index 6362cd8..0000000 --- a/boards/arm/samv7/same70-qmtech/scripts/kernel-space.ld +++ /dev/null @@ -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) } -} diff --git a/boards/arm/samv7/same70-qmtech/scripts/memory.ld b/boards/arm/samv7/same70-qmtech/scripts/memory.ld deleted file mode 100644 index 9e33168..0000000 --- a/boards/arm/samv7/same70-qmtech/scripts/memory.ld +++ /dev/null @@ -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 -} diff --git a/boards/arm/samv7/same70-qmtech/scripts/user-space.ld b/boards/arm/samv7/same70-qmtech/scripts/user-space.ld deleted file mode 100644 index 8c08dfc..0000000 --- a/boards/arm/samv7/same70-qmtech/scripts/user-space.ld +++ /dev/null @@ -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) } -} diff --git a/boards/arm/samv7/same70-qmtech/src/Makefile b/boards/arm/samv7/same70-qmtech/src/Make.defs similarity index 85% rename from boards/arm/samv7/same70-qmtech/src/Makefile rename to boards/arm/samv7/same70-qmtech/src/Make.defs index 8783c64..567a1c4 100644 --- a/boards/arm/samv7/same70-qmtech/src/Makefile +++ b/boards/arm/samv7/same70-qmtech/src/Make.defs @@ -68,16 +68,18 @@ ifneq (,$(findstring y,$(CONFIG_SAMV7_DAC0) $(CONFIG_SAMV7_DAC1))) CSRCS += sam_dac.c endif -SCRIPTOUT = $(BOARD_DIR)$(DELIM)scripts$(DELIM)samv7.ld +SCRIPTOUT = $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)samv7.ld .PHONY = context distclean $(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) distclean:: $(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) diff --git a/boards/arm/samv7/same70-qmtech/src/sam_progmem.c b/boards/arm/samv7/same70-qmtech/src/sam_progmem.c index e6d6a60..6ff222e 100644 --- a/boards/arm/samv7/same70-qmtech/src/sam_progmem.c +++ b/boards/arm/samv7/same70-qmtech/src/sam_progmem.c @@ -54,7 +54,7 @@ * Private Types ****************************************************************************/ -#if defined(CONFIG_SAME70QMTECH_PROGMEM_OTA_PARTITION) +#if defined(CONFIG_SAMV7_PROGMEM_OTA_PARTITION) struct ota_partition_s { @@ -69,7 +69,7 @@ struct ota_partition_s * 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, uint32_t mtd_size); 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; -#if defined(CONFIG_SAME70QMTECH_PROGMEM_OTA_PARTITION) +#if defined(CONFIG_SAMV7_PROGMEM_OTA_PARTITION) static const struct ota_partition_s g_ota_partition_table[] = { { - .offset = CONFIG_SAME70QMTECH_OTA_PRIMARY_SLOT_OFFSET, - .size = CONFIG_SAME70QMTECH_OTA_SLOT_SIZE, - .devpath = CONFIG_SAME70QMTECH_OTA_PRIMARY_SLOT_DEVPATH + .offset = CONFIG_SAMV7_OTA_PRIMARY_SLOT_OFFSET, + .size = CONFIG_SAMV7_OTA_SLOT_SIZE, + .devpath = CONFIG_SAMV7_OTA_PRIMARY_SLOT_DEVPATH }, { - .offset = CONFIG_SAME70QMTECH_OTA_SECONDARY_SLOT_OFFSET, - .size = CONFIG_SAME70QMTECH_OTA_SLOT_SIZE, - .devpath = CONFIG_SAME70QMTECH_OTA_SECONDARY_SLOT_DEVPATH + .offset = CONFIG_SAMV7_OTA_SECONDARY_SLOT_OFFSET, + .size = CONFIG_SAMV7_OTA_SLOT_SIZE, + .devpath = CONFIG_SAMV7_OTA_SECONDARY_SLOT_DEVPATH }, { - .offset = CONFIG_SAME70QMTECH_OTA_SCRATCH_OFFSET, - .size = CONFIG_SAME70QMTECH_OTA_SCRATCH_SIZE, - .devpath = CONFIG_SAME70QMTECH_OTA_SCRATCH_DEVPATH + .offset = CONFIG_SAMV7_OTA_SCRATCH_OFFSET, + .size = CONFIG_SAMV7_OTA_SCRATCH_SIZE, + .devpath = CONFIG_SAMV7_OTA_SCRATCH_DEVPATH } }; #endif @@ -106,7 +106,7 @@ static const struct ota_partition_s g_ota_partition_table[] = * Private Functions ****************************************************************************/ -#if defined(CONFIG_SAME70QMTECH_PROGMEM_OTA_PARTITION) +#if defined(CONFIG_SAMV7_PROGMEM_OTA_PARTITION) /**************************************************************************** * Name: sam_progmem_alloc_mtdpart @@ -225,7 +225,7 @@ int sam_progmem_init(void) return -EFAULT; } -#if defined(CONFIG_SAME70QMTECH_PROGMEM_OTA_PARTITION) +#if defined(CONFIG_SAMV7_PROGMEM_OTA_PARTITION) ret = init_ota_partitions(); if (ret < 0) { diff --git a/boards/arm/samv7/same70-xplained/Kconfig b/boards/arm/samv7/same70-xplained/Kconfig index 78a74bb..dd3d2f0b 100644 --- a/boards/arm/samv7/same70-xplained/Kconfig +++ b/boards/arm/samv7/same70-xplained/Kconfig @@ -90,65 +90,4 @@ config SAME70XPLAINED_HSMCI0_AUTOMOUNT_UDELAY 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 diff --git a/boards/arm/samv7/same70-xplained/README.txt b/boards/arm/samv7/same70-xplained/README.txt index 3c7ab65..b7c6d77 100644 --- a/boards/arm/samv7/same70-xplained/README.txt +++ b/boards/arm/samv7/same70-xplained/README.txt @@ -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: - 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 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 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 - boards/arm/samv7/same70-xplained/tools/atmel_same70_xplained.cfg + boards/arm/samv7/common/tools/atmel_${TARGET_BOARD}.cfg Starting OpenOCD 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 @@ -1716,8 +1716,7 @@ Configuration sub-directories CONFIG_MCUBOOT_BOOTLOADER=y CONFIG_MCUBOOT_ENABLE_LOGGING=y - CONFIG_SAME70XPLAINED_FORMAT_MCUBOOT=y - CONFIG_SAME70XPLAINED_MCUBOOT_BOOTLOADER=y + CONFIG_SAMV7_FORMAT_MCUBOOT=y CONFIG_USER_ENTRYPOINT="mcuboot_loader_main" mcuboot-confirm: diff --git a/boards/arm/samv7/same70-xplained/configs/mcuboot-confirm/defconfig b/boards/arm/samv7/same70-xplained/configs/mcuboot-confirm/defconfig index 931a4d5..4fbf4c2 100644 --- a/boards/arm/samv7/same70-xplained/configs/mcuboot-confirm/defconfig +++ b/boards/arm/samv7/same70-xplained/configs/mcuboot-confirm/defconfig @@ -46,7 +46,6 @@ CONFIG_MMCSD_MULTIBLOCK_DISABLE=y CONFIG_MMCSD_SDIO=y CONFIG_MTD_AT24XX=y CONFIG_MTD_AT25=y -CONFIG_MTD_CONFIG=y CONFIG_NSH_ARCHINIT=y CONFIG_NSH_BUILTIN_APPS=y CONFIG_NSH_FILEIOSIZE=512 @@ -57,12 +56,11 @@ CONFIG_RAM_SIZE=393216 CONFIG_RAM_START=0x20400000 CONFIG_RAW_BINARY=y CONFIG_RR_INTERVAL=200 -CONFIG_SAME70XPLAINED_FORMAT_MCUBOOT=y +CONFIG_SAMV7_FORMAT_MCUBOOT=y CONFIG_SAMV7_GPIOA_IRQ=y CONFIG_SAMV7_GPIOC_IRQ=y CONFIG_SAMV7_GPIO_IRQ=y CONFIG_SAMV7_HSMCI0=y -CONFIG_SAMV7_PROGMEM=y CONFIG_SAMV7_SDRAMC=y CONFIG_SAMV7_SDRAMSIZE=2097152 CONFIG_SAMV7_TWIHS0=y diff --git a/boards/arm/samv7/same70-xplained/configs/mcuboot-loader/defconfig b/boards/arm/samv7/same70-xplained/configs/mcuboot-loader/defconfig index 86123ea..4ddd819 100644 --- a/boards/arm/samv7/same70-xplained/configs/mcuboot-loader/defconfig +++ b/boards/arm/samv7/same70-xplained/configs/mcuboot-loader/defconfig @@ -47,7 +47,6 @@ CONFIG_MMCSD_MULTIBLOCK_DISABLE=y CONFIG_MMCSD_SDIO=y CONFIG_MTD_AT24XX=y CONFIG_MTD_AT25=y -CONFIG_MTD_CONFIG=y CONFIG_NSH_ARCHINIT=y CONFIG_NSH_BUILTIN_APPS=y CONFIG_NSH_FILEIOSIZE=512 @@ -58,13 +57,11 @@ CONFIG_RAM_SIZE=393216 CONFIG_RAM_START=0x20400000 CONFIG_RAW_BINARY=y CONFIG_RR_INTERVAL=200 -CONFIG_SAME70XPLAINED_FORMAT_MCUBOOT=y -CONFIG_SAME70XPLAINED_MCUBOOT_BOOTLOADER=y +CONFIG_SAMV7_FORMAT_MCUBOOT=y CONFIG_SAMV7_GPIOA_IRQ=y CONFIG_SAMV7_GPIOC_IRQ=y CONFIG_SAMV7_GPIO_IRQ=y CONFIG_SAMV7_HSMCI0=y -CONFIG_SAMV7_PROGMEM=y CONFIG_SAMV7_SDRAMC=y CONFIG_SAMV7_SDRAMSIZE=2097152 CONFIG_SAMV7_TWIHS0=y diff --git a/boards/arm/samv7/same70-xplained/kernel/Makefile b/boards/arm/samv7/same70-xplained/kernel/Makefile index d7fe60f..e0b6632 100644 --- a/boards/arm/samv7/same70-xplained/kernel/Makefile +++ b/boards/arm/samv7/same70-xplained/kernel/Makefile @@ -31,16 +31,16 @@ ENTRYPT = $(patsubst "%",%,$(CONFIG_USER_ENTRYPOINT)) ifeq ($(CONFIG_CYGWIN_WINTOOL),y) # Windows-native toolchains 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_DIR)$(DELIM)scripts$(DELIM)user-space.ld}" + USER_LDSCRIPT = -T "${shell cygpath -w $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)memory.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_SRECFILE += "${shell cygpath -w $(TOPDIR)$(DELIM)nuttx_user.srec}" USER_BINFILE += "${shell cygpath -w $(TOPDIR)$(DELIM)nuttx_user.bin}" else # Linux/Cygwin-native toolchain USER_LIBPATHS = $(addprefix -L$(TOPDIR)$(DELIM),$(dir $(USERLIBS))) - USER_LDSCRIPT = -T$(BOARD_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)memory.ld + USER_LDSCRIPT += -T$(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)user-space.ld USER_HEXFILE += "$(TOPDIR)$(DELIM)nuttx_user.hex" USER_SRECFILE += "$(TOPDIR)$(DELIM)nuttx_user.srec" USER_BINFILE += "$(TOPDIR)$(DELIM)nuttx_user.bin" diff --git a/boards/arm/samv7/same70-xplained/scripts/Make.defs b/boards/arm/samv7/same70-xplained/scripts/Make.defs index 1c6279f..288f75d 100644 --- a/boards/arm/samv7/same70-xplained/scripts/Make.defs +++ b/boards/arm/samv7/same70-xplained/scripts/Make.defs @@ -18,55 +18,4 @@ # ############################################################################ -include $(TOPDIR)/.config -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 +include $(TOPDIR)/boards/arm/samv7/common/scripts/flat.memory diff --git a/boards/arm/samv7/same70-xplained/scripts/flash.template.ld b/boards/arm/samv7/same70-xplained/scripts/flash.template.ld deleted file mode 100644 index 4b984a8..0000000 --- a/boards/arm/samv7/same70-xplained/scripts/flash.template.ld +++ /dev/null @@ -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) } -} diff --git a/boards/arm/samv7/same70-xplained/scripts/gnu-elf.ld b/boards/arm/samv7/same70-xplained/scripts/gnu-elf.ld deleted file mode 100644 index a141d7b..0000000 --- a/boards/arm/samv7/same70-xplained/scripts/gnu-elf.ld +++ /dev/null @@ -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) } -} diff --git a/boards/arm/samv7/same70-xplained/scripts/kernel-space.ld b/boards/arm/samv7/same70-xplained/scripts/kernel-space.ld deleted file mode 100644 index 7fce3ef..0000000 --- a/boards/arm/samv7/same70-xplained/scripts/kernel-space.ld +++ /dev/null @@ -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) } -} diff --git a/boards/arm/samv7/same70-xplained/scripts/memory.ld b/boards/arm/samv7/same70-xplained/scripts/memory.ld deleted file mode 100644 index 8ba960c..0000000 --- a/boards/arm/samv7/same70-xplained/scripts/memory.ld +++ /dev/null @@ -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 -} diff --git a/boards/arm/samv7/same70-xplained/scripts/user-space.ld b/boards/arm/samv7/same70-xplained/scripts/user-space.ld deleted file mode 100644 index bf32b45..0000000 --- a/boards/arm/samv7/same70-xplained/scripts/user-space.ld +++ /dev/null @@ -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) } -} diff --git a/boards/arm/samv7/same70-xplained/src/Makefile b/boards/arm/samv7/same70-xplained/src/Make.defs similarity index 88% rename from boards/arm/samv7/same70-xplained/src/Makefile rename to boards/arm/samv7/same70-xplained/src/Make.defs index 8bbea95..4c88925 100644 --- a/boards/arm/samv7/same70-xplained/src/Makefile +++ b/boards/arm/samv7/same70-xplained/src/Make.defs @@ -100,16 +100,18 @@ ifeq ($(CONFIG_IEEE802154_XBEE),y) CSRCS += sam_xbee.c endif -SCRIPTOUT = $(BOARD_DIR)$(DELIM)scripts$(DELIM)samv7.ld +SCRIPTOUT = $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)samv7.ld .PHONY = context distclean $(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) distclean:: $(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) diff --git a/boards/arm/samv7/same70-xplained/src/sam_progmem.c b/boards/arm/samv7/same70-xplained/src/sam_progmem.c index 5dfe73e..390868f 100644 --- a/boards/arm/samv7/same70-xplained/src/sam_progmem.c +++ b/boards/arm/samv7/same70-xplained/src/sam_progmem.c @@ -54,7 +54,7 @@ * Private Types ****************************************************************************/ -#if defined(CONFIG_SAME70XPLAINED_PROGMEM_OTA_PARTITION) +#if defined(CONFIG_SAMV7_PROGMEM_OTA_PARTITION) struct ota_partition_s { @@ -69,7 +69,7 @@ struct ota_partition_s * 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, uint32_t mtd_size); 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; -#if defined(CONFIG_SAME70XPLAINED_PROGMEM_OTA_PARTITION) +#if defined(CONFIG_SAMV7_PROGMEM_OTA_PARTITION) static const struct ota_partition_s g_ota_partition_table[] = { { - .offset = CONFIG_SAME70XPLAINED_OTA_PRIMARY_SLOT_OFFSET, - .size = CONFIG_SAME70XPLAINED_OTA_SLOT_SIZE, - .devpath = CONFIG_SAME70XPLAINED_OTA_PRIMARY_SLOT_DEVPATH + .offset = CONFIG_SAMV7_OTA_PRIMARY_SLOT_OFFSET, + .size = CONFIG_SAMV7_OTA_SLOT_SIZE, + .devpath = CONFIG_SAMV7_OTA_PRIMARY_SLOT_DEVPATH }, { - .offset = CONFIG_SAME70XPLAINED_OTA_SECONDARY_SLOT_OFFSET, - .size = CONFIG_SAME70XPLAINED_OTA_SLOT_SIZE, - .devpath = CONFIG_SAME70XPLAINED_OTA_SECONDARY_SLOT_DEVPATH + .offset = CONFIG_SAMV7_OTA_SECONDARY_SLOT_OFFSET, + .size = CONFIG_SAMV7_OTA_SLOT_SIZE, + .devpath = CONFIG_SAMV7_OTA_SECONDARY_SLOT_DEVPATH }, { - .offset = CONFIG_SAME70XPLAINED_OTA_SCRATCH_OFFSET, - .size = CONFIG_SAME70XPLAINED_OTA_SCRATCH_SIZE, - .devpath = CONFIG_SAME70XPLAINED_OTA_SCRATCH_DEVPATH + .offset = CONFIG_SAMV7_OTA_SCRATCH_OFFSET, + .size = CONFIG_SAMV7_OTA_SCRATCH_SIZE, + .devpath = CONFIG_SAMV7_OTA_SCRATCH_DEVPATH } }; #endif @@ -106,7 +106,7 @@ static const struct ota_partition_s g_ota_partition_table[] = * Private Functions ****************************************************************************/ -#if defined(CONFIG_SAME70XPLAINED_PROGMEM_OTA_PARTITION) +#if defined(CONFIG_SAMV7_PROGMEM_OTA_PARTITION) /**************************************************************************** * Name: sam_progmem_alloc_mtdpart @@ -225,7 +225,7 @@ int sam_progmem_init(void) return -EFAULT; } -#if defined(CONFIG_SAME70XPLAINED_PROGMEM_OTA_PARTITION) +#if defined(CONFIG_SAMV7_PROGMEM_OTA_PARTITION) ret = init_ota_partitions(); if (ret < 0) { diff --git a/boards/arm/samv7/same70-xplained/tools/atmel_same70_xplained.cfg b/boards/arm/samv7/same70-xplained/tools/atmel_same70_xplained.cfg deleted file mode 100644 index 068d6c2..0000000 --- a/boards/arm/samv7/same70-xplained/tools/atmel_same70_xplained.cfg +++ /dev/null @@ -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 diff --git a/boards/arm/samv7/same70-xplained/tools/oocd.sh b/boards/arm/samv7/same70-xplained/tools/oocd.sh deleted file mode 100755 index 8ed4a9d..0000000 --- a/boards/arm/samv7/same70-xplained/tools/oocd.sh +++ /dev/null @@ -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" diff --git a/boards/arm/samv7/samv71-xult/configs/knsh/Make.defs b/boards/arm/samv7/samv71-xult/configs/knsh/Make.defs index 5edaf3c..615897d 100644 --- a/boards/arm/samv7/samv71-xult/configs/knsh/Make.defs +++ b/boards/arm/samv7/samv71-xult/configs/knsh/Make.defs @@ -18,57 +18,4 @@ # ############################################################################ -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_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 +include $(TOPDIR)/boards/arm/samv7/common/scripts/protected.memory diff --git a/boards/arm/samv7/samv71-xult/kernel/Makefile b/boards/arm/samv7/samv71-xult/kernel/Makefile index bda98a6..721e861 100644 --- a/boards/arm/samv7/samv71-xult/kernel/Makefile +++ b/boards/arm/samv7/samv71-xult/kernel/Makefile @@ -31,16 +31,16 @@ ENTRYPT = $(patsubst "%",%,$(CONFIG_USER_ENTRYPOINT)) ifeq ($(CONFIG_CYGWIN_WINTOOL),y) # Windows-native toolchains 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_DIR)$(DELIM)scripts$(DELIM)user-space.ld}" + USER_LDSCRIPT = -T "${shell cygpath -w $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)memory.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_SRECFILE += "${shell cygpath -w $(TOPDIR)$(DELIM)nuttx_user.srec}" USER_BINFILE += "${shell cygpath -w $(TOPDIR)$(DELIM)nuttx_user.bin}" else # Linux/Cygwin-native toolchain USER_LIBPATHS = $(addprefix -L$(TOPDIR)$(DELIM),$(dir $(USERLIBS))) - USER_LDSCRIPT = -T$(BOARD_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)memory.ld + USER_LDSCRIPT += -T$(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)user-space.ld USER_HEXFILE += "$(TOPDIR)$(DELIM)nuttx_user.hex" USER_SRECFILE += "$(TOPDIR)$(DELIM)nuttx_user.srec" USER_BINFILE += "$(TOPDIR)$(DELIM)nuttx_user.bin" diff --git a/boards/arm/samv7/samv71-xult/scripts/Make.defs b/boards/arm/samv7/samv71-xult/scripts/Make.defs index 2a008ad..81ea817 100644 --- a/boards/arm/samv7/samv71-xult/scripts/Make.defs +++ b/boards/arm/samv7/samv71-xult/scripts/Make.defs @@ -18,55 +18,4 @@ # ############################################################################ -include $(TOPDIR)/.config -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 +include $(TOPDIR)/boards/arm/samv7/common/scripts/flat.memory diff --git a/boards/arm/samv7/samv71-xult/scripts/flash.template.ld b/boards/arm/samv7/samv71-xult/scripts/flash.template.ld deleted file mode 100644 index 478fb82..0000000 --- a/boards/arm/samv7/samv71-xult/scripts/flash.template.ld +++ /dev/null @@ -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) } -} diff --git a/boards/arm/samv7/samv71-xult/src/Makefile b/boards/arm/samv7/samv71-xult/src/Make.defs similarity index 88% rename from boards/arm/samv7/samv71-xult/src/Makefile rename to boards/arm/samv7/samv71-xult/src/Make.defs index 7e23f3b..d273b77 100644 --- a/boards/arm/samv7/samv71-xult/src/Makefile +++ b/boards/arm/samv7/samv71-xult/src/Make.defs @@ -114,16 +114,18 @@ ifeq ($(CONFIG_LCD_ST7789),y) CSRCS += sam_st7789.c endif -SCRIPTOUT = $(BOARD_DIR)$(DELIM)scripts$(DELIM)samv7.ld +SCRIPTOUT = $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)samv7.ld .PHONY = context distclean $(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) distclean:: $(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)
