summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-01-12 14:44:10 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-01-19 08:36:19 +0100
commitb32a9cdc1eb893886f21be01bc0a5c1367b6e8be (patch)
treed36dad20fce59ba5916e0809d968e7aa76603ef4
parent2916a33057afb015e86cdd4cbd9955a3351682ad (diff)
downloadrtems-b32a9cdc1eb893886f21be01bc0a5c1367b6e8be.tar.bz2
bsps/arm: Use common ARMv7-M bsp_reset()
-rw-r--r--c/src/lib/libbsp/arm/lm3s69xx/Makefile.am2
-rw-r--r--c/src/lib/libbsp/arm/lpc176x/Makefile.am2
-rw-r--r--c/src/lib/libbsp/arm/lpc176x/startup/bspreset.c43
-rw-r--r--c/src/lib/libbsp/arm/lpc24xx/Makefile.am3
-rw-r--r--c/src/lib/libbsp/arm/lpc24xx/startup/bspreset-armv4.c (renamed from c/src/lib/libbsp/arm/lpc24xx/startup/bspreset.c)21
-rw-r--r--c/src/lib/libbsp/arm/shared/armv7m/startup/bspreset.c (renamed from c/src/lib/libbsp/arm/lm3s69xx/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 8d9700143f..9fab35fd1b 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 352b2d97fe..659ee49f67 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 09e4d64800..0000000000
--- 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@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 c7fcb86d13..43e65143f1 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
index cb634317b4..c53b4e2447 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
index 6509f81eff..69b7b85f8c 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@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@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 */