[rtems commit] bsps/arm: Use common ARMv7-M bsp_reset()

Sebastian Huber sebh at rtems.org
Tue Jan 19 07:38:40 UTC 2016


Module:    rtems
Branch:    master
Commit:    b32a9cdc1eb893886f21be01bc0a5c1367b6e8be
Changeset: http://git.rtems.org/rtems/commit/?id=b32a9cdc1eb893886f21be01bc0a5c1367b6e8be

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Tue Jan 12 14:44:10 2016 +0100

bsps/arm: Use common ARMv7-M bsp_reset()

---

 c/src/lib/libbsp/arm/lm3s69xx/Makefile.am          |  2 +-
 c/src/lib/libbsp/arm/lpc176x/Makefile.am           |  2 +-
 c/src/lib/libbsp/arm/lpc176x/startup/bspreset.c    | 43 ----------------------
 c/src/lib/libbsp/arm/lpc24xx/Makefile.am           |  3 +-
 .../startup/{bspreset.c => bspreset-armv4.c}       | 21 +++++------
 .../{lm3s69xx => shared/armv7m}/startup/bspreset.c | 21 ++++++-----
 6 files changed, 26 insertions(+), 66 deletions(-)

diff --git a/c/src/lib/libbsp/arm/lm3s69xx/Makefile.am b/c/src/lib/libbsp/arm/lm3s69xx/Makefile.am
index 8d97001..9fab35f 100644
--- a/c/src/lib/libbsp/arm/lm3s69xx/Makefile.am
+++ b/c/src/lib/libbsp/arm/lm3s69xx/Makefile.am
@@ -74,9 +74,9 @@ libbsp_a_SOURCES += ../../shared/src/stackalloc.c
 
 # Startup
 libbsp_a_SOURCES += ../shared/startup/bsp-start-memcpy.S
+libbsp_a_SOURCES += ../shared/armv7m/startup/bspreset.c
 libbsp_a_SOURCES += startup/bspstart.c
 libbsp_a_SOURCES += startup/bspstarthook.c
-libbsp_a_SOURCES += startup/bspreset.c
 libbsp_a_SOURCES += startup/io.c
 libbsp_a_SOURCES += startup/syscon.c
 
diff --git a/c/src/lib/libbsp/arm/lpc176x/Makefile.am b/c/src/lib/libbsp/arm/lpc176x/Makefile.am
index 352b2d9..659ee49 100644
--- a/c/src/lib/libbsp/arm/lpc176x/Makefile.am
+++ b/c/src/lib/libbsp/arm/lpc176x/Makefile.am
@@ -102,7 +102,7 @@ libbsp_a_SOURCES += ../../shared/src/uart-output-char.c
 
 # Startup
 libbsp_a_SOURCES += ../shared/startup/bsp-start-memcpy.S
-libbsp_a_SOURCES += startup/bspreset.c
+libbsp_a_SOURCES += ../shared/armv7m/startup/bspreset.c
 libbsp_a_SOURCES += startup/bspstart.c
 
 # IRQ
diff --git a/c/src/lib/libbsp/arm/lpc176x/startup/bspreset.c b/c/src/lib/libbsp/arm/lpc176x/startup/bspreset.c
deleted file mode 100644
index 09e4d64..0000000
--- a/c/src/lib/libbsp/arm/lpc176x/startup/bspreset.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/**
- * @file
- *
- * @ingroup lpc176x
- *
- * @brief Reset code.
- */
-
-/*
- * Copyright (c) 2008-2013 embedded brains GmbH.  All rights reserved.
- *
- *  embedded brains GmbH
- *  Obere Lagerstr. 30
- *  82178 Puchheim
- *  Germany
- *  <rtems at embedded-brains.de>
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rtems.org/license/LICENSE.
- */
-
-#include <rtems.h>
-#include <rtems/score/armv7m.h>
-
-#include <bsp/bootcard.h>
-#include <bsp/lpc176x.h>
-#include <bsp/start.h>
-
-BSP_START_TEXT_SECTION __attribute__( ( flatten ) ) void bsp_reset( void )
-{
-  rtems_interrupt_level level;
-
-  (void) level;
-  rtems_interrupt_disable( level );
-
-  _ARMV7M_SCB->aircr = ARMV7M_SCB_AIRCR_VECTKEY |
-                       ARMV7M_SCB_AIRCR_SYSRESETREQ;
-
-  while ( true ) {
-    /* Do nothing */
-  }
-}
diff --git a/c/src/lib/libbsp/arm/lpc24xx/Makefile.am b/c/src/lib/libbsp/arm/lpc24xx/Makefile.am
index c7fcb86..43e6514 100644
--- a/c/src/lib/libbsp/arm/lpc24xx/Makefile.am
+++ b/c/src/lib/libbsp/arm/lpc24xx/Makefile.am
@@ -105,7 +105,8 @@ libbsp_a_SOURCES += ../../shared/cpucounterdiff.c
 
 # Startup
 libbsp_a_SOURCES += ../shared/startup/bsp-start-memcpy.S
