From 19d00906e03d611593ab5a4fe258b515c527f7f2 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Thu, 15 Nov 2012 11:27:53 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4820 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/ports/GCC/PPC/SPC560BCxx/bam.s | 38 ++ os/ports/GCC/PPC/SPC560BCxx/ivor.s | 234 +++++++ os/ports/GCC/PPC/SPC560BCxx/ld/SPC560B44.ld | 178 ++++++ os/ports/GCC/PPC/SPC560BCxx/ld/SPC560B50.ld | 178 ++++++ os/ports/GCC/PPC/SPC560BCxx/port.mk | 12 + os/ports/GCC/PPC/SPC560BCxx/ppcparams.h | 67 ++ os/ports/GCC/PPC/SPC560BCxx/vectors.s | 917 ++++++++++++++++++++++++++++ os/ports/GCC/PPC/SPC560Pxx/ld/SPC560P44.ld | 4 +- os/ports/GCC/PPC/SPC560Pxx/ld/SPC560P50.ld | 178 ++++++ os/ports/GCC/PPC/SPC560Pxx/ppcparams.h | 5 + os/ports/GCC/PPC/chcore.h | 9 +- 11 files changed, 1815 insertions(+), 5 deletions(-) create mode 100644 os/ports/GCC/PPC/SPC560BCxx/bam.s create mode 100644 os/ports/GCC/PPC/SPC560BCxx/ivor.s create mode 100644 os/ports/GCC/PPC/SPC560BCxx/ld/SPC560B44.ld create mode 100644 os/ports/GCC/PPC/SPC560BCxx/ld/SPC560B50.ld create mode 100644 os/ports/GCC/PPC/SPC560BCxx/port.mk create mode 100644 os/ports/GCC/PPC/SPC560BCxx/ppcparams.h create mode 100644 os/ports/GCC/PPC/SPC560BCxx/vectors.s create mode 100644 os/ports/GCC/PPC/SPC560Pxx/ld/SPC560P50.ld diff --git a/os/ports/GCC/PPC/SPC560BCxx/bam.s b/os/ports/GCC/PPC/SPC560BCxx/bam.s new file mode 100644 index 000000000..afb7b93b8 --- /dev/null +++ b/os/ports/GCC/PPC/SPC560BCxx/bam.s @@ -0,0 +1,38 @@ +/* + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, + 2011,2012 Giovanni Di Sirio. + + This file is part of ChibiOS/RT. + + ChibiOS/RT 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/RT 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 . +*/ + +/** + * @file SPC560BCxx/bam.s + * @brief SPC560BCxx boot assistant record. + * + * @addtogroup PPC_CORE + * @{ + */ + +#if !defined(__DOXYGEN__) + + /* BAM info, SWT off, WTE off, VLE from settings.*/ + .section .bam, "ax" + .long 0x015A0000 + .long _boot_address + +#endif /* !defined(__DOXYGEN__) */ + +/** @} */ diff --git a/os/ports/GCC/PPC/SPC560BCxx/ivor.s b/os/ports/GCC/PPC/SPC560BCxx/ivor.s new file mode 100644 index 000000000..471f3e873 --- /dev/null +++ b/os/ports/GCC/PPC/SPC560BCxx/ivor.s @@ -0,0 +1,234 @@ +/* + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, + 2011,2012 Giovanni Di Sirio. + + This file is part of ChibiOS/RT. + + ChibiOS/RT 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/RT 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 . +*/ + +/** + * @file SPC560BCxx/ivor.s + * @brief SPC560BCxx IVORx handlers. + * + * @addtogroup PPC_CORE + * @{ + */ + +/* + * Imports the PPC configuration headers. + */ +#define _FROM_ASM_ +#include "chconf.h" +#include "chcore.h" + +#if !defined(__DOXYGEN__) + /* + * INTC registers address. + */ + .equ INTC_IACKR, 0xfff48010 + .equ INTC_EOIR, 0xfff48018 + + .section .handlers, "ax" + + /* + * Fixed IVOR offset table. + */ + .globl IVORS +IVORS: +IVOR0: b IVOR0 + .align 4 +IVOR1: b _IVOR1 + .align 4 +IVOR2: b _IVOR2 + .align 4 +IVOR3: b _IVOR3 + .align 4 +IVOR4: b _IVOR4 + .align 4 +IVOR5: b _IVOR5 + .align 4 +IVOR6: b _IVOR6 + .align 4 +IVOR7: b _IVOR7 + .align 4 +IVOR8: b _IVOR8 + .align 4 +IVOR9: b _IVOR9 + .align 4 +IVOR10: b _IVOR10 + .align 4 +IVOR11: b _IVOR11 + .align 4 +IVOR12: b _IVOR12 + .align 4 +IVOR13: b _IVOR13 + .align 4 +IVOR14: b _IVOR14 + .align 4 +IVOR15: b _IVOR15 + + /* + * 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: + .weak _unhandled_exception + .type _unhandled_exception, @function +_unhandled_exception: + b _unhandled_exception + + /* + * IVOR4 handler (Book-E external interrupt). + */ + .align 4 + .globl _IVOR4 + .type _IVOR4, @function +_IVOR4: + /* 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) */ + + /* Software vector address from the INTC register.*/ + lis %r3, INTC_IACKR@h + ori %r3, %r3, INTC_IACKR@l /* IACKR register address. */ + lwz %r3, 0(%r3) /* IACKR register value. */ + lwz %r3, 0(%r3) + mtCTR %r3 /* Software handler address. */ + +#if PPC_USE_IRQ_PREEMPTION + /* Allows preemption while executing the software handler.*/ + wrteei 1 +#endif + + /* Exectes the software handler.*/ + bctrl + +#if PPC_USE_IRQ_PREEMPTION + /* Prevents preemption again.*/ + wrteei 0 +#endif + + /* Informs the INTC that the interrupt has been served.*/ + mbar 0 + lis %r3, INTC_EOIR@h + ori %r3, %r3, INTC_EOIR@l + stw %r3, 0(%r3) /* Writing any value should do. */ + + /* Verifies if a reschedule is required.*/ +#if CH_DBG_SYSTEM_STATE_CHECK + bl dbg_check_lock +#endif + bl chSchIsPreemptionRequired + cmpli cr0, %r3, 0 + beq cr0, _ivor_exit + bl chSchDoReschedule + + /* Context restore.*/ + .globl _ivor_exit +_ivor_exit: +#if CH_DBG_SYSTEM_STATE_CHECK + bl dbg_check_unlock +#endif +#if PPC_USE_VLE && PPC_SUPPORTS_VLE_MULTI + e_lmvgprw 32(%sp) /* Restores GPR0, GPR3...GPR12. */ + e_lmvsprw 16(%sp) /* Restores CR, LR, CTR, XER. */ + e_lmvsrrw 8(%sp) /* Restores PC, MSR. */ +#else /*!(PPC_USE_VLE && PPC_SUPPORTS_VLE_MULTI) */ + lwz %r3, 36(%sp) /* Restores GPR3...GPR12. */ + lwz %r4, 40(%sp) + lwz %r5, 44(%sp) + lwz %r6, 48(%sp) + lwz %r7, 52(%sp) + lwz %r8, 56(%sp) + lwz %r9, 60(%sp) + lwz %r10, 64(%sp) + lwz %r11, 68(%sp) + lwz %r12, 72(%sp) + lwz %r0, 8(%sp) + mtSRR0 %r0 /* Restores PC. */ + lwz %r0, 12(%sp) + mtSRR1 %r0 /* Restores MSR. */ + lwz %r0, 16(%sp) + mtCR %r0 /* Restores CR. */ + lwz %r0, 20(%sp) + mtLR %r0 /* Restores LR. */ + lwz %r0, 24(%sp) + mtCTR %r0 /* Restores CTR. */ + lwz %r0, 28(%sp) + mtXER %r0 /* Restores XER. */ + lwz %r0, 32(%sp) /* Restores GPR0. */ +#endif /* !(PPC_USE_VLE && PPC_SUPPORTS_VLE_MULTI) */ + addi %sp, %sp, 80 /* Back to the previous frame. */ + rfi + +#endif /* !defined(__DOXYGEN__) */ + +/** @} */ diff --git a/os/ports/GCC/PPC/SPC560BCxx/ld/SPC560B44.ld b/os/ports/GCC/PPC/SPC560BCxx/ld/SPC560B44.ld new file mode 100644 index 000000000..443b4e5e7 --- /dev/null +++ b/os/ports/GCC/PPC/SPC560BCxx/ld/SPC560B44.ld @@ -0,0 +1,178 @@ +/* + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, + 2011,2012 Giovanni Di Sirio. + + This file is part of ChibiOS/RT. + + ChibiOS/RT 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/RT 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 . +*/ + +/* + * SPC560B44 memory setup. + */ +__irq_stack_size__ = 0x0000; /* Not yet used.*/ +__process_stack_size__ = 0x0800; + +MEMORY +{ + flash : org = 0x00000000, len = 384k + dataflash : org = 0x00800000, len = 64k + ram : org = 0x40000000, len = 28k +} + +/* + * Derived constants. + */ +__flash_size__ = LENGTH(flash); +__flash_start__ = ORIGIN(flash); +__flash_end__ = ORIGIN(flash) + LENGTH(flash); + +__ram_size__ = LENGTH(ram); +__ram_start__ = ORIGIN(ram); +__ram_end__ = ORIGIN(ram) + LENGTH(ram); + +SECTIONS +{ + . = ORIGIN(flash); + .boot : ALIGN(16) SUBALIGN(16) + { + KEEP(*(.bam)) + KEEP(*(.crt0)) + . = ALIGN(0x00000800); + KEEP(*(.vectors)) + /* Note, have to waste the first 4KB because the IVPR register + requires an alignment of 4KB and the first 4KB cannot be used, + IVOR0 would conflict with the BAM word. Applications could + allocate code or data in the first 4KB by using special sections.*/ + . = ALIGN(0x00001000); + __ivpr_base__ = .; + KEEP(*(.handlers)) + } > flash + + constructors : ALIGN(4) SUBALIGN(4) + { + PROVIDE(__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE(__init_array_end = .); + } > flash + + destructors : ALIGN(4) SUBALIGN(4) + { + PROVIDE(__fini_array_start = .); + KEEP(*(.fini_array)) + KEEP(*(SORT(.fini_array.*))) + PROVIDE(__fini_array_end = .); + } > flash + + .text_vle : ALIGN(16) SUBALIGN(16) + { + *(.text_vle) + *(.text_vle.*) + *(.gnu.linkonce.t_vle.*) + } > flash + + .text : ALIGN(16) SUBALIGN(16) + { + *(.text) + *(.text.*) + *(.gnu.linkonce.t.*) + } > flash + + .rodata : ALIGN(16) SUBALIGN(16) + { + *(.glue_7t) + *(.glue_7) + *(.gcc*) + *(.rodata) + *(.rodata.*) + *(.rodata1) + } > flash + + .sdata2 : ALIGN(16) SUBALIGN(16) + { + __sdata2_start__ = . + 0x8000; + *(.sdata2) + *(.sdata2.*) + *(.gnu.linkonce.s2.*) + *(.sbss2) + *(.sbss2.*) + *(.gnu.linkonce.sb2.*) + } > flash + + .eh_frame_hdr : + { + *(.eh_frame_hdr) + } > flash + + .eh_frame : ONLY_IF_RO + { + *(.eh_frame) + } > flash + + .romdata : ALIGN(16) SUBALIGN(16) + { + __romdata_start__ = .; + } > flash + + .stacks : + { + . = ALIGN(8); + __irq_stack_base__ = .; + . += __irq_stack_size__; + . = ALIGN(8); + __irq_stack_end__ = .; + __process_stack_base__ = .; + __main_thread_stack_base__ = .; + . += __process_stack_size__; + . = ALIGN(8); + __process_stack_end__ = .; + __main_thread_stack_end__ = .; + } > ram + + .data : AT(__romdata_start__) + { + . = ALIGN(4); + __data_start__ = .; + *(.data) + *(.data.*) + *(.gnu.linkonce.d.*) + __sdata_start__ = . + 0x8000; + *(.sdata) + *(.sdata.*) + *(.gnu.linkonce.s.*) + __data_end__ = .; + } > ram + + .sbss : + { + __bss_start__ = .; + *(.sbss) + *(.sbss.*) + *(.gnu.linkonce.sb.*) + *(.scommon) + } > ram + + .bss : + { + *(.bss) + *(.bss.*) + *(.gnu.linkonce.b.*) + *(COMMON) + __bss_end__ = .; + } > ram + + __heap_base__ = __bss_end__; + __heap_end__ = __ram_end__; +} diff --git a/os/ports/GCC/PPC/SPC560BCxx/ld/SPC560B50.ld b/os/ports/GCC/PPC/SPC560BCxx/ld/SPC560B50.ld new file mode 100644 index 000000000..e6a6ce61f --- /dev/null +++ b/os/ports/GCC/PPC/SPC560BCxx/ld/SPC560B50.ld @@ -0,0 +1,178 @@ +/* + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, + 2011,2012 Giovanni Di Sirio. + + This file is part of ChibiOS/RT. + + ChibiOS/RT 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/RT 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 . +*/ + +/* + * SPC560B50 memory setup. + */ +__irq_stack_size__ = 0x0000; /* Not yet used.*/ +__process_stack_size__ = 0x0800; + +MEMORY +{ + flash : org = 0x00000000, len = 512k + dataflash : org = 0x00800000, len = 64k + ram : org = 0x40000000, len = 32k +} + +/* + * Derived constants. + */ +__flash_size__ = LENGTH(flash); +__flash_start__ = ORIGIN(flash); +__flash_end__ = ORIGIN(flash) + LENGTH(flash); + +__ram_size__ = LENGTH(ram); +__ram_start__ = ORIGIN(ram); +__ram_end__ = ORIGIN(ram) + LENGTH(ram); + +SECTIONS +{ + . = ORIGIN(flash); + .boot : ALIGN(16) SUBALIGN(16) + { + KEEP(*(.bam)) + KEEP(*(.crt0)) + . = ALIGN(0x00000800); + KEEP(*(.vectors)) + /* Note, have to waste the first 4KB because the IVPR register + requires an alignment of 4KB and the first 4KB cannot be used, + IVOR0 would conflict with the BAM word. Applications could + allocate code or data in the first 4KB by using special sections.*/ + . = ALIGN(0x00001000); + __ivpr_base__ = .; + KEEP(*(.handlers)) + } > flash + + constructors : ALIGN(4) SUBALIGN(4) + { + PROVIDE(__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE(__init_array_end = .); + } > flash + + destructors : ALIGN(4) SUBALIGN(4) + { + PROVIDE(__fini_array_start = .); + KEEP(*(.fini_array)) + KEEP(*(SORT(.fini_array.*))) + PROVIDE(__fini_array_end = .); + } > flash + + .text_vle : ALIGN(16) SUBALIGN(16) + { + *(.text_vle) + *(.text_vle.*) + *(.gnu.linkonce.t_vle.*) + } > flash + + .text : ALIGN(16) SUBALIGN(16) + { + *(.text) + *(.text.*) + *(.gnu.linkonce.t.*) + } > flash + + .rodata : ALIGN(16) SUBALIGN(16) + { + *(.glue_7t) + *(.glue_7) + *(.gcc*) + *(.rodata) + *(.rodata.*) + *(.rodata1) + } > flash + + .sdata2 : ALIGN(16) SUBALIGN(16) + { + __sdata2_start__ = . + 0x8000; + *(.sdata2) + *(.sdata2.*) + *(.gnu.linkonce.s2.*) + *(.sbss2) + *(.sbss2.*) + *(.gnu.linkonce.sb2.*) + } > flash + + .eh_frame_hdr : + { + *(.eh_frame_hdr) + } > flash + + .eh_frame : ONLY_IF_RO + { + *(.eh_frame) + } > flash + + .romdata : ALIGN(16) SUBALIGN(16) + { + __romdata_start__ = .; + } > flash + + .stacks : + { + . = ALIGN(8); + __irq_stack_base__ = .; + . += __irq_stack_size__; + . = ALIGN(8); + __irq_stack_end__ = .; + __process_stack_base__ = .; + __main_thread_stack_base__ = .; + . += __process_stack_size__; + . = ALIGN(8); + __process_stack_end__ = .; + __main_thread_stack_end__ = .; + } > ram + + .data : AT(__romdata_start__) + { + . = ALIGN(4); + __data_start__ = .; + *(.data) + *(.data.*) + *(.gnu.linkonce.d.*) + __sdata_start__ = . + 0x8000; + *(.sdata) + *(.sdata.*) + *(.gnu.linkonce.s.*) + __data_end__ = .; + } > ram + + .sbss : + { + __bss_start__ = .; + *(.sbss) + *(.sbss.*) + *(.gnu.linkonce.sb.*) + *(.scommon) + } > ram + + .bss : + { + *(.bss) + *(.bss.*) + *(.gnu.linkonce.b.*) + *(COMMON) + __bss_end__ = .; + } > ram + + __heap_base__ = __bss_end__; + __heap_end__ = __ram_end__; +} diff --git a/os/ports/GCC/PPC/SPC560BCxx/port.mk b/os/ports/GCC/PPC/SPC560BCxx/port.mk new file mode 100644 index 000000000..9eee36b5e --- /dev/null +++ b/os/ports/GCC/PPC/SPC560BCxx/port.mk @@ -0,0 +1,12 @@ +# List of the ChibiOS/RT SPC560BCxx port files. +PORTSRC = ${CHIBIOS}/os/ports/GCC/PPC/chcore.c + +PORTASM = ${CHIBIOS}/os/ports/GCC/PPC/bam.s \ + ${CHIBIOS}/os/ports/GCC/PPC/crt0.s \ + ${CHIBIOS}/os/ports/GCC/PPC/SPC560BCxx/ivor.s \ + ${CHIBIOS}/os/ports/GCC/PPC/SPC560BCxx/vectors.s + +PORTINC = ${CHIBIOS}/os/ports/GCC/PPC \ + ${CHIBIOS}/os/ports/GCC/PPC/SPC560BCxx + +PORTLD = ${CHIBIOS}/os/ports/GCC/PPC/SPC560BCxx/ld diff --git a/os/ports/GCC/PPC/SPC560BCxx/ppcparams.h b/os/ports/GCC/PPC/SPC560BCxx/ppcparams.h new file mode 100644 index 000000000..d2f285709 --- /dev/null +++ b/os/ports/GCC/PPC/SPC560BCxx/ppcparams.h @@ -0,0 +1,67 @@ +/* + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, + 2011,2012 Giovanni Di Sirio. + + This file is part of ChibiOS/RT. + + ChibiOS/RT 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/RT 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 . +*/ + +/** + * @file SPC560Pxx/ppcparams.h + * @brief PowerPC parameters for the SPC560Pxx. + * + * @defgroup PPC_SPC560Pxx SPC560Pxx/MPC560x Specific Parameters + * @ingroup PPC_SPECIFIC + * @details This file contains the PowerPC specific parameters for the + * SPC560Pxx/MPC560x platform. + * @{ + */ + +#ifndef _PPCPARAMS_H_ +#define _PPCPARAMS_H_ + +/** + * @brief PPC core model. + */ +#define PPC_VARIANT PPC_VARIANT_e200z0h + +/** + * @brief Number of writable bits in IVPR register. + */ +#define PPC_IVPR_BITS 20 + +/** + * @brief IVORx registers support. + */ +#define PPC_SUPPORTS_IVORS FALSE + +/** + * @brief Book E instruction set support. + */ +#define PPC_SUPPORTS_BOOKE FALSE + +/** + * @brief VLE instruction set support. + */ +#define PPC_SUPPORTS_VLE TRUE + +/** + * @brief Supports VLS Load/Store Multiple Volatile instructions. + */ +#define PPC_SUPPORTS_VLE_MULTI TRUE + +#endif /* _PPCPARAMS_H_ */ + +/** @} */ diff --git a/os/ports/GCC/PPC/SPC560BCxx/vectors.s b/os/ports/GCC/PPC/SPC560BCxx/vectors.s new file mode 100644 index 000000000..4b6c67b57 --- /dev/null +++ b/os/ports/GCC/PPC/SPC560BCxx/vectors.s @@ -0,0 +1,917 @@ +/* + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, + 2011,2012 Giovanni Di Sirio. + + This file is part of ChibiOS/RT. + + ChibiOS/RT 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/RT 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 . +*/ + +/** + * @file SPC560BCxx/vectors.s + * @brief SPC560BCxx vectors table. + * + * @addtogroup PPC_CORE + * @{ + */ + +#if !defined(__DOXYGEN__) + + /* Software vectors table. The vectors are accessed from the IVOR4 + handler only. In order to declare an interrupt handler just create + a function withe the same name of a vector, the symbol will + override the weak symbol declared here.*/ + .section .vectors, "ax" + .align 4 + .globl _vectors +_vectors: + .long vector0 + .long vector1 + .long vector2 + .long vector3 + .long vector4 + .long vector5 + .long vector6 + .long vector7 + .long vector8 + .long vector9 + .long vector10 + .long vector11 + .long vector12 + .long vector13 + .long vector14 + .long vector15 + .long vector16 + .long vector17 + .long vector18 + .long vector19 + .long vector20 + .long vector21 + .long vector22 + .long vector23 + .long vector24 + .long vector25 + .long vector26 + .long vector27 + .long vector28 + .long vector29 + .long vector30 + .long vector31 + .long vector32 + .long vector33 + .long vector34 + .long vector35 + .long vector36 + .long vector37 + .long vector38 + .long vector39 + .long vector40 + .long vector41 + .long vector42 + .long vector43 + .long vector44 + .long vector45 + .long vector46 + .long vector47 + .long vector48 + .long vector49 + .long vector50 + .long vector51 + .long vector52 + .long vector53 + .long vector54 + .long vector55 + .long vector56 + .long vector57 + .long vector58 + .long vector59 + .long vector60 + .long vector61 + .long vector62 + .long vector63 + .long vector64 + .long vector65 + .long vector66 + .long vector67 + .long vector68 + .long vector69 + .long vector70 + .long vector71 + .long vector72 + .long vector73 + .long vector74 + .long vector75 + .long vector76 + .long vector77 + .long vector78 + .long vector79 + .long vector80 + .long vector81 + .long vector82 + .long vector83 + .long vector84 + .long vector85 + .long vector86 + .long vector87 + .long vector88 + .long vector89 + .long vector90 + .long vector91 + .long vector92 + .long vector93 + .long vector94 + .long vector95 + .long vector96 + .long vector97 + .long vector98 + .long vector99 + .long vector100 + .long vector101 + .long vector102 + .long vector103 + .long vector104 + .long vector105 + .long vector106 + .long vector107 + .long vector108 + .long vector109 + .long vector110 + .long vector111 + .long vector112 + .long vector113 + .long vector114 + .long vector115 + .long vector116 + .long vector117 + .long vector118 + .long vector119 + .long vector120 + .long vector121 + .long vector122 + .long vector123 + .long vector124 + .long vector125 + .long vector126 + .long vector127 + .long vector128 + .long vector129 + .long vector130 + .long vector131 + .long vector132 + .long vector133 + .long vector134 + .long vector135 + .long vector136 + .long vector137 + .long vector138 + .long vector139 + .long vector140 + .long vector141 + .long vector142 + .long vector143 + .long vector144 + .long vector145 + .long vector146 + .long vector147 + .long vector148 + .long vector149 + .long vector150 + .long vector151 + .long vector152 + .long vector153 + .long vector154 + .long vector155 + .long vector156 + .long vector157 + .long vector158 + .long vector159 + .long vector160 + .long vector161 + .long vector162 + .long vector163 + .long vector164 + .long vector165 + .long vector166 + .long vector167 + .long vector168 + .long vector169 + .long vector170 + .long vector171 + .long vector172 + .long vector173 + .long vector174 + .long vector175 + .long vector176 + .long vector177 + .long vector178 + .long vector179 + .long vector180 + .long vector181 + .long vector182 + .long vector183 + .long vector184 + .long vector185 + .long vector186 + .long vector187 + .long vector188 + .long vector189 + .long vector190 + .long vector191 + .long vector192 + .long vector193 + .long vector194 + .long vector195 + .long vector196 + .long vector197 + .long vector198 + .long vector199 + .long vector200 + .long vector201 + .long vector202 + .long vector203 + .long vector204 + .long vector205 + .long vector206 + .long vector207 + .long vector208 + .long vector209 + .long vector210 + .long vector211 + .long vector212 + .long vector213 + .long vector214 + .long vector215 + .long vector216 + + .text + .align 2 + .weak vector0 +vector0: + + .weak vector1 +vector1: + + .weak vector2 +vector2: + + .weak vector3 +vector3: + + .weak vector4 +vector4: + + .weak vector5 +vector5: + + .weak vector6 +vector6: + + .weak vector7 +vector7: + + .weak vector8 +vector8: + + .weak vector9 +vector9: + + .weak vector10 +vector10: + + .weak vector11 +vector11: + + .weak vector12 +vector12: + + .weak vector13 +vector13: + + .weak vector14 +vector14: + + .weak vector15 +vector15: + + .weak vector16 +vector16: + + .weak vector17 +vector17: + + .weak vector18 +vector18: + + .weak vector19 +vector19: + + .weak vector20 +vector20: + + .weak vector21 +vector21: + + .weak vector22 +vector22: + + .weak vector23 +vector23: + + .weak vector24 +vector24: + + .weak vector25 +vector25: + + .weak vector26 +vector26: + + .weak vector27 +vector27: + + .weak vector28 +vector28: + + .weak vector29 +vector29: + + .weak vector30 +vector30: + + .weak vector31 +vector31: + + .weak vector32 +vector32: + + .weak vector33 +vector33: + + .weak vector34 +vector34: + + .weak vector35 +vector35: + + .weak vector36 +vector36: + + .weak vector37 +vector37: + + .weak vector38 +vector38: + + .weak vector39 +vector39: + + .weak vector40 +vector40: + + .weak vector41 +vector41: + + .weak vector42 +vector42: + + .weak vector43 +vector43: + + .weak vector44 +vector44: + + .weak vector45 +vector45: + + .weak vector46 +vector46: + + .weak vector47 +vector47: + + .weak vector48 +vector48: + + .weak vector49 +vector49: + + .weak vector50 +vector50: + + .weak vector51 +vector51: + + .weak vector52 +vector52: + + .weak vector53 +vector53: + + .weak vector54 +vector54: + + .weak vector55 +vector55: + + .weak vector56 +vector56: + + .weak vector57 +vector57: + + .weak vector58 +vector58: + + .weak vector59 +vector59: + + .weak vector60 +vector60: + + .weak vector61 +vector61: + + .weak vector62 +vector62: + + .weak vector63 +vector63: + + .weak vector64 +vector64: + + .weak vector65 +vector65: + + .weak vector66 +vector66: + + .weak vector67 +vector67: + + .weak vector68 +vector68: + + .weak vector69 +vector69: + + .weak vector70 +vector70: + + .weak vector71 +vector71: + + .weak vector72 +vector72: + + .weak vector73 +vector73: + + .weak vector74 +vector74: + + .weak vector75 +vector75: + + .weak vector76 +vector76: + + .weak vector77 +vector77: + + .weak vector78 +vector78: + + .weak vector79 +vector79: + + .weak vector80 +vector80: + + .weak vector81 +vector81: + + .weak vector82 +vector82: + + .weak vector83 +vector83: + + .weak vector84 +vector84: + + .weak vector85 +vector85: + + .weak vector86 +vector86: + + .weak vector87 +vector87: + + .weak vector88 +vector88: + + .weak vector89 +vector89: + + .weak vector90 +vector90: + + .weak vector91 +vector91: + + .weak vector92 +vector92: + + .weak vector93 +vector93: + + .weak vector94 +vector94: + + .weak vector95 +vector95: + + .weak vector96 +vector96: + + .weak vector97 +vector97: + + .weak vector98 +vector98: + + .weak vector99 +vector99: + + .weak vector100 +vector100: + + .weak vector101 +vector101: + + .weak vector102 +vector102: + + .weak vector103 +vector103: + + .weak vector104 +vector104: + + .weak vector105 +vector105: + + .weak vector106 +vector106: + + .weak vector107 +vector107: + + .weak vector108 +vector108: + + .weak vector109 +vector109: + + .weak vector110 +vector110: + + .weak vector111 +vector111: + + .weak vector112 +vector112: + + .weak vector113 +vector113: + + .weak vector114 +vector114: + + .weak vector115 +vector115: + + .weak vector116 +vector116: + + .weak vector117 +vector117: + + .weak vector118 +vector118: + + .weak vector119 +vector119: + + .weak vector120 +vector120: + + .weak vector121 +vector121: + + .weak vector122 +vector122: + + .weak vector123 +vector123: + + .weak vector124 +vector124: + + .weak vector125 +vector125: + + .weak vector126 +vector126: + + .weak vector127 +vector127: + + .weak vector128 +vector128: + + .weak vector129 +vector129: + + .weak vector130 +vector130: + + .weak vector131 +vector131: + + .weak vector132 +vector132: + + .weak vector133 +vector133: + + .weak vector134 +vector134: + + .weak vector135 +vector135: + + .weak vector136 +vector136: + + .weak vector137 +vector137: + + .weak vector138 +vector138: + + .weak vector139 +vector139: + + .weak vector140 +vector140: + + .weak vector141 +vector141: + + .weak vector142 +vector142: + + .weak vector143 +vector143: + + .weak vector144 +vector144: + + .weak vector145 +vector145: + + .weak vector146 +vector146: + + .weak vector147 +vector147: + + .weak vector148 +vector148: + + .weak vector149 +vector149: + + .weak vector150 +vector150: + + .weak vector151 +vector151: + + .weak vector152 +vector152: + + .weak vector153 +vector153: + + .weak vector154 +vector154: + + .weak vector155 +vector155: + + .weak vector156 +vector156: + + .weak vector157 +vector157: + + .weak vector158 +vector158: + + .weak vector159 +vector159: + + .weak vector160 +vector160: + + .weak vector161 +vector161: + + .weak vector162 +vector162: + + .weak vector163 +vector163: + + .weak vector164 +vector164: + + .weak vector165 +vector165: + + .weak vector166 +vector166: + + .weak vector167 +vector167: + + .weak vector168 +vector168: + + .weak vector169 +vector169: + + .weak vector170 +vector170: + + .weak vector171 +vector171: + + .weak vector172 +vector172: + + .weak vector173 +vector173: + + .weak vector174 +vector174: + + .weak vector175 +vector175: + + .weak vector176 +vector176: + + .weak vector177 +vector177: + + .weak vector178 +vector178: + + .weak vector179 +vector179: + + .weak vector180 +vector180: + + .weak vector181 +vector181: + + .weak vector182 +vector182: + + .weak vector183 +vector183: + + .weak vector184 +vector184: + + .weak vector185 +vector185: + + .weak vector186 +vector186: + + .weak vector187 +vector187: + + .weak vector188 +vector188: + + .weak vector189 +vector189: + + .weak vector190 +vector190: + + .weak vector191 +vector191: + + .weak vector192 +vector192: + + .weak vector193 +vector193: + + .weak vector194 +vector194: + + .weak vector195 +vector195: + + .weak vector196 +vector196: + + .weak vector197 +vector197: + + .weak vector198 +vector198: + + .weak vector199 +vector199: + + .weak vector200 +vector200: + + .weak vector201 +vector201: + + .weak vector202 +vector202: + + .weak vector203 +vector203: + + .weak vector204 +vector204: + + .weak vector205 +vector205: + + .weak vector206 +vector206: + + .weak vector207 +vector207: + + .weak vector208 +vector208: + + .weak vector209 +vector209: + + .weak vector210 +vector210: + + .weak vector211 +vector211: + + .weak vector212 +vector212: + + .weak vector213 +vector213: + + .weak vector214 +vector214: + + .weak vector215 +vector215: + + .weak vector216 +vector216: + + .weak _unhandled_irq + .type _unhandled_irq, @function +_unhandled_irq: + b _unhandled_irq + +#endif /* !defined(__DOXYGEN__) */ + +/** @} */ diff --git a/os/ports/GCC/PPC/SPC560Pxx/ld/SPC560P44.ld b/os/ports/GCC/PPC/SPC560Pxx/ld/SPC560P44.ld index 49b182721..a98329d1d 100644 --- a/os/ports/GCC/PPC/SPC560Pxx/ld/SPC560P44.ld +++ b/os/ports/GCC/PPC/SPC560Pxx/ld/SPC560P44.ld @@ -26,9 +26,9 @@ __process_stack_size__ = 0x0800; MEMORY { - flash : org = 0x00000000, len = 512k + flash : org = 0x00000000, len = 384k dataflash : org = 0x00800000, len = 64k - ram : org = 0x40000000, len = 40k + ram : org = 0x40000000, len = 36k } /* diff --git a/os/ports/GCC/PPC/SPC560Pxx/ld/SPC560P50.ld b/os/ports/GCC/PPC/SPC560Pxx/ld/SPC560P50.ld new file mode 100644 index 000000000..49b182721 --- /dev/null +++ b/os/ports/GCC/PPC/SPC560Pxx/ld/SPC560P50.ld @@ -0,0 +1,178 @@ +/* + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, + 2011,2012 Giovanni Di Sirio. + + This file is part of ChibiOS/RT. + + ChibiOS/RT 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/RT 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 . +*/ + +/* + * SPC560P44 memory setup. + */ +__irq_stack_size__ = 0x0000; /* Not yet used.*/ +__process_stack_size__ = 0x0800; + +MEMORY +{ + flash : org = 0x00000000, len = 512k + dataflash : org = 0x00800000, len = 64k + ram : org = 0x40000000, len = 40k +} + +/* + * Derived constants. + */ +__flash_size__ = LENGTH(flash); +__flash_start__ = ORIGIN(flash); +__flash_end__ = ORIGIN(flash) + LENGTH(flash); + +__ram_size__ = LENGTH(ram); +__ram_start__ = ORIGIN(ram); +__ram_end__ = ORIGIN(ram) + LENGTH(ram); + +SECTIONS +{ + . = ORIGIN(flash); + .boot : ALIGN(16) SUBALIGN(16) + { + KEEP(*(.bam)) + KEEP(*(.crt0)) + . = ALIGN(0x00000800); + KEEP(*(.vectors)) + /* Note, have to waste the first 64KB because the IVPR register + requires an alignment of 64KB and the first 64KB cannot be used, + IVOR0 would conflict with the BAM word. Applications could + allocate code or data in the first 64KB by using special sections.*/ + . = ALIGN(0x00010000); + __ivpr_base__ = .; + KEEP(*(.handlers)) + } > flash + + constructors : ALIGN(4) SUBALIGN(4) + { + PROVIDE(__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE(__init_array_end = .); + } > flash + + destructors : ALIGN(4) SUBALIGN(4) + { + PROVIDE(__fini_array_start = .); + KEEP(*(.fini_array)) + KEEP(*(SORT(.fini_array.*))) + PROVIDE(__fini_array_end = .); + } > flash + + .text_vle : ALIGN(16) SUBALIGN(16) + { + *(.text_vle) + *(.text_vle.*) + *(.gnu.linkonce.t_vle.*) + } > flash + + .text : ALIGN(16) SUBALIGN(16) + { + *(.text) + *(.text.*) + *(.gnu.linkonce.t.*) + } > flash + + .rodata : ALIGN(16) SUBALIGN(16) + { + *(.glue_7t) + *(.glue_7) + *(.gcc*) + *(.rodata) + *(.rodata.*) + *(.rodata1) + } > flash + + .sdata2 : ALIGN(16) SUBALIGN(16) + { + __sdata2_start__ = . + 0x8000; + *(.sdata2) + *(.sdata2.*) + *(.gnu.linkonce.s2.*) + *(.sbss2) + *(.sbss2.*) + *(.gnu.linkonce.sb2.*) + } > flash + + .eh_frame_hdr : + { + *(.eh_frame_hdr) + } > flash + + .eh_frame : ONLY_IF_RO + { + *(.eh_frame) + } > flash + + .romdata : ALIGN(16) SUBALIGN(16) + { + __romdata_start__ = .; + } > flash + + .stacks : + { + . = ALIGN(8); + __irq_stack_base__ = .; + . += __irq_stack_size__; + . = ALIGN(8); + __irq_stack_end__ = .; + __process_stack_base__ = .; + __main_thread_stack_base__ = .; + . += __process_stack_size__; + . = ALIGN(8); + __process_stack_end__ = .; + __main_thread_stack_end__ = .; + } > ram + + .data : AT(__romdata_start__) + { + . = ALIGN(4); + __data_start__ = .; + *(.data) + *(.data.*) + *(.gnu.linkonce.d.*) + __sdata_start__ = . + 0x8000; + *(.sdata) + *(.sdata.*) + *(.gnu.linkonce.s.*) + __data_end__ = .; + } > ram + + .sbss : + { + __bss_start__ = .; + *(.sbss) + *(.sbss.*) + *(.gnu.linkonce.sb.*) + *(.scommon) + } > ram + + .bss : + { + *(.bss) + *(.bss.*) + *(.gnu.linkonce.b.*) + *(COMMON) + __bss_end__ = .; + } > ram + + __heap_base__ = __bss_end__; + __heap_end__ = __ram_end__; +} diff --git a/os/ports/GCC/PPC/SPC560Pxx/ppcparams.h b/os/ports/GCC/PPC/SPC560Pxx/ppcparams.h index 34f49449d..ac4a79a26 100644 --- a/os/ports/GCC/PPC/SPC560Pxx/ppcparams.h +++ b/os/ports/GCC/PPC/SPC560Pxx/ppcparams.h @@ -37,6 +37,11 @@ */ #define PPC_VARIANT PPC_VARIANT_e200z0 +/** + * @brief Number of writable bits in IVPR register. + */ +#define PPC_IVPR_BITS 16 + /** * @brief IVORx registers support. */ diff --git a/os/ports/GCC/PPC/chcore.h b/os/ports/GCC/PPC/chcore.h index 0a4476ea4..9ac46dadf 100644 --- a/os/ports/GCC/PPC/chcore.h +++ b/os/ports/GCC/PPC/chcore.h @@ -49,9 +49,10 @@ * @name Supported core variants * @{ */ -#define PPC_VARIANT_e200z0 200 -#define PPC_VARIANT_e200z3 203 -#define PPC_VARIANT_e200z4 204 +#define PPC_VARIANT_e200z0 20000 +#define PPC_VARIANT_e200z0h 20010 +#define PPC_VARIANT_e200z3 20300 +#define PPC_VARIANT_e200z4 20400 /** @} */ #include "ppcparams.h" @@ -110,6 +111,8 @@ */ #if (PPC_VARIANT == PPC_VARIANT_e200z0) || defined(__DOXYGEN__) #define CH_CORE_VARIANT_NAME "e200z0" +#elif PPC_VARIANT == PPC_VARIANT_e200z0h +#define CH_CORE_VARIANT_NAME "e200z3h" #elif PPC_VARIANT == PPC_VARIANT_e200z3 #define CH_CORE_VARIANT_NAME "e200z3" #elif PPC_VARIANT == PPC_VARIANT_e200z4 -- cgit v1.2.3