diff options
author | Giovanni Di Sirio <gdisirio@gmail.com> | 2015-11-18 09:39:41 +0000 |
---|---|---|
committer | Giovanni Di Sirio <gdisirio@gmail.com> | 2015-11-18 09:39:41 +0000 |
commit | da4c0dbaa0a453af6b1903554ccff1df7b98825c (patch) | |
tree | 97e3d0d8ffec0947fc1195b353da4557ec30b6ee /os | |
parent | 5f2b47e17bbddd663b5237f3d235375f69f88d4f (diff) | |
download | ChibiOS-da4c0dbaa0a453af6b1903554ccff1df7b98825c.tar.gz ChibiOS-da4c0dbaa0a453af6b1903554ccff1df7b98825c.tar.bz2 ChibiOS-da4c0dbaa0a453af6b1903554ccff1df7b98825c.zip |
Improvements to the e200 RT port.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@8507 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os')
-rw-r--r-- | os/common/ports/e200/compilers/GCC/mk/startup_spc560bcxx.mk | 11 | ||||
-rw-r--r-- | os/common/ports/e200/compilers/GCC/mk/startup_spc560bxx.mk | 11 | ||||
-rw-r--r-- | os/common/ports/e200/compilers/GCC/mk/startup_spc560dxx.mk | 11 | ||||
-rw-r--r-- | os/common/ports/e200/compilers/GCC/mk/startup_spc560pxx.mk | 11 | ||||
-rw-r--r-- | os/common/ports/e200/compilers/GCC/mk/startup_spc563mxx.mk | 11 | ||||
-rw-r--r-- | os/common/ports/e200/compilers/GCC/mk/startup_spc564axx.mk | 11 | ||||
-rw-r--r-- | os/common/ports/e200/compilers/GCC/mk/startup_spc56ecxx.mk | 11 | ||||
-rw-r--r-- | os/common/ports/e200/compilers/GCC/mk/startup_spc56elxx.mk | 11 | ||||
-rw-r--r-- | os/rt/ports/e200/chcore.c | 57 | ||||
-rw-r--r-- | os/rt/ports/e200/chcore.h | 2 | ||||
-rw-r--r-- | os/rt/ports/e200/compilers/GCC/chcoreasm.s | 97 |
11 files changed, 188 insertions, 56 deletions
diff --git a/os/common/ports/e200/compilers/GCC/mk/startup_spc560bcxx.mk b/os/common/ports/e200/compilers/GCC/mk/startup_spc560bcxx.mk new file mode 100644 index 000000000..2e067b149 --- /dev/null +++ b/os/common/ports/e200/compilers/GCC/mk/startup_spc560bcxx.mk @@ -0,0 +1,11 @@ +# List of the ChibiOS e200z0 SPC560BCxx startup files.
+STARTUPSRC =
+
+STARTUPASM = $(CHIBIOS)/os/common/ports/e200/devices/SPC560BCxx/boot.s \
+ $(CHIBIOS)/os/common/ports/e200/compilers/GCC/vectors.s \
+ $(CHIBIOS)/os/common/ports/e200/compilers/GCC/crt0.s
+
+STARTUPINC = ${CHIBIOS}/os/common/ports/e200/compilers/GCC \
+ ${CHIBIOS}/os/common/ports/e200/devices/SPC560BCxx
+
+STARTUPLD = ${CHIBIOS}/os/common/ports/e200/compilers/GCC/ld
diff --git a/os/common/ports/e200/compilers/GCC/mk/startup_spc560bxx.mk b/os/common/ports/e200/compilers/GCC/mk/startup_spc560bxx.mk new file mode 100644 index 000000000..5cfc4a81e --- /dev/null +++ b/os/common/ports/e200/compilers/GCC/mk/startup_spc560bxx.mk @@ -0,0 +1,11 @@ +# List of the ChibiOS e200z0 SPC560Bxx startup files.
+STARTUPSRC =
+
+STARTUPASM = $(CHIBIOS)/os/common/ports/e200/devices/SPC560Bxx/boot.s \
+ $(CHIBIOS)/os/common/ports/e200/compilers/GCC/vectors.s \
+ $(CHIBIOS)/os/common/ports/e200/compilers/GCC/crt0.s
+
+STARTUPINC = ${CHIBIOS}/os/common/ports/e200/compilers/GCC \
+ ${CHIBIOS}/os/common/ports/e200/devices/SPC560Bxx
+
+STARTUPLD = ${CHIBIOS}/os/common/ports/e200/compilers/GCC/ld
diff --git a/os/common/ports/e200/compilers/GCC/mk/startup_spc560dxx.mk b/os/common/ports/e200/compilers/GCC/mk/startup_spc560dxx.mk new file mode 100644 index 000000000..4e8b633fd --- /dev/null +++ b/os/common/ports/e200/compilers/GCC/mk/startup_spc560dxx.mk @@ -0,0 +1,11 @@ +# List of the ChibiOS e200z0 SPC560Dxx startup files.
+STARTUPSRC =
+
+STARTUPASM = $(CHIBIOS)/os/common/ports/e200/devices/SPC560Dxx/boot.s \
+ $(CHIBIOS)/os/common/ports/e200/compilers/GCC/vectors.s \
+ $(CHIBIOS)/os/common/ports/e200/compilers/GCC/crt0.s
+
+STARTUPINC = ${CHIBIOS}/os/common/ports/e200/compilers/GCC \
+ ${CHIBIOS}/os/common/ports/e200/devices/SPC560Dxx
+
+STARTUPLD = ${CHIBIOS}/os/common/ports/e200/compilers/GCC/ld
diff --git a/os/common/ports/e200/compilers/GCC/mk/startup_spc560pxx.mk b/os/common/ports/e200/compilers/GCC/mk/startup_spc560pxx.mk new file mode 100644 index 000000000..72a62d787 --- /dev/null +++ b/os/common/ports/e200/compilers/GCC/mk/startup_spc560pxx.mk @@ -0,0 +1,11 @@ +# List of the ChibiOS e200z0 SPC560Pxx startup files.
+STARTUPSRC =
+
+STARTUPASM = $(CHIBIOS)/os/common/ports/e200/devices/SPC560Pxx/boot.s \
+ $(CHIBIOS)/os/common/ports/e200/compilers/GCC/vectors.s \
+ $(CHIBIOS)/os/common/ports/e200/compilers/GCC/crt0.s
+
+STARTUPINC = ${CHIBIOS}/os/common/ports/e200/compilers/GCC \
+ ${CHIBIOS}/os/common/ports/e200/devices/SPC560Pxx
+
+STARTUPLD = ${CHIBIOS}/os/common/ports/e200/compilers/GCC/ld
diff --git a/os/common/ports/e200/compilers/GCC/mk/startup_spc563mxx.mk b/os/common/ports/e200/compilers/GCC/mk/startup_spc563mxx.mk new file mode 100644 index 000000000..92af14e4c --- /dev/null +++ b/os/common/ports/e200/compilers/GCC/mk/startup_spc563mxx.mk @@ -0,0 +1,11 @@ +# List of the ChibiOS e200z3 SPC563Mxx startup files.
+STARTUPSRC =
+
+STARTUPASM = $(CHIBIOS)/os/common/ports/e200/devices/SPC563Mxx/boot.s \
+ $(CHIBIOS)/os/common/ports/e200/compilers/GCC/vectors.s \
+ $(CHIBIOS)/os/common/ports/e200/compilers/GCC/crt0.s
+
+STARTUPINC = ${CHIBIOS}/os/common/ports/e200/compilers/GCC \
+ ${CHIBIOS}/os/common/ports/e200/devices/SPC563Mxx
+
+STARTUPLD = ${CHIBIOS}/os/common/ports/e200/compilers/GCC/ld
diff --git a/os/common/ports/e200/compilers/GCC/mk/startup_spc564axx.mk b/os/common/ports/e200/compilers/GCC/mk/startup_spc564axx.mk new file mode 100644 index 000000000..a903aa8ff --- /dev/null +++ b/os/common/ports/e200/compilers/GCC/mk/startup_spc564axx.mk @@ -0,0 +1,11 @@ +# List of the ChibiOS e200z4 SPC564Axx startup files.
+STARTUPSRC =
+
+STARTUPASM = $(CHIBIOS)/os/common/ports/e200/devices/SPC564Axx/boot.s \
+ $(CHIBIOS)/os/common/ports/e200/compilers/GCC/vectors.s \
+ $(CHIBIOS)/os/common/ports/e200/compilers/GCC/crt0.s
+
+STARTUPINC = ${CHIBIOS}/os/common/ports/e200/compilers/GCC \
+ ${CHIBIOS}/os/common/ports/e200/devices/SPC564Axx
+
+STARTUPLD = ${CHIBIOS}/os/common/ports/e200/compilers/GCC/ld
diff --git a/os/common/ports/e200/compilers/GCC/mk/startup_spc56ecxx.mk b/os/common/ports/e200/compilers/GCC/mk/startup_spc56ecxx.mk new file mode 100644 index 000000000..d2377e57f --- /dev/null +++ b/os/common/ports/e200/compilers/GCC/mk/startup_spc56ecxx.mk @@ -0,0 +1,11 @@ +# List of the ChibiOS e200z4 SPC56ECxx startup files.
+STARTUPSRC =
+
+STARTUPASM = $(CHIBIOS)/os/common/ports/e200/devices/SPC56ECxx/boot.s \
+ $(CHIBIOS)/os/common/ports/e200/compilers/GCC/vectors.s \
+ $(CHIBIOS)/os/common/ports/e200/compilers/GCC/crt0.s
+
+STARTUPINC = ${CHIBIOS}/os/common/ports/e200/compilers/GCC \
+ ${CHIBIOS}/os/common/ports/e200/devices/SPC56ECxx
+
+STARTUPLD = ${CHIBIOS}/os/common/ports/e200/compilers/GCC/ld
diff --git a/os/common/ports/e200/compilers/GCC/mk/startup_spc56elxx.mk b/os/common/ports/e200/compilers/GCC/mk/startup_spc56elxx.mk new file mode 100644 index 000000000..40753b63f --- /dev/null +++ b/os/common/ports/e200/compilers/GCC/mk/startup_spc56elxx.mk @@ -0,0 +1,11 @@ +# List of the ChibiOS e200z4 SPC56ELxx startup files.
+STARTUPSRC =
+
+STARTUPASM = $(CHIBIOS)/os/common/ports/e200/devices/SPC56ELxx/boot.s \
+ $(CHIBIOS)/os/common/ports/e200/compilers/GCC/vectors.s \
+ $(CHIBIOS)/os/common/ports/e200/compilers/GCC/crt0.s
+
+STARTUPINC = ${CHIBIOS}/os/common/ports/e200/compilers/GCC \
+ ${CHIBIOS}/os/common/ports/e200/devices/SPC56ELxx
+
+STARTUPLD = ${CHIBIOS}/os/common/ports/e200/compilers/GCC/ld
diff --git a/os/rt/ports/e200/chcore.c b/os/rt/ports/e200/chcore.c index 28fb8926b..5f410b88f 100644 --- a/os/rt/ports/e200/chcore.c +++ b/os/rt/ports/e200/chcore.c @@ -18,8 +18,8 @@ */
/**
- * @file PPC/chcore.c
- * @brief PowerPC architecture port code.
+ * @file e200/chcore.c
+ * @brief Power e200 port code.
*
* @addtogroup PPC_CORE
* @{
@@ -51,57 +51,4 @@ /* Module exported functions. */
/*===========================================================================*/
-/**
- * @brief Performs a context switch between two threads.
- * @details This is the most critical code in any port, this function
- * is responsible for the context switch between 2 threads.
- * @note The implementation of this code affects <b>directly</b> the context
- * switch performance so optimize here as much as you can.
- */
-#if !defined(__DOXYGEN__)
-__attribute__((naked))
-#endif
-void port_dummy1(void) {
-
- asm (".global _port_switch");
- asm ("_port_switch:");
- asm ("subi %sp, %sp, 80"); /* Size of the intctx structure. */
- asm ("mflr %r0");
- asm ("stw %r0, 84(%sp)"); /* LR into the caller frame. */
- asm ("mfcr %r0");
- asm ("stw %r0, 0(%sp)"); /* CR. */
- asm ("stmw %r14, 4(%sp)"); /* GPR14...GPR31. */
-
- asm ("stw %sp, 12(%r4)"); /* Store swapped-out stack. */
- asm ("lwz %sp, 12(%r3)"); /* Load swapped-in stack. */
-
- asm ("lmw %r14, 4(%sp)"); /* GPR14...GPR31. */
- asm ("lwz %r0, 0(%sp)"); /* CR. */
- asm ("mtcr %r0");
- asm ("lwz %r0, 84(%sp)"); /* LR from the caller frame. */
- asm ("mtlr %r0");
- asm ("addi %sp, %sp, 80"); /* Size of the intctx structure. */
- asm ("blr");
-}
-
-/**
- * @brief Start a thread by invoking its work function.
- * @details If the work function returns @p chThdExit() is automatically
- * invoked.
- */
-#if !defined(__DOXYGEN__)
-__attribute__((naked))
-#endif
-void port_dummy2(void) {
-
- asm (".global _port_thread_start");
- asm ("_port_thread_start:");
- chSysUnlock();
- asm ("mr %r3, %r31"); /* Thread parameter. */
- asm ("mtctr %r30");
- asm ("bctrl"); /* Invoke thread function. */
- asm ("li %r0, 0"); /* MSG_OK. */
- asm ("bl chThdExit"); /* Thread termination on exit. */
-}
-
/** @} */
diff --git a/os/rt/ports/e200/chcore.h b/os/rt/ports/e200/chcore.h index 56c30fb57..67da6c67d 100644 --- a/os/rt/ports/e200/chcore.h +++ b/os/rt/ports/e200/chcore.h @@ -19,7 +19,7 @@ /**
* @file PPC/chcore.h
- * @brief PowerPC architecture port macros and structures.
+ * @brief Power e200 port macros and structures.
*
* @addtogroup PPC_CORE
* @{
diff --git a/os/rt/ports/e200/compilers/GCC/chcoreasm.s b/os/rt/ports/e200/compilers/GCC/chcoreasm.s new file mode 100644 index 000000000..624c0b7a4 --- /dev/null +++ b/os/rt/ports/e200/compilers/GCC/chcoreasm.s @@ -0,0 +1,97 @@ +/*
+ ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio.
+
+ This file is part of ChibiOS.
+
+ ChibiOS is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ ChibiOS is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+/**
+ * @file e200/compilers/GCC/chcoreasm.s
+ * @brief Power Architecture port low level code.
+ *
+ * @addtogroup PPC_GCC_CORE
+ * @{
+ */
+
+/*===========================================================================*/
+/* Module constants. */
+/*===========================================================================*/
+
+#if !defined(FALSE) || defined(__DOXYGEN__)
+#define FALSE 0
+#endif
+
+#if !defined(TRUE) || defined(__DOXYGEN__)
+#define TRUE 1
+#endif
+
+/*===========================================================================*/
+/* Code section. */
+/*===========================================================================*/
+
+#define _FROM_ASM_
+#include "chconf.h"
+#include "chcore.h"
+
+#if !defined(__DOXYGEN__)
+
+#if PPC_USE_VLE == TRUE
+ .section .text_vle, "ax"
+#else
+ .section .text, "ax"
+#endif
+
+ .align 2
+ .globl _port_switch
+ .type _port_switch, @function
+_port_switch:
+ subi %sp, %sp, 80
+ mflr %r0
+ stw %r0, 84(%sp)
+ mfcr %r0
+ stw %r0, 0(%sp)
+ stmw %r14, 4(%sp)
+
+ stw %sp, 12(%r4)
+ lwz %sp, 12(%r3)
+
+ lmw %r14, 4(%sp)
+ lwz %r0, 0(%sp)
+ mtcr %r0
+ lwz %r0, 84(%sp)
+ mtlr %r0
+ addi %sp, %sp, 80
+ blr
+
+ .align 2
+ .globl _port_thread_start
+ .type _port_thread_start, @function
+_port_thread_start:
+#if CH_DBG_SYSTEM_STATE_CHECK
+ bl _dbg_check_unlock
+#endif
+#if CH_DBG_STATISTICS
+ bl _stats_stop_measure_crit_thd
+#endif
+ wrteei 1
+ mr %r3, %r31
+ mtctr %r30
+ bctrl
+ li %r0, 0
+ bl chThdExit
+
+#endif /* !defined(__DOXYGEN__) */
+
+/** @} */
|