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/29 02:33:57 UTC

[incubator-nuttx] branch master updated: boards/same70-xplained: disable systick before loading MCUboot application

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 3180972  boards/same70-xplained: disable systick before loading MCUboot application
3180972 is described below

commit 31809724e1f3e293420d84a5ce5359a73965fee8
Author: Petro Karashchenko <pe...@gmail.com>
AuthorDate: Sun Nov 28 21:50:10 2021 +0200

    boards/same70-xplained: disable systick before loading MCUboot application
    
    Signed-off-by: Petro Karashchenko <pe...@gmail.com>
---
 arch/arm/src/samv7/sam_progmem.c                   |  2 +-
 .../arm/samv7/same70-xplained/src/sam_boot_image.c | 30 ++++++++++++++++++++++
 boards/arm/samv7/same70-xplained/src/sam_usbdev.c  |  2 +-
 3 files changed, 32 insertions(+), 2 deletions(-)

diff --git a/arch/arm/src/samv7/sam_progmem.c b/arch/arm/src/samv7/sam_progmem.c
index 7bb8670..ed17fc3 100644
--- a/arch/arm/src/samv7/sam_progmem.c
+++ b/arch/arm/src/samv7/sam_progmem.c
@@ -546,7 +546,7 @@ ssize_t up_progmem_write(size_t address, const void *buffer, size_t buflen)
     {
       /* How much can we write into this page? */
 
-      xfrsize = MIN((size_t)SAMV7_PAGE_SIZE - offset, buflen) ;
+      xfrsize = MIN((size_t)SAMV7_PAGE_SIZE - offset, buflen);
 
       /* Do we need to use the intermediate buffer? */
 
diff --git a/boards/arm/samv7/same70-xplained/src/sam_boot_image.c b/boards/arm/samv7/same70-xplained/src/sam_boot_image.c
index 4bc2e3c..48c5390 100644
--- a/boards/arm/samv7/same70-xplained/src/sam_boot_image.c
+++ b/boards/arm/samv7/same70-xplained/src/sam_boot_image.c
@@ -57,6 +57,9 @@ struct arm_vector_table
  ****************************************************************************/
 
 static void cleanup_arm_nvic(void);
+#ifdef CONFIG_ARMV7M_SYSTICK
+static void systick_disable(void);
+#endif
 
 /****************************************************************************
  * Private Functions
@@ -100,6 +103,29 @@ static void cleanup_arm_nvic(void)
     }
 }
 
+#ifdef CONFIG_ARMV7M_SYSTICK
+/****************************************************************************
+ * Name:  systick_disable
+ *
+ * Description:
+ *   Disable the SysTick system timer
+ *
+ * Input Parameters:
+ *   None
+ *
+ *  Returned Value:
+ *    None
+ *
+ ****************************************************************************/
+
+static void systick_disable(void)
+{
+  putreg32(0, NVIC_SYSTICK_CTRL);
+  putreg32(NVIC_SYSTICK_RELOAD_MASK, NVIC_SYSTICK_RELOAD);
+  putreg32(0, NVIC_SYSTICK_CURRENT);
+}
+#endif
+
 /****************************************************************************
  * Public Functions
  ****************************************************************************/
@@ -132,6 +158,10 @@ int board_boot_image(FAR const char *path, uint32_t hdr_size)
       return bytes < 0 ? bytes : -1;
     }
 
+#ifdef CONFIG_ARMV7M_SYSTICK
+  systick_disable();
+#endif
+
   cleanup_arm_nvic();
 
 #ifdef CONFIG_ARMV7M_DCACHE
diff --git a/boards/arm/samv7/same70-xplained/src/sam_usbdev.c b/boards/arm/samv7/same70-xplained/src/sam_usbdev.c
index ee52ea5..5bc1087 100644
--- a/boards/arm/samv7/same70-xplained/src/sam_usbdev.c
+++ b/boards/arm/samv7/same70-xplained/src/sam_usbdev.c
@@ -52,7 +52,7 @@
  * Name:  sam_usbinitialize
  *
  * Description:
- *   Called from stm32_boardinitialize very early in initialization to setup
+ *   Called from sam_boardinitialize very early in initialization to setup
  *   USB-related GPIO pins for the SAME70-XPLD board.
  *
  ****************************************************************************/