-libbsp_a_SOURCES += startup/bspreset.c
+libbsp_a_SOURCES += ../shared/armv7m/startup/bspreset.c
+libbsp_a_SOURCES += startup/bspreset-armv4.c
 libbsp_a_SOURCES += startup/bspstart.c
 
 # IRQ
diff --git a/c/src/lib/libbsp/arm/lpc24xx/startup/bspreset.c b/c/src/lib/libbsp/arm/lpc24xx/startup/bspreset-armv4.c
similarity index 71%
rename from c/src/lib/libbsp/arm/lpc24xx/startup/bspreset.c
rename to c/src/lib/libbsp/arm/lpc24xx/startup/bspreset-armv4.c
index cb63431..c53b4e2 100644
--- a/c/src/lib/libbsp/arm/lpc24xx/startup/bspreset.c
+++ b/c/src/lib/libbsp/arm/lpc24xx/startup/bspreset-armv4.c
@@ -27,6 +27,8 @@
 #include <bsp/lpc24xx.h>
 #include <bsp/start.h>
 
+#ifdef ARM_MULTILIB_ARCH_V4
+
 BSP_START_TEXT_SECTION __attribute__((flatten)) void bsp_reset(void)
 {
   rtems_interrupt_level level;
@@ -34,19 +36,16 @@ BSP_START_TEXT_SECTION __attribute__((flatten)) void bsp_reset(void)
   (void) level;
   rtems_interrupt_disable(level);
 
-  #if defined(ARM_MULTILIB_ARCH_V4)
-    /* Trigger watchdog reset */
-    WDCLKSEL = 0;
-    WDTC = 0xff;
-    WDMOD = 0x3;
-    WDFEED = 0xaa;
-    WDFEED = 0x55;
-  #elif defined(ARM_MULTILIB_ARCH_V7M)
-    _ARMV7M_SCB->aircr = ARMV7M_SCB_AIRCR_VECTKEY
-      | ARMV7M_SCB_AIRCR_SYSRESETREQ;
-  #endif
+  /* Trigger watchdog reset */
+  WDCLKSEL = 0;
+  WDTC = 0xff;
+  WDMOD = 0x3;
+  WDFEED = 0xaa;
+  WDFEED = 0x55;
 
   while (true) {
     /* Do nothing */
   }
 }
+
+#endif /* ARM_MULTILIB_ARCH_V4 */
diff --git a/c/src/lib/libbsp/arm/lm3s69xx/startup/bspreset.c b/c/src/lib/libbsp/arm/shared/armv7m/startup/bspreset.c
similarity index 59%
rename from c/src/lib/libbsp/arm/lm3s69xx/startup/bspreset.c
rename to c/src/lib/libbsp/arm/shared/armv7m/startup/bspreset.c
index 6509f81..69b7b85 100644
--- a/c/src/lib/libbsp/arm/lm3s69xx/startup/bspreset.c
+++ b/c/src/lib/libbsp/arm/shared/armv7m/startup/bspreset.c
@@ -1,10 +1,8 @@
 /*
- * Copyright © 2013 Eugeniy Meshcheryakov <eugen at debian.org>
- *
- * Copyright (c) 2011 Sebastian Huber.  All rights reserved.
+ * Copyright (c) 2015 embedded brains GmbH.  All rights reserved.
  *
  *  embedded brains GmbH
- *  Obere Lagerstr. 30
+ *  Dornierstr. 4
  *  82178 Puchheim
  *  Germany
  *  <rtems at embedded-brains.de>
@@ -14,22 +12,27 @@
  * http://www.rtems.org/license/LICENSE.
  */
 
-
 #include <rtems.h>
 #include <rtems/score/armv7m.h>
 
 #include <bsp/bootcard.h>
+#include <bsp/start.h>
 
-void bsp_reset(void)
+#ifdef ARM_MULTILIB_ARCH_V7M
+
+BSP_START_TEXT_SECTION __attribute__((flatten)) void bsp_reset(void)
 {
   rtems_interrupt_level level;
 
+  rtems_interrupt_local_disable(level);
   (void) level;
-  rtems_interrupt_disable(level);
 
   _ARMV7M_SCB->aircr = ARMV7M_SCB_AIRCR_VECTKEY
     | ARMV7M_SCB_AIRCR_SYSRESETREQ;
 
-  while (true)
-    /* Do nothing */;
+  while (true) {
+    /* Do nothing */
+  }
 }
+
+#endif /* ARM_MULTILIB_ARCH_V7M */




More information about the vc mailing list