diff options
-rw-r--r-- | demos/PPC-SPC563M-GCC/.project | 2 | ||||
-rw-r--r-- | os/ports/GCC/PPC/SPC560Pxx/ivor.s | 126 | ||||
-rw-r--r-- | os/ports/GCC/PPC/SPC560Pxx/ld/SPC560P44.ld | 3 | ||||
-rw-r--r-- | os/ports/GCC/PPC/SPC560Pxx/port.mk | 10 | ||||
-rw-r--r-- | os/ports/GCC/PPC/SPC560Pxx/ppcparams.h | 5 | ||||
-rw-r--r-- | os/ports/GCC/PPC/SPC563Mxx/ivor.s | 35 | ||||
-rw-r--r-- | os/ports/GCC/PPC/SPC563Mxx/ppcparams.h | 5 | ||||
-rw-r--r-- | os/ports/GCC/PPC/chcore.c | 15 | ||||
-rw-r--r-- | os/ports/GCC/PPC/chcore.h | 12 |
9 files changed, 137 insertions, 76 deletions
diff --git a/demos/PPC-SPC563M-GCC/.project b/demos/PPC-SPC563M-GCC/.project index e13b1c200..562a9ec5e 100644 --- a/demos/PPC-SPC563M-GCC/.project +++ b/demos/PPC-SPC563M-GCC/.project @@ -27,7 +27,7 @@ <link>
<name>board</name>
<type>2</type>
- <locationURI>CHIBIOS/boards/GENERIC_SPC563</locationURI>
+ <locationURI>CHIBIOS/boards/GENERIC_SPC563M</locationURI>
</link>
<link>
<name>os</name>
diff --git a/os/ports/GCC/PPC/SPC560Pxx/ivor.s b/os/ports/GCC/PPC/SPC560Pxx/ivor.s index c57899b9a..2561b4eb6 100644 --- a/os/ports/GCC/PPC/SPC560Pxx/ivor.s +++ b/os/ports/GCC/PPC/SPC560Pxx/ivor.s @@ -43,66 +43,76 @@ .section .handlers, "ax"
/*
- * IVOR10 handler (Book-E decrementer).
+ * Fixed IVOR offset table.
*/
- .align 4
- .globl IVOR10
-IVOR10:
- /* Creation of the external stack frame (extctx structure).*/
- stwu %sp, -80(%sp) /* Size of the extctx structure.*/
-#if PPC_USE_VLE && PPC_SUPPORTS_VLE_MULTI
- e_stmvsrrw 8(%sp) /* Saves PC, MSR. */
- e_stmvsprw 16(%sp) /* Saves CR, LR, CTR, XER. */
- e_stmvgprw 32(%sp) /* Saves GPR0, GPR3...GPR12. */
-#else /* !(PPC_USE_VLE && PPC_SUPPORTS_VLE_MULTI) */
- stw %r0, 32(%sp) /* Saves GPR0. */
- mfSRR0 %r0
- stw %r0, 8(%sp) /* Saves PC. */
- mfSRR1 %r0
- stw %r0, 12(%sp) /* Saves MSR. */
- mfCR %r0
- stw %r0, 16(%sp) /* Saves CR. */
- mfLR %r0
- stw %r0, 20(%sp) /* Saves LR. */
- mfCTR %r0
- stw %r0, 24(%sp) /* Saves CTR. */
- mfXER %r0
- stw %r0, 28(%sp) /* Saves XER. */
- stw %r3, 36(%sp) /* Saves GPR3...GPR12. */
- stw %r4, 40(%sp)
- stw %r5, 44(%sp)
- stw %r6, 48(%sp)
- stw %r7, 52(%sp)
- stw %r8, 56(%sp)
- stw %r9, 60(%sp)
- stw %r10, 64(%sp)
- stw %r11, 68(%sp)
- stw %r12, 72(%sp)
-#endif /* !(PPC_USE_VLE && PPC_SUPPORTS_VLE_MULTI) */
-
- /* Reset DIE bit in TSR register.*/
- lis %r3, 0x0800 /* DIS bit mask. */
- mtspr 336, %r3 /* TSR register. */
-
-#if CH_DBG_SYSTEM_STATE_CHECK
- bl dbg_check_enter_isr
- bl dbg_check_lock_from_isr
-#endif
- bl chSysTimerHandlerI
-#if CH_DBG_SYSTEM_STATE_CHECK
- bl dbg_check_unlock_from_isr
- bl dbg_check_leave_isr
-#endif
+ .globl IVORS
+IVORS: b IVOR0
+ .align 16
+ b IVOR1
+ .align 16
+ b IVOR2
+ .align 16
+ b IVOR3
+ .align 16
+ b IVOR4
+ .align 16
+ b IVOR5
+ .align 16
+ b IVOR6
+ .align 16
+ b IVOR7
+ .align 16
+ b IVOR8
+ .align 16
+ b IVOR9
+ .align 16
+ b IVOR10
+ .align 16
+ b IVOR11
+ .align 16
+ b IVOR12
+ .align 16
+ b IVOR13
+ .align 16
+ b IVOR14
+ .align 16
+ b IVOR15
- /* System tick handler invocation.*/
-#if CH_DBG_SYSTEM_STATE_CHECK
- bl dbg_check_lock
-#endif
- bl chSchIsPreemptionRequired
- cmpli cr0, %r3, 0
- beq cr0, .ctxrestore
- bl chSchDoReschedule
- b .ctxrestore
+ /*
+ * Unhandled exceptions handler.
+ */
+ .weak IVOR0
+IVOR0:
+ .weak IVOR1
+IVOR1:
+ .weak IVOR2
+IVOR2:
+ .weak IVOR3
+IVOR3:
+ .weak IVOR5
+IVOR5:
+ .weak IVOR6
+IVOR6:
+ .weak IVOR7
+IVOR7:
+ .weak IVOR8
+IVOR8:
+ .weak IVOR9
+IVOR9:
+ .weak IVOR10
+IVOR10:
+ .weak IVOR11
+IVOR11:
+ .weak IVOR12
+IVOR12:
+ .weak IVOR13
+IVOR13:
+ .weak IVOR14
+IVOR14:
+ .weak IVOR15
+IVOR15:
+_unhandled_exception:
+ b _unhandled_exception
/*
* IVOR4 handler (Book-E external interrupt).
diff --git a/os/ports/GCC/PPC/SPC560Pxx/ld/SPC560P44.ld b/os/ports/GCC/PPC/SPC560Pxx/ld/SPC560P44.ld index c70a20194..cf2216867 100644 --- a/os/ports/GCC/PPC/SPC560Pxx/ld/SPC560P44.ld +++ b/os/ports/GCC/PPC/SPC560Pxx/ld/SPC560P44.ld @@ -50,8 +50,9 @@ SECTIONS __ivpr_base__ = .;
KEEP(*(.bam))
KEEP(*(.crt0))
+ . = ALIGN(0x00000800);
KEEP(*(.handlers))
- . = ALIGN(0x800);
+ . = ALIGN(0x00001000);
KEEP(*(.vectors))
} > flash
diff --git a/os/ports/GCC/PPC/SPC560Pxx/port.mk b/os/ports/GCC/PPC/SPC560Pxx/port.mk index 460d4e1f9..388268b38 100644 --- a/os/ports/GCC/PPC/SPC560Pxx/port.mk +++ b/os/ports/GCC/PPC/SPC560Pxx/port.mk @@ -1,11 +1,11 @@ -# List of the ChibiOS/RT SPC563Mxx port files.
+# List of the ChibiOS/RT SPC560Pxx port files.
PORTSRC = ${CHIBIOS}/os/ports/GCC/PPC/chcore.c
-PORTASM = ${CHIBIOS}/os/ports/GCC/PPC/SPC563Mxx/vectors.s \
- ${CHIBIOS}/os/ports/GCC/PPC/SPC563Mxx/ivor.s \
+PORTASM = ${CHIBIOS}/os/ports/GCC/PPC/SPC560Pxx/vectors.s \
+ ${CHIBIOS}/os/ports/GCC/PPC/SPC560Pxx/ivor.s \
${CHIBIOS}/os/ports/GCC/PPC/crt0.s
PORTINC = ${CHIBIOS}/os/ports/GCC/PPC \
- ${CHIBIOS}/os/ports/GCC/PPC/SPC563Mxx
+ ${CHIBIOS}/os/ports/GCC/PPC/SPC560Pxx
-PORTLD = ${CHIBIOS}/os/ports/GCC/PPC/SPC563Mxx/ld
+PORTLD = ${CHIBIOS}/os/ports/GCC/PPC/SPC560Pxx/ld
diff --git a/os/ports/GCC/PPC/SPC560Pxx/ppcparams.h b/os/ports/GCC/PPC/SPC560Pxx/ppcparams.h index 1d3d34a45..34f49449d 100644 --- a/os/ports/GCC/PPC/SPC560Pxx/ppcparams.h +++ b/os/ports/GCC/PPC/SPC560Pxx/ppcparams.h @@ -38,6 +38,11 @@ #define PPC_VARIANT PPC_VARIANT_e200z0
/**
+ * @brief IVORx registers support.
+ */
+#define PPC_SUPPORTS_IVORS FALSE
+
+/**
* @brief Book E instruction set support.
*/
#define PPC_SUPPORTS_BOOKE FALSE
diff --git a/os/ports/GCC/PPC/SPC563Mxx/ivor.s b/os/ports/GCC/PPC/SPC563Mxx/ivor.s index 19a8efd4e..fe85492dc 100644 --- a/os/ports/GCC/PPC/SPC563Mxx/ivor.s +++ b/os/ports/GCC/PPC/SPC563Mxx/ivor.s @@ -43,6 +43,41 @@ .section .handlers, "ax"
/*
+ * Unhandled exceptions handler.
+ */
+ .weak IVOR0
+IVOR0:
+ .weak IVOR1
+IVOR1:
+ .weak IVOR2
+IVOR2:
+ .weak IVOR3
+IVOR3:
+ .weak IVOR5
+IVOR5:
+ .weak IVOR6
+IVOR6:
+ .weak IVOR7
+IVOR7:
+ .weak IVOR8
+IVOR8:
+ .weak IVOR9
+IVOR9:
+ .weak IVOR11
+IVOR11:
+ .weak IVOR12
+IVOR12:
+ .weak IVOR13
+IVOR13:
+ .weak IVOR14
+IVOR14:
+ .weak IVOR15
+IVOR15:
+ .globl _unhandled_exception
+_unhandled_exception:
+ b _unhandled_exception
+
+ /*
* IVOR10 handler (Book-E decrementer).
*/
.align 4
diff --git a/os/ports/GCC/PPC/SPC563Mxx/ppcparams.h b/os/ports/GCC/PPC/SPC563Mxx/ppcparams.h index 75823f629..135818bd3 100644 --- a/os/ports/GCC/PPC/SPC563Mxx/ppcparams.h +++ b/os/ports/GCC/PPC/SPC563Mxx/ppcparams.h @@ -38,6 +38,11 @@ #define PPC_VARIANT PPC_VARIANT_e200z3
/**
+ * @brief IVORx registers support.
+ */
+#define PPC_SUPPORTS_IVORS TRUE
+
+/**
* @brief Book E instruction set support.
*/
#define PPC_SUPPORTS_BOOKE TRUE
diff --git a/os/ports/GCC/PPC/chcore.c b/os/ports/GCC/PPC/chcore.c index 87404e4c5..5fd97a14b 100644 --- a/os/ports/GCC/PPC/chcore.c +++ b/os/ports/GCC/PPC/chcore.c @@ -29,6 +29,21 @@ #include "ch.h"
/**
+ * @brief Kernel port layer initialization.
+ * @details IVOR4 and IVOR10 initialization.
+ */
+void port_init(void) {
+#if PPC_SUPPORTS_IVORS
+ /* The CPU support IVOR registers, the kernel requires IVOR4 and IVOR10
+ and the initialization is performed here.*/
+ asm volatile ("li %r3, IVOR4@l \t\n"
+ "mtIVOR4 %r3 \t\n"
+ "li %r3, IVOR10@l \t\n"
+ "mtIVOR10 %r3");
+#endif
+}
+
+/**
* @brief Halts the system.
* @details This function is invoked by the operating system when an
* unrecoverable error is detected (for example because a programming
diff --git a/os/ports/GCC/PPC/chcore.h b/os/ports/GCC/PPC/chcore.h index ffdc32fe3..0a4476ea4 100644 --- a/os/ports/GCC/PPC/chcore.h +++ b/os/ports/GCC/PPC/chcore.h @@ -309,17 +309,6 @@ struct context { #define PORT_IRQ_HANDLER(id) void id(void)
/**
- * @brief Kernel port layer initialization.
- * @details IVPR4 and IVPR10 initialization, INTC_IACKR_PRC0 initialization.
- */
-#define port_init() { \
- asm volatile ("li %r3, IVOR4@l \t\n" \
- "mtIVOR4 %r3 \t\n" \
- "li %r3, IVOR10@l \t\n" \
- "mtIVOR10 %r3"); \
-}
-
-/**
* @details Implemented as global interrupt disable.
*/
#define port_lock() asm volatile ("wrteei 0" : : : "memory")
@@ -372,6 +361,7 @@ struct context { #ifdef __cplusplus
extern "C" {
#endif
+ void port_init(void);
void port_halt(void);
void port_switch(Thread *ntp, Thread *otp);
void _port_thread_start(void);
|