You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ac...@apache.org on 2021/12/16 09:56:51 UTC
[incubator-nuttx] 02/05: boards/arm/samv7: Unify linker scripts
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 463fbfe975180e284108dd3adcca982d10b46dfe
Author: Gerson Fernando Budke <na...@gmail.com>
AuthorDate: Sat Dec 11 19:52:39 2021 -0300
boards/arm/samv7: Unify linker scripts
After define memory sizes for samv7 it is possible unify linker scripts.
This add necessary changes to perform such operation.
Signed-off-by: Gerson Fernando Budke <na...@gmail.com>
---
boards/arm/samv7/same70-qmtech/.gitignore | 1 +
boards/arm/samv7/same70-qmtech/scripts/Make.defs | 17 +--
.../scripts/flash-dtcm-mcuboot-loader.ld | 117 ---------------------
.../arm/samv7/same70-qmtech/scripts/flash-dtcm.ld | 117 ---------------------
.../scripts/flash-sram-mcuboot-loader.ld | 114 --------------------
.../arm/samv7/same70-qmtech/scripts/flash-sram.ld | 114 --------------------
...flash-sram-mcuboot-app.ld => flash.template.ld} | 36 +++++--
boards/arm/samv7/same70-qmtech/src/Makefile | 12 +++
boards/arm/samv7/same70-xplained/.gitignore | 1 +
boards/arm/samv7/same70-xplained/scripts/Make.defs | 17 +--
.../scripts/flash-dtcm-mcuboot-app.ld | 117 ---------------------
.../scripts/flash-dtcm-mcuboot-loader.ld | 117 ---------------------
.../samv7/same70-xplained/scripts/flash-dtcm.ld | 117 ---------------------
.../scripts/flash-sram-mcuboot-app.ld | 114 --------------------
.../scripts/flash-sram-mcuboot-loader.ld | 114 --------------------
.../scripts/flash.template.ld} | 39 ++++---
boards/arm/samv7/same70-xplained/src/Makefile | 12 +++
boards/arm/samv7/samv71-xult/.gitignore | 1 +
boards/arm/samv7/samv71-xult/scripts/Make.defs | 7 +-
boards/arm/samv7/samv71-xult/scripts/flash-dtcm.ld | 117 ---------------------
boards/arm/samv7/samv71-xult/scripts/flash-sram.ld | 114 --------------------
.../scripts/flash.template.ld} | 25 +++--
boards/arm/samv7/samv71-xult/src/Makefile | 12 +++
23 files changed, 112 insertions(+), 1340 deletions(-)
diff --git a/boards/arm/samv7/same70-qmtech/.gitignore b/boards/arm/samv7/same70-qmtech/.gitignore
new file mode 100644
index 0000000..a5638cb
--- /dev/null
+++ b/boards/arm/samv7/same70-qmtech/.gitignore
@@ -0,0 +1 @@
+/scripts/samv7.ld
diff --git a/boards/arm/samv7/same70-qmtech/scripts/Make.defs b/boards/arm/samv7/same70-qmtech/scripts/Make.defs
index 2927cfc..8a764e6 100644
--- a/boards/arm/samv7/same70-qmtech/scripts/Make.defs
+++ b/boards/arm/samv7/same70-qmtech/scripts/Make.defs
@@ -22,21 +22,8 @@ include $(TOPDIR)/.config
include $(TOPDIR)/tools/Config.mk
include $(TOPDIR)/arch/arm/src/armv7-m/Toolchain.defs
-ifeq ($(CONFIG_ARMV7M_DTCM),y)
-LDSCRIPT_PREFIX = flash-dtcm
-else
-LDSCRIPT_PREFIX = flash-sram
-endif
-
-ifeq ($(CONFIG_SAME70QMTECH_FORMAT_MCUBOOT),y)
- ifeq ($(CONFIG_SAME70QMTECH_MCUBOOT_BOOTLOADER),y)
- LDSCRIPT = $(LDSCRIPT_PREFIX)-mcuboot-loader.ld
- else
- LDSCRIPT = $(LDSCRIPT_PREFIX)-mcuboot-app.ld
- endif
-else
- LDSCRIPT = $(LDSCRIPT_PREFIX).ld
-endif
+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)}"
diff --git a/boards/arm/samv7/same70-qmtech/scripts/flash-dtcm-mcuboot-loader.ld b/boards/arm/samv7/same70-qmtech/scripts/flash-dtcm-mcuboot-loader.ld
deleted file mode 100644
index 542e879..0000000
--- a/boards/arm/samv7/same70-qmtech/scripts/flash-dtcm-mcuboot-loader.ld
+++ /dev/null
@@ -1,117 +0,0 @@
-/****************************************************************************
- * boards/arm/samv7/same70-qmtech/scripts/flash-dtcm-mcuboot-loader.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 (Assuming that ITCM is not enable).
- *
- * NOTE: that the DTCM address of 0x2000:0000 is used for SRAM. If DTCM is
- * disabled, then the accesses will actually occur on the AHB bus.
- */
-
-MEMORY
-{
- flash (rx) : ORIGIN = 0x00400000, LENGTH = 128K
- sram (rwx) : ORIGIN = 0x20000000, LENGTH = 256K
-}
-
-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-qmtech/scripts/flash-dtcm.ld b/boards/arm/samv7/same70-qmtech/scripts/flash-dtcm.ld
deleted file mode 100644
index b163a36..0000000
--- a/boards/arm/samv7/same70-qmtech/scripts/flash-dtcm.ld
+++ /dev/null
@@ -1,117 +0,0 @@
-/****************************************************************************
- * boards/arm/samv7/same70-qmtech/scripts/flash-dtcm.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 (Assuming that ITCM is not enable).
- *
- * NOTE: that the DTCM address of 0x2000:0000 is used for SRAM. If DTCM is
- * disabled, then the accesses will actually occur on the AHB bus.
- */
-
-MEMORY
-{
- flash (rx) : ORIGIN = 0x00400000, LENGTH = 512K
- sram (rwx) : ORIGIN = 0x20000000, LENGTH = 256K
-}
-
-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-qmtech/scripts/flash-sram-mcuboot-loader.ld b/boards/arm/samv7/same70-qmtech/scripts/flash-sram-mcuboot-loader.ld
deleted file mode 100644
index 1f2dca3..0000000
--- a/boards/arm/samv7/same70-qmtech/scripts/flash-sram-mcuboot-loader.ld
+++ /dev/null
@@ -1,114 +0,0 @@
-/****************************************************************************
- * boards/arm/samv7/same70-qmtech/scripts/flash-sram-mcuboot-loader.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 (Assuming that ITCM is not enable).
- */
-
-MEMORY
-{
- flash (rx) : ORIGIN = 0x00400000, LENGTH = 128K
- sram (rwx) : ORIGIN = 0x20400000, LENGTH = 256K
-}
-
-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-qmtech/scripts/flash-sram.ld b/boards/arm/samv7/same70-qmtech/scripts/flash-sram.ld
deleted file mode 100644
index 3404912..0000000
--- a/boards/arm/samv7/same70-qmtech/scripts/flash-sram.ld
+++ /dev/null
@@ -1,114 +0,0 @@
-/****************************************************************************
- * boards/arm/samv7/same70-qmtech/scripts/flash-sram.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 (Assuming that ITCM is not enable).
- */
-
-MEMORY
-{
- flash (rx) : ORIGIN = 0x00400000, LENGTH = 512K
- sram (rwx) : ORIGIN = 0x20400000, LENGTH = 256K
-}
-
-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-qmtech/scripts/flash-sram-mcuboot-app.ld b/boards/arm/samv7/same70-qmtech/scripts/flash.template.ld
similarity index 74%
rename from boards/arm/samv7/same70-qmtech/scripts/flash-sram-mcuboot-app.ld
rename to boards/arm/samv7/same70-qmtech/scripts/flash.template.ld
index 3449899..f280071 100644
--- a/boards/arm/samv7/same70-qmtech/scripts/flash-sram-mcuboot-app.ld
+++ b/boards/arm/samv7/same70-qmtech/scripts/flash.template.ld
@@ -1,5 +1,5 @@
/****************************************************************************
- * boards/arm/samv7/same70-qmtech/scripts/flash-sram-mcuboot-app.ld
+ * boards/arm/samv7/same70-qmtech/scripts/flash.template.ld
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -18,18 +18,34 @@
*
****************************************************************************/
-/* 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 (Assuming that ITCM is not enable).
- */
+#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_SAME70QMTECH_FORMAT_MCUBOOT
+# define MCUBOOT_HEADER_SIZE 0x200
+# ifdef CONFIG_BOARDCTL_BOOT_IMAGE
+# define FLASH_OFFSET 0
+# define FLASH_IMG_SIZE CONFIG_SAME70QMTECH_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)
+# endif
+#else
+# define FLASH_OFFSET 0
+# define FLASH_IMG_SIZE CONFIG_ARCH_CHIP_SAMV7_MEM_FLASH
+#endif
MEMORY
{
- flash (rx) : ORIGIN = 0x00420200, LENGTH = 160K - 0x200
- sram (rwx) : ORIGIN = 0x20400000, LENGTH = 256K
+ 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)
diff --git a/boards/arm/samv7/same70-qmtech/src/Makefile b/boards/arm/samv7/same70-qmtech/src/Makefile
index 94b43b7..8783c64 100644
--- a/boards/arm/samv7/same70-qmtech/src/Makefile
+++ b/boards/arm/samv7/same70-qmtech/src/Makefile
@@ -68,4 +68,16 @@ ifneq (,$(findstring y,$(CONFIG_SAMV7_DAC0) $(CONFIG_SAMV7_DAC1)))
CSRCS += sam_dac.c
endif
+SCRIPTOUT = $(BOARD_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 $@
+
+context:: $(SCRIPTOUT)
+
+distclean::
+ $(call DELFILE, $(SCRIPTOUT))
+
include $(TOPDIR)/boards/Board.mk
diff --git a/boards/arm/samv7/same70-xplained/.gitignore b/boards/arm/samv7/same70-xplained/.gitignore
new file mode 100644
index 0000000..a5638cb
--- /dev/null
+++ b/boards/arm/samv7/same70-xplained/.gitignore
@@ -0,0 +1 @@
+/scripts/samv7.ld
diff --git a/boards/arm/samv7/same70-xplained/scripts/Make.defs b/boards/arm/samv7/same70-xplained/scripts/Make.defs
index 7957c99..1c6279f 100644
--- a/boards/arm/samv7/same70-xplained/scripts/Make.defs
+++ b/boards/arm/samv7/same70-xplained/scripts/Make.defs
@@ -22,21 +22,8 @@ include $(TOPDIR)/.config
include $(TOPDIR)/tools/Config.mk
include $(TOPDIR)/arch/arm/src/armv7-m/Toolchain.defs
-ifeq ($(CONFIG_ARMV7M_DTCM),y)
-LDSCRIPT_PREFIX = flash-dtcm
-else
-LDSCRIPT_PREFIX = flash-sram
-endif
-
-ifeq ($(CONFIG_SAME70XPLAINED_FORMAT_MCUBOOT),y)
- ifeq ($(CONFIG_SAME70XPLAINED_MCUBOOT_BOOTLOADER),y)
- LDSCRIPT = $(LDSCRIPT_PREFIX)-mcuboot-loader.ld
- else
- LDSCRIPT = $(LDSCRIPT_PREFIX)-mcuboot-app.ld
- endif
-else
- LDSCRIPT = $(LDSCRIPT_PREFIX).ld
-endif
+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)}"
diff --git a/boards/arm/samv7/same70-xplained/scripts/flash-dtcm-mcuboot-app.ld b/boards/arm/samv7/same70-xplained/scripts/flash-dtcm-mcuboot-app.ld
deleted file mode 100644
index d38c7ff..0000000
--- a/boards/arm/samv7/same70-xplained/scripts/flash-dtcm-mcuboot-app.ld
+++ /dev/null
@@ -1,117 +0,0 @@
-/****************************************************************************
- * boards/arm/samv7/same70-xplained/scripts/flash-dtcm-mcuboot-app.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 (Assuming that ITCM is not enable).
- *
- * NOTE: that the DTCM address of 0x2000:0000 is used for SRAM. If DTCM is
- * disabled, then the accesses will actually occur on the AHB bus.
- */
-
-MEMORY
-{
- flash (rx) : ORIGIN = 0x00420200, LENGTH = 896K - 0x200
- sram (rwx) : ORIGIN = 0x20000000, LENGTH = 384K
-}
-
-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/flash-dtcm-mcuboot-loader.ld b/boards/arm/samv7/same70-xplained/scripts/flash-dtcm-mcuboot-loader.ld
deleted file mode 100644
index 15c29ce..0000000
--- a/boards/arm/samv7/same70-xplained/scripts/flash-dtcm-mcuboot-loader.ld
+++ /dev/null
@@ -1,117 +0,0 @@
-/****************************************************************************
- * boards/arm/samv7/same70-xplained/scripts/flash-dtcm-mcuboot-loader.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 (Assuming that ITCM is not enable).
- *
- * NOTE: that the DTCM address of 0x2000:0000 is used for SRAM. If DTCM is
- * disabled, then the accesses will actually occur on the AHB bus.
- */
-
-MEMORY
-{
- flash (rx) : ORIGIN = 0x00400000, LENGTH = 128K
- sram (rwx) : ORIGIN = 0x20000000, LENGTH = 384K
-}
-
-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/flash-dtcm.ld b/boards/arm/samv7/same70-xplained/scripts/flash-dtcm.ld
deleted file mode 100644
index 0fad41b..0000000
--- a/boards/arm/samv7/same70-xplained/scripts/flash-dtcm.ld
+++ /dev/null
@@ -1,117 +0,0 @@
-/****************************************************************************
- * boards/arm/samv7/same70-xplained/scripts/flash-dtcm.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 (Assuming that ITCM is not enable).
- *
- * NOTE: that the DTCM address of 0x2000:0000 is used for SRAM. If DTCM is
- * disabled, then the accesses will actually occur on the AHB bus.
- */
-
-MEMORY
-{
- flash (rx) : ORIGIN = 0x00400000, LENGTH = 2048K
- sram (rwx) : ORIGIN = 0x20000000, LENGTH = 384K
-}
-
-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/flash-sram-mcuboot-app.ld b/boards/arm/samv7/same70-xplained/scripts/flash-sram-mcuboot-app.ld
deleted file mode 100644
index 34a0c82..0000000
--- a/boards/arm/samv7/same70-xplained/scripts/flash-sram-mcuboot-app.ld
+++ /dev/null
@@ -1,114 +0,0 @@
-/****************************************************************************
- * boards/arm/samv7/same70-xplained/scripts/flash-sram-mcuboot-app.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 (Assuming that ITCM is not enable).
- */
-
-MEMORY
-{
- flash (rx) : ORIGIN = 0x00420200, LENGTH = 896K - 0x200
- sram (rwx) : ORIGIN = 0x20400000, LENGTH = 384K
-}
-
-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/flash-sram-mcuboot-loader.ld b/boards/arm/samv7/same70-xplained/scripts/flash-sram-mcuboot-loader.ld
deleted file mode 100644
index d9b6ee8..0000000
--- a/boards/arm/samv7/same70-xplained/scripts/flash-sram-mcuboot-loader.ld
+++ /dev/null
@@ -1,114 +0,0 @@
-/****************************************************************************
- * boards/arm/samv7/same70-xplained/scripts/flash-sram-mcuboot-loader.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 (Assuming that ITCM is not enable).
- */
-
-MEMORY
-{
- flash (rx) : ORIGIN = 0x00400000, LENGTH = 128K
- sram (rwx) : ORIGIN = 0x20400000, LENGTH = 384K
-}
-
-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-qmtech/scripts/flash-dtcm-mcuboot-app.ld b/boards/arm/samv7/same70-xplained/scripts/flash.template.ld
similarity index 74%
rename from boards/arm/samv7/same70-qmtech/scripts/flash-dtcm-mcuboot-app.ld
rename to boards/arm/samv7/same70-xplained/scripts/flash.template.ld
index 4b071b9..4b984a8 100644
--- a/boards/arm/samv7/same70-qmtech/scripts/flash-dtcm-mcuboot-app.ld
+++ b/boards/arm/samv7/same70-xplained/scripts/flash.template.ld
@@ -1,5 +1,5 @@
/****************************************************************************
- * boards/arm/samv7/same70-qmtech/scripts/flash-dtcm-mcuboot-app.ld
+ * 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
@@ -18,21 +18,34 @@
*
****************************************************************************/
-/* 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 (Assuming that ITCM is not enable).
- *
- * NOTE: that the DTCM address of 0x2000:0000 is used for SRAM. If DTCM is
- * disabled, then the accesses will actually occur on the AHB bus.
- */
+#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 = 0x00420200, LENGTH = 160K - 0x200
- sram (rwx) : ORIGIN = 0x20000000, LENGTH = 256K
+ 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)
diff --git a/boards/arm/samv7/same70-xplained/src/Makefile b/boards/arm/samv7/same70-xplained/src/Makefile
index b78b8b0..8bbea95 100644
--- a/boards/arm/samv7/same70-xplained/src/Makefile
+++ b/boards/arm/samv7/same70-xplained/src/Makefile
@@ -100,4 +100,16 @@ ifeq ($(CONFIG_IEEE802154_XBEE),y)
CSRCS += sam_xbee.c
endif
+SCRIPTOUT = $(BOARD_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 $@
+
+context:: $(SCRIPTOUT)
+
+distclean::
+ $(call DELFILE, $(SCRIPTOUT))
+
include $(TOPDIR)/boards/Board.mk
diff --git a/boards/arm/samv7/samv71-xult/.gitignore b/boards/arm/samv7/samv71-xult/.gitignore
new file mode 100644
index 0000000..a5638cb
--- /dev/null
+++ b/boards/arm/samv7/samv71-xult/.gitignore
@@ -0,0 +1 @@
+/scripts/samv7.ld
diff --git a/boards/arm/samv7/samv71-xult/scripts/Make.defs b/boards/arm/samv7/samv71-xult/scripts/Make.defs
index 0aa116e..2a008ad 100644
--- a/boards/arm/samv7/samv71-xult/scripts/Make.defs
+++ b/boards/arm/samv7/samv71-xult/scripts/Make.defs
@@ -22,11 +22,8 @@ include $(TOPDIR)/.config
include $(TOPDIR)/tools/Config.mk
include $(TOPDIR)/arch/arm/src/armv7-m/Toolchain.defs
-ifeq ($(CONFIG_ARMV7M_DTCM),y)
- LDSCRIPT = flash-dtcm.ld
-else
- LDSCRIPT = flash-sram.ld
-endif
+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)}"
diff --git a/boards/arm/samv7/samv71-xult/scripts/flash-dtcm.ld b/boards/arm/samv7/samv71-xult/scripts/flash-dtcm.ld
deleted file mode 100644
index e729f75..0000000
--- a/boards/arm/samv7/samv71-xult/scripts/flash-dtcm.ld
+++ /dev/null
@@ -1,117 +0,0 @@
-/****************************************************************************
- * boards/arm/samv7/samv71-xult/scripts/flash-dtcm.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 SAMV71Q21 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 (Assuming that ITCM is not enable).
- *
- * NOTE: that the DTCM address of 0x2000:0000 is used for SRAM. If DTCM is
- * disabled, then the accesses will actually occur on the AHB bus.
- */
-
-MEMORY
-{
- flash (rx) : ORIGIN = 0x00400000, LENGTH = 2048K
- sram (rwx) : ORIGIN = 0x20000000, LENGTH = 384K
-}
-
-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/scripts/flash-sram.ld b/boards/arm/samv7/samv71-xult/scripts/flash-sram.ld
deleted file mode 100644
index 633f9b0..0000000
--- a/boards/arm/samv7/samv71-xult/scripts/flash-sram.ld
+++ /dev/null
@@ -1,114 +0,0 @@
-/****************************************************************************
- * boards/arm/samv7/samv71-xult/scripts/flash-sram.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 SAMV71Q21 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 (Assuming that ITCM is not enable).
- */
-
-MEMORY
-{
- flash (rx) : ORIGIN = 0x00400000, LENGTH = 2048K
- sram (rwx) : ORIGIN = 0x20400000, LENGTH = 384K
-}
-
-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/flash-sram.ld b/boards/arm/samv7/samv71-xult/scripts/flash.template.ld
similarity index 84%
rename from boards/arm/samv7/same70-xplained/scripts/flash-sram.ld
rename to boards/arm/samv7/samv71-xult/scripts/flash.template.ld
index 3b32adc..478fb82 100644
--- a/boards/arm/samv7/same70-xplained/scripts/flash-sram.ld
+++ b/boards/arm/samv7/samv71-xult/scripts/flash.template.ld
@@ -1,5 +1,5 @@
/****************************************************************************
- * boards/arm/samv7/same70-xplained/scripts/flash-sram.ld
+ * 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
@@ -18,18 +18,23 @@
*
****************************************************************************/
-/* 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 (Assuming that ITCM is not enable).
- */
+#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 = 0x00400000, LENGTH = 2048K
- sram (rwx) : ORIGIN = 0x20400000, LENGTH = 384K
+ 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)
diff --git a/boards/arm/samv7/samv71-xult/src/Makefile b/boards/arm/samv7/samv71-xult/src/Makefile
index fa452cd..7e23f3b 100644
--- a/boards/arm/samv7/samv71-xult/src/Makefile
+++ b/boards/arm/samv7/samv71-xult/src/Makefile
@@ -114,4 +114,16 @@ ifeq ($(CONFIG_LCD_ST7789),y)
CSRCS += sam_st7789.c
endif
+SCRIPTOUT = $(BOARD_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 $@
+
+context:: $(SCRIPTOUT)
+
+distclean::
+ $(call DELFILE, $(SCRIPTOUT))
+
include $(TOPDIR)/boards/Board.mk