[rtems commit] arm: Add _CPU_Thread_Idle_body for ARMv7-M

Sebastian Huber sebh at rtems.org
Wed Nov 21 15:36:30 UTC 2012


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

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Sun Nov 18 19:47:40 2012 +0100

arm: Add _CPU_Thread_Idle_body for ARMv7-M

---

 cpukit/score/cpu/arm/Makefile.am          |    1 +
 cpukit/score/cpu/arm/armv7m-thread-idle.c |   30 +++++++++++++++++++++++++++++
 cpukit/score/cpu/arm/rtems/score/cpu.h    |   10 ++++++++-
 3 files changed, 40 insertions(+), 1 deletions(-)

diff --git a/cpukit/score/cpu/arm/Makefile.am b/cpukit/score/cpu/arm/Makefile.am
index cf511c9..0da1984 100644
--- a/cpukit/score/cpu/arm/Makefile.am
+++ b/cpukit/score/cpu/arm/Makefile.am
@@ -33,6 +33,7 @@ libscorecpu_a_SOURCES += armv7m-isr-level-get.c
 libscorecpu_a_SOURCES += armv7m-isr-level-set.c
 libscorecpu_a_SOURCES += armv7m-isr-vector-install.c
 libscorecpu_a_SOURCES += armv7m-multitasking-start-stop.c
+libscorecpu_a_SOURCES += armv7m-thread-idle.c
 
 include $(srcdir)/preinstall.am
 include $(top_srcdir)/automake/local.am
diff --git a/cpukit/score/cpu/arm/armv7m-thread-idle.c b/cpukit/score/cpu/arm/armv7m-thread-idle.c
new file mode 100644
index 0000000..cc9a05c
--- /dev/null
+++ b/cpukit/score/cpu/arm/armv7m-thread-idle.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2012 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.com/license/LICENSE.
+ */
+
+#ifdef HAVE_CONFIG_H
+  #include "config.h"
+#endif
+
+#include <rtems/score/cpu.h>
+
+#ifdef ARM_MULTILIB_ARCH_V7M
+
+void *_CPU_Thread_Idle_body( uintptr_t ignored )
+{
+  while ( true ) {
+    __asm__ volatile ("wfi");
+  }
+}
+
+#endif /* ARM_MULTILIB_ARCH_V7M */
diff --git a/cpukit/score/cpu/arm/rtems/score/cpu.h b/cpukit/score/cpu/arm/rtems/score/cpu.h
index b12133f..5cc378a 100644
--- a/cpukit/score/cpu/arm/rtems/score/cpu.h
+++ b/cpukit/score/cpu/arm/rtems/score/cpu.h
@@ -147,7 +147,11 @@
 
 #define CPU_USE_DEFERRED_FP_SWITCH FALSE
 
-#define CPU_PROVIDES_IDLE_THREAD_BODY FALSE
+#if defined(ARM_MULTILIB_ARCH_V7M)
+  #define CPU_PROVIDES_IDLE_THREAD_BODY TRUE
+#else
+  #define CPU_PROVIDES_IDLE_THREAD_BODY FALSE
+#endif
 
 #define CPU_STACK_GROWS_UP FALSE
 
@@ -461,6 +465,10 @@ static inline uint16_t CPU_swap_u16( uint16_t value )
 #endif
 }
 
+#if CPU_PROVIDES_IDLE_THREAD_BODY == TRUE
+  void *_CPU_Thread_Idle_body( uintptr_t ignored );
+#endif
+
 /** @} */
 
 #if defined(ARM_MULTILIB_ARCH_V4)




More information about the vc mailing list