You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2021/11/30 05:53:53 UTC

[incubator-nuttx] branch master updated: board/same70-xplained: MCUboot related improvements

This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new d4a5003  board/same70-xplained: MCUboot related improvements
d4a5003 is described below

commit d4a50033761a90a487eec7e191f02559a4d31359
Author: Petro Karashchenko <pe...@gmail.com>
AuthorDate: Mon Nov 29 11:50:38 2021 +0200

    board/same70-xplained: MCUboot related improvements
    
    - simplify LDSCRIPT file name selection
    - rename CONFIG_SAME70XPLAINED_APP_FORMAT_MCUBOOT to
      CONFIG_SAME70XPLAINED_FORMAT_MCUBOOT
    - fix usage of SAME70XPLAINED_PROGMEM_OTA_PARTITION
      config option
    
    Signed-off-by: Petro Karashchenko <pe...@gmail.com>
---
 boards/arm/samv7/same70-xplained/Kconfig           |  6 ++---
 boards/arm/samv7/same70-xplained/README.txt        |  4 ++--
 .../configs/mcuboot-confirm/defconfig              |  2 +-
 .../configs/mcuboot-loader/defconfig               |  2 +-
 boards/arm/samv7/same70-xplained/scripts/Make.defs | 26 +++++++++-------------
 boards/arm/samv7/same70-xplained/src/sam_progmem.c | 10 ++++-----
 6 files changed, 22 insertions(+), 28 deletions(-)

diff --git a/boards/arm/samv7/same70-xplained/Kconfig b/boards/arm/samv7/same70-xplained/Kconfig
index 740e844..78a74bb 100644
--- a/boards/arm/samv7/same70-xplained/Kconfig
+++ b/boards/arm/samv7/same70-xplained/Kconfig
@@ -99,14 +99,14 @@ config SAME70XPLAINED_PROGMEM_OTA_PARTITION
 	select MTD_PROGMEM
 	select MTD_PROGMEM_ERASESTATE
 
-menuconfig SAME70XPLAINED_APP_FORMAT_MCUBOOT
+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_APP_FORMAT_MCUBOOT
+if SAME70XPLAINED_FORMAT_MCUBOOT
 
 config SAME70XPLAINED_MCUBOOT_BOOTLOADER
 	bool "MCUboot bootloader application"
@@ -149,6 +149,6 @@ config SAME70XPLAINED_OTA_SCRATCH_SIZE
 	hex "MCUboot scratch partition size (in bytes)"
 	default "0x20000"
 
-endif # SAME70XPLAINED_APP_FORMAT_MCUBOOT
+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 add9d3c..3c7ab65 100644
--- a/boards/arm/samv7/same70-xplained/README.txt
+++ b/boards/arm/samv7/same70-xplained/README.txt
@@ -1716,7 +1716,7 @@ Configuration sub-directories
       CONFIG_MCUBOOT_BOOTLOADER=y
       CONFIG_MCUBOOT_ENABLE_LOGGING=y
 
-      CONFIG_SAME70XPLAINED_APP_FORMAT_MCUBOOT=y
+      CONFIG_SAME70XPLAINED_FORMAT_MCUBOOT=y
       CONFIG_SAME70XPLAINED_MCUBOOT_BOOTLOADER=y
       CONFIG_USER_ENTRYPOINT="mcuboot_loader_main"
 
@@ -1737,5 +1737,5 @@ Configuration sub-directories
       CONFIG_BOOT_MCUBOOT=y
       CONFIG_MCUBOOT_SLOT_CONFIRM_EXAMPLE=y
 
-      CONFIG_SAME70XPLAINED_APP_FORMAT_MCUBOOT=y
+      CONFIG_SAME70XPLAINED_FORMAT_MCUBOOT=y
       CONFIG_USER_ENTRYPOINT="mcuboot_confirm_main"
diff --git a/boards/arm/samv7/same70-xplained/configs/mcuboot-confirm/defconfig b/boards/arm/samv7/same70-xplained/configs/mcuboot-confirm/defconfig
index a8314ae..ff3ac8f 100644
--- a/boards/arm/samv7/same70-xplained/configs/mcuboot-confirm/defconfig
+++ b/boards/arm/samv7/same70-xplained/configs/mcuboot-confirm/defconfig
@@ -55,7 +55,7 @@ CONFIG_RAM_SIZE=393216
 CONFIG_RAM_START=0x20400000
 CONFIG_RAW_BINARY=y
 CONFIG_RR_INTERVAL=200
-CONFIG_SAME70XPLAINED_APP_FORMAT_MCUBOOT=y
+CONFIG_SAME70XPLAINED_FORMAT_MCUBOOT=y
 CONFIG_SAMV7_GPIOA_IRQ=y
 CONFIG_SAMV7_GPIOC_IRQ=y
 CONFIG_SAMV7_GPIO_IRQ=y
