[PATCH 4/8] bsps/arm: Use common ARMv7-M bsp_reset()
Sebastian Huber
sebastian.huber at embedded-brains.de
Fri Jan 15 13:44:21 UTC 2016
---
c/src/lib/libbsp/arm/lm3s69xx/Makefile.am | 2 +-
c/src/lib/libbsp/arm/lm3s69xx/startup/bspreset.c | 35 ------------------
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 | 1 +
c/src/lib/libbsp/arm/lpc24xx/startup/bspreset.c | 21 +++++------
.../libbsp/arm/shared/armv7m/startup/bspreset.c | 38 +++++++++++++++++++
7 files changed, 51 insertions(+), 91 deletions(-)
delete mode 100644 c/src/lib/libbsp/arm/lm3s69xx/startup/bspreset.c
delete mode 100644 c/src/lib/libbsp/arm/lpc176x/startup/bspreset.c
create mode 100644 c/src/lib/libbsp/arm/shared/armv7m/startup/bspreset.c
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/lm3s69xx/startup/bspreset.c b/c/src/lib/libbsp/arm/lm3s69xx/startup/bspreset.c
deleted file mode 100644
index 6509f81..0000000
--- a/c/src/lib/libbsp/arm/lm3s69xx/startup/bspreset.c
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright © 2013 Eugeniy Meshcheryakov <eugen at debian.org>
- *
- * Copyright (c) 2011 Sebastian Huber. 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>
-
-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/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..ef6f595 100644
--- a/c/src/lib/libbsp/arm/lpc24xx/Makefile.am
+++ b/c/src/lib/libbsp/arm/lpc24xx/Makefile.am
@@ -105,6 +105,7 @@ libbsp_a_SOURCES += ../../shared/cpucounterdiff.c
# Startup
libbsp_a_SOURCES += ../shared/startup/bsp-start-memcpy.S
+libbsp_a_SOURCES += ../shared/armv7m/startup/bspreset.c
libbsp_a_SOURCES += startup/bspreset.c
libbsp_a_SOURCES += startup/bspstart.c
diff --git a/c/src/lib/libbsp/arm/lpc24xx/startup/bspreset.c b/c/src/lib/libbsp/arm/lpc24xx/startup/bspreset.c
index cb63431..c53b4e2 100644
--- a/c/src/lib/libbsp/arm/lpc24xx/startup/bspreset.c
+++ b/c/src/lib/libbsp/arm/lpc24xx/startup/bspreset.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/shared/armv7m/startup/bspreset.c b/c/src/lib/libbsp/arm/shared/armv7m/startup/bspreset.c
new file mode 100644
index 0000000..69b7b85
--- /dev/null
+++ b/c/src/lib/libbsp/arm/shared/armv7m/startup/bspreset.c
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2015 embedded brains GmbH. All rights reserved.
+ *
+ * embedded brains GmbH
+ * Dornierstr. 4
+ * 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/start.h>
+
+#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;
+
+ _ARMV7M_SCB->aircr = ARMV7M_SCB_AIRCR_VECTKEY
+ | ARMV7M_SCB_AIRCR_SYSRESETREQ;
+
+ while (true) {
+ /* Do nothing */
+ }
+}
+
+#endif /* ARM_MULTILIB_ARCH_V7M */
--
1.8.4.5
More information about the devel
mailing list