diff --git a/boards/arm/samv7/same70-xplained/configs/mcuboot-loader/defconfig b/boards/arm/samv7/same70-xplained/configs/mcuboot-loader/defconfig
index 369b25d..1c332f6 100644
--- a/boards/arm/samv7/same70-xplained/configs/mcuboot-loader/defconfig
+++ b/boards/arm/samv7/same70-xplained/configs/mcuboot-loader/defconfig
@@ -56,7 +56,7 @@ CONFIG_RAM_SIZE=393216
 CONFIG_RAM_START=0x20400000
 CONFIG_RAW_BINARY=y
 CONFIG_RR_INTERVAL=200
-CONFIG_SAME70XPLAINED_APP_FORMAT_MCUBOOT=y
+CONFIG_SAME70XPLAINED_FORMAT_MCUBOOT=y
 CONFIG_SAME70XPLAINED_MCUBOOT_BOOTLOADER=y
 CONFIG_SAMV7_GPIOA_IRQ=y
 CONFIG_SAMV7_GPIOC_IRQ=y
diff --git a/boards/arm/samv7/same70-xplained/scripts/Make.defs b/boards/arm/samv7/same70-xplained/scripts/Make.defs
index 0d508f4..7957c99 100644
--- a/boards/arm/samv7/same70-xplained/scripts/Make.defs
+++ b/boards/arm/samv7/same70-xplained/scripts/Make.defs
@@ -22,26 +22,20 @@ include $(TOPDIR)/.config
 include $(TOPDIR)/tools/Config.mk
 include $(TOPDIR)/arch/arm/src/armv7-m/Toolchain.defs
 
-ifeq ($(CONFIG_SAME70XPLAINED_APP_FORMAT_MCUBOOT),y)
-ifeq ($(CONFIG_SAME70XPLAINED_MCUBOOT_BOOTLOADER),y)
-  ifeq ($(CONFIG_ARMV7M_DTCM),y)
-    LDSCRIPT = flash-dtcm-mcuboot-loader.ld
-  else
-    LDSCRIPT = flash-sram-mcuboot-loader.ld
-  endif
+ifeq ($(CONFIG_ARMV7M_DTCM),y)
+LDSCRIPT_PREFIX = flash-dtcm
 else
-  ifeq ($(CONFIG_ARMV7M_DTCM),y)
-    LDSCRIPT = flash-dtcm-mcuboot-app.ld
-  else
-    LDSCRIPT = flash-sram-mcuboot-app.ld
-  endif
+LDSCRIPT_PREFIX = flash-sram
 endif
-else
-  ifeq ($(CONFIG_ARMV7M_DTCM),y)
-    LDSCRIPT = flash-dtcm.ld
+
+ifeq ($(CONFIG_SAME70XPLAINED_FORMAT_MCUBOOT),y)
+  ifeq ($(CONFIG_SAME70XPLAINED_MCUBOOT_BOOTLOADER),y)
+    LDSCRIPT = $(LDSCRIPT_PREFIX)-mcuboot-loader.ld
   else
-    LDSCRIPT = flash-sram.ld
+    LDSCRIPT = $(LDSCRIPT_PREFIX)-mcuboot-app.ld
   endif
+else
+  LDSCRIPT = $(LDSCRIPT_PREFIX).ld
 endif
 
 ifeq ($(CONFIG_CYGWIN_WINTOOL),y)
diff --git a/boards/arm/samv7/same70-xplained/src/sam_progmem.c b/boards/arm/samv7/same70-xplained/src/sam_progmem.c
index 3232c2f..5dfe73e 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(SAME70XPLAINED_PROGMEM_OTA_PARTITION)
+#if defined(CONFIG_SAME70XPLAINED_PROGMEM_OTA_PARTITION)
 
 struct ota_partition_s
 {
@@ -69,7 +69,7 @@ struct ota_partition_s
  * Private Function Prototypes
  ****************************************************************************/
 
-#if defined(SAME70XPLAINED_PROGMEM_OTA_PARTITION)
+#if defined(CONFIG_SAME70XPLAINED_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,7 +81,7 @@ static int init_ota_partitions(void);
 
 static FAR struct mtd_dev_s *g_samv7_progmem_mtd;
 
-#if defined(SAME70XPLAINED_PROGMEM_OTA_PARTITION)
+#if defined(CONFIG_SAME70XPLAINED_PROGMEM_OTA_PARTITION)
 static const struct ota_partition_s g_ota_partition_table[] =
 {
   {
@@ -106,7 +106,7 @@ static const struct ota_partition_s g_ota_partition_table[] =
  * Private Functions
  ****************************************************************************/
 
-#if defined(SAME70XPLAINED_PROGMEM_OTA_PARTITION)
+#if defined(CONFIG_SAME70XPLAINED_PROGMEM_OTA_PARTITION)
 
 /****************************************************************************
  * Name: sam_progmem_alloc_mtdpart
@@ -225,7 +225,7 @@ int sam_progmem_init(void)
       return -EFAULT;
     }
 
-#if defined(SAME70XPLAINED_PROGMEM_OTA_PARTITION)
+#if defined(CONFIG_SAME70XPLAINED_PROGMEM_OTA_PARTITION)
   ret = init_ota_partitions();
   if (ret < 0)
     {