diff options
Diffstat (limited to 'zpu/sw/ecos/repository/hal/zylin/arch/current/src')
5 files changed, 945 insertions, 0 deletions
diff --git a/zpu/sw/ecos/repository/hal/zylin/arch/current/src/context.S b/zpu/sw/ecos/repository/hal/zylin/arch/current/src/context.S new file mode 100644 index 0000000..6b0b833 --- /dev/null +++ b/zpu/sw/ecos/repository/hal/zylin/arch/current/src/context.S @@ -0,0 +1,324 @@ +// #=========================================================================== +// # +// # context.S +// # +// # ZYLIN context switch code +// # +// #=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos 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 2 or (at your option) any later version. +// +// eCos 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 eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license/ +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +// #=========================================================================== +// ######DESCRIPTIONBEGIN#### +// # +// # Author(s): nickg, gthomas +// # Contributors: nickg, gthomas +// # Date: 1998-09-15 +// # Purpose: ZYLIN context switch code +// # Description: This file contains implementations of the thread context +// # switch routines. It also contains the longjmp() and setjmp() +// # routines. +// # +// #####DESCRIPTIONEND#### +// # +// #=========================================================================== + +#include <pkgconf/hal.h> +#ifdef CYGPKG_KERNEL // no CDL yet +#include <pkgconf/kernel.h> +#else +# undef CYGFUN_HAL_COMMON_KERNEL_SUPPORT +# undef CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK +#endif + + + + +#include "zylin.inc" + + .text + + +;; By using a macro, we get multiple breakpoint sites + .macro LOAD_STATE + popsp + ; stack pointer now points to beginning of HAL_SavedRegisters + ; we now pop the state of the CPU + + ; this will restore r0-r3 + im 0 + store + im 4 + store + im 8 + store + im 12 + store + im 16 + store + im 20 + store + im 24 + store + im 28 + store + + ;; restore interrupts + im INTERRUPT_MASK + load + store + + + .endm + + +// ---------------------------------------------------------------------------- +// hal_thread_switch_context +// Switch thread contexts + + + .globl hal_thread_switch_context +hal_thread_switch_context: + + ;; save interrupt state + im INTERRUPT_MASK + load + load + + ; store current state on stack + im 28 + load + im 24 + load + im 20 + load + im 16 + load + im 12 + load + im 8 + load + im 4 + load + im 0 + load + + + ;; store pointer to SP in "from" pointer + pushsp + pushsp + im 8+8*4+4+4 + add + load + store + + ;; put pointer to '*to' on stack + pushsp + im 4+8*4+4 + add + load + load + + LOAD_STATE + + poppc ; voila! jump to saved pc + + + + +// ---------------------------------------------------------------------------- +// hal_thread_load_context +// Load thread context + + .globl hal_thread_load_context +hal_thread_load_context: + pushsp + im 4 + add + load + load ; pointer to HAL_SavedRegisters on stack + +load_state_internal: + LOAD_STATE + + poppc ; voila! jump to saved pc + +// ---------------------------------------------------------------------------- +// HAL longjmp, setjmp implementations + + .globl hal_setjmp +hal_setjmp: + .byte 0 + + + .globl hal_longjmp + hal_longjmp: + .byte 0 + +// ---------------------------------------------------------------------------- +// end of context.S + +#ifdef CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK + + ; push 1 onto stack if we're already switched, 0 otherwise + .macro check_thread_stack + pushsp ; 0xda68 + im __interrupt_stack ; 0x241a + lessthan ; => 1 + im __interrupt_stack_base + pushsp + lessthan + or + + .endm + + ; push 1 onto stack if we're already switched, 0 otherwise + .macro switch_stack + pushsp + im __interrupt_stack-4 + store ; saved stack pointer on interrupt stack. + + im __interrupt_stack-4 + popsp + ; we're now on the interrupt stack + + .endm + + .macro switch_stack_back + ; return to thread stack + popsp + .endm + +_zpu_invoke_zpu_interrupt_stack: + im hal_IRQ_handler + call + im 0 + load ; return value - source + + im _zpu_interrupt_stack + call + im 0 + load ; return value - result + + ; we've got source and ISR result args on the stack + im _zpu_interrupt_thread + call + storesp 0 ; destroy args + storesp 0 + + poppc + + +// switch to interrupt stack, invoke interrupt handler, switch back to original stack, enable interrupts + .globl _zpu_interrupt +_zpu_interrupt: + ; disable interrupts, we don't nest + im 1 + nop + im INTERRUPT_MASK + load + store + + ; if we're interrupting the DSRs then + ; we're already on the interrupt stack + check_thread_stack + + impcrel _already_switched + eqbranch + +_zpu_interrupt_switch_stack: + switch_stack + + im _zpu_invoke_zpu_interrupt_stack + call + + switch_stack_back + + im .already_switched2 + poppc + +_already_switched: + im _zpu_invoke_zpu_interrupt_stack + call + +.already_switched2: + ; turn on interrupts and run on thread stack. + im 0 + nop + im INTERRUPT_MASK + load + store ; unmask interrupts + + ; we're now running on thread stack + + im _zpu_interrupt_thread + call + + poppc + + .globl hal_interrupt_stack_call_pending_DSRs +hal_interrupt_stack_call_pending_DSRs: + ; the scheduler is not running, so only interrupts + ; could have switched stacks at this point and + ; since we're running, interrupts are not + switch_stack + + im cyg_interrupt_call_pending_DSRs + call + + switch_stack_back + + ; back on thread stack + poppc + + + + +// Runtime stack used during all interrupt processing +#ifndef CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE +#define CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE 4096 +#endif + .bss + .balign 4,0 + .global cyg_interrupt_stack_base +cyg_interrupt_stack_base: +__interrupt_stack_base: + .rept CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE + .byte 0 + .endr + .balign 4,0 + .global cyg_interrupt_stack +cyg_interrupt_stack: +__interrupt_stack: +#endif + + diff --git a/zpu/sw/ecos/repository/hal/zylin/arch/current/src/hal_misc.c b/zpu/sw/ecos/repository/hal/zylin/arch/current/src/hal_misc.c new file mode 100644 index 0000000..eea2465 --- /dev/null +++ b/zpu/sw/ecos/repository/hal/zylin/arch/current/src/hal_misc.c @@ -0,0 +1,177 @@ +/*==========================================================================
+//
+// hal_misc.c
+//
+// HAL miscellaneous functions
+//
+//==========================================================================
+//####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
+//
+// eCos 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 2 or (at your option) any later version.
+//
+// eCos 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 eCos; if not, write to the Free Software Foundation, Inc.,
+// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+//
+// As a special exception, if other files instantiate templates or use macros
+// or inline functions from this file, or you compile this file and link it
+// with other works to produce a work based on this file, this file does not
+// by itself cause the resulting work to be covered by the GNU General Public
+// License. However the source code for this file must still be made available
+// in accordance with section (3) of the GNU General Public License.
+//
+// This exception does not invalidate any other reasons why a work based on
+// this file might be covered by the GNU General Public License.
+//
+// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
+// at http://sources.redhat.com/ecos/ecos-license/
+// -------------------------------------------
+//####ECOSGPLCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): nickg, gthomas
+// Contributors: nickg, gthomas
+// Date: 1999-02-20
+// Purpose: HAL miscellaneous functions
+// Description: This file contains miscellaneous functions provided by the
+// HAL.
+//
+//####DESCRIPTIONEND####
+//
+//=========================================================================*/
+
+#include <pkgconf/hal.h>
+#include <pkgconf/hal_zylin.h>
+#ifdef CYGPKG_KERNEL
+#include <pkgconf/kernel.h>
+#endif
+#ifdef CYGPKG_CYGMON
+#include <pkgconf/cygmon.h>
+#endif
+
+#include <cyg/infra/cyg_type.h>
+#include <cyg/infra/cyg_trac.h> // tracing macros
+#include <cyg/infra/cyg_ass.h> // assertion macros
+
+#include <cyg/hal/hal_arch.h> // HAL header
+#include <cyg/hal/hal_intr.h> // HAL header
+
+#include <cyg/hal/var_io.h>
+#include <cyg/hal/hal_io.h>
+
+externC void diag_printf(const char *fmt, ...);
+
+/*------------------------------------------------------------------------*/
+/* First level C exception handler. */
+
+
+/*------------------------------------------------------------------------*/
+/* C++ support - run initial constructors */
+
+#ifdef CYGSEM_HAL_STOP_CONSTRUCTORS_ON_FLAG
+cyg_bool cyg_hal_stop_constructors;
+#endif
+
+typedef void (*pfunc) (void);
+extern pfunc __CTOR_LIST__[];
+extern pfunc __CTOR_END__[];
+
+void
+cyg_hal_invoke_constructors (void)
+{
+#ifdef CYGSEM_HAL_STOP_CONSTRUCTORS_ON_FLAG
+ static pfunc *p = &__CTOR_END__[-1];
+
+ cyg_hal_stop_constructors = 0;
+ for (; p >= __CTOR_LIST__; p--) {
+ (*p) ();
+ if (cyg_hal_stop_constructors) {
+ p--;
+ break;
+ }
+ }
+#else
+ pfunc *p;
+
+ for (p = &__CTOR_END__[-1]; p >= __CTOR_LIST__; p--)
+ (*p) ();
+#endif
+}
+
+
+/*-------------------------------------------------------------------------*/
+/* Misc functions */
+
+int
+hal_lsbindex(int mask)
+{
+ int i;
+ for (i = 0; i < 32; i++) {
+ if (mask & (1<<i)) return (i);
+ }
+ return (-1);
+}
+
+int
+hal_msbindex(int mask)
+{
+ int i;
+ for (i = 31; i >= 0; i--) {
+ if (mask & (1<<i)) return (i);
+ }
+ return (-1);
+}
+
+/*------------------------------------------------------------------------*/
+/* Architecture default ISR */
+
+externC cyg_uint32
+hal_arch_default_isr(CYG_ADDRWORD vector, CYG_ADDRWORD data)
+{
+ CYG_TRACE1(true, "Interrupt: %d", vector);
+
+ CYG_FAIL("Spurious Interrupt!!!");
+ return 0;
+}
+
+extern volatile int *INTERRUPT_MASK;
+
+cyg_uint32 zpu_disable_interrupts()
+{
+ /* NOTE! We disable interrupts before flipping the cached state */
+ cyg_uint32 t=*INTERRUPT_MASK;
+ *INTERRUPT_MASK=1;
+ return t;
+}
+
+void zpu_enable_interrupts()
+{
+ *INTERRUPT_MASK=0;
+}
+
+void zpu_restore_interrupts(cyg_uint32 t)
+{
+ if (t==0)
+ zpu_enable_interrupts();
+ else
+ zpu_disable_interrupts();
+}
+
+externC cyg_uint32 zpu_query_interrupts()
+{
+ return *INTERRUPT_MASK;
+}
+
+/*------------------------------------------------------------------------*/
+// EOF hal_misc.c
diff --git a/zpu/sw/ecos/repository/hal/zylin/arch/current/src/hal_mk_defs.c b/zpu/sw/ecos/repository/hal/zylin/arch/current/src/hal_mk_defs.c new file mode 100644 index 0000000..734ce65 --- /dev/null +++ b/zpu/sw/ecos/repository/hal/zylin/arch/current/src/hal_mk_defs.c @@ -0,0 +1,102 @@ +/*==========================================================================
+//
+// hal_mk_defs.c
+//
+// HAL (architecture) "make defs" program
+//
+//==========================================================================
+//####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Red Hat, Inc.
+//
+// eCos 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 2 or (at your option) any later version.
+//
+// eCos 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 eCos; if not, write to the Free Software Foundation, Inc.,
+// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+//
+// As a special exception, if other files instantiate templates or use macros
+// or inline functions from this file, or you compile this file and link it
+// with other works to produce a work based on this file, this file does not
+// by itself cause the resulting work to be covered by the GNU General Public
+// License. However the source code for this file must still be made available
+// in accordance with section (3) of the GNU General Public License.
+//
+// This exception does not invalidate any other reasons why a work based on
+// this file might be covered by the GNU General Public License.
+//
+// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
+// at http://sources.redhat.com/ecos/ecos-license/
+// -------------------------------------------
+//####ECOSGPLCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 1999-02-20
+// Purpose: ZYLIN architecture dependent definition generator
+// Description: This file contains code that can be compiled by the target
+// compiler and used to generate machine specific definitions
+// suitable for use in assembly code.
+//
+//####DESCRIPTIONEND####
+//
+//========================================================================*/
+
+#include <pkgconf/hal.h>
+
+#include <cyg/hal/hal_arch.h> // HAL header
+#include <cyg/hal/hal_intr.h> // HAL header
+#ifdef CYGPKG_KERNEL
+# include <pkgconf/kernel.h>
+# include <cyg/kernel/instrmnt.h>
+#endif
+#include <cyg/hal/hal_if.h>
+
+/*
+ * This program is used to generate definitions needed by
+ * assembly language modules.
+ *
+ * This technique was first used in the OSF Mach kernel code:
+ * generate asm statements containing #defines,
+ * compile this file to assembler, and then extract the
+ * #defines from the assembly-language output.
+ */
+
+#define DEFINE(sym, val) \
+ asm volatile("\n\t.equ\t" #sym ",%0" : : "i" (val))
+
+int
+main(void)
+{
+ DEFINE(CYGNUM_HAL_ISR_COUNT, CYGNUM_HAL_ISR_COUNT);
+ DEFINE(CYGNUM_HAL_VSR_COUNT, CYGNUM_HAL_VSR_COUNT);
+ DEFINE(CYGNUM_HAL_EXCEPTION_ILLEGAL_INSTRUCTION,
+ CYGNUM_HAL_EXCEPTION_ILLEGAL_INSTRUCTION);
+ DEFINE(CYGNUM_HAL_EXCEPTION_CODE_ACCESS,
+ CYGNUM_HAL_EXCEPTION_CODE_ACCESS);
+ DEFINE(CYGNUM_HAL_EXCEPTION_DATA_ACCESS,
+ CYGNUM_HAL_EXCEPTION_DATA_ACCESS);
+ DEFINE(CYGNUM_HAL_VECTOR_IRQ, CYGNUM_HAL_VECTOR_IRQ);
+#ifdef CYGPKG_KERNEL
+ DEFINE(RAISE_INTR, CYG_INSTRUMENT_CLASS_INTR|CYG_INSTRUMENT_EVENT_INTR_RAISE);
+#endif
+#if defined(CYGSEM_HAL_VIRTUAL_VECTOR_SUPPORT)
+ DEFINE(CYGNUM_CALL_IF_TABLE_SIZE, CYGNUM_CALL_IF_TABLE_SIZE);
+#endif
+ DEFINE(CYGNUM_HAL_INTERRUPT_NONE, CYGNUM_HAL_INTERRUPT_NONE);
+ return 0;
+}
+
+
+/*------------------------------------------------------------------------*/
+// EOF hal_mk_defs.c
diff --git a/zpu/sw/ecos/repository/hal/zylin/arch/current/src/vectors.c b/zpu/sw/ecos/repository/hal/zylin/arch/current/src/vectors.c new file mode 100644 index 0000000..b254a85 --- /dev/null +++ b/zpu/sw/ecos/repository/hal/zylin/arch/current/src/vectors.c @@ -0,0 +1,116 @@ +#include <pkgconf/hal.h>
+#include <pkgconf/hal_zylin.h>
+#ifdef CYGPKG_KERNEL
+#include <pkgconf/kernel.h>
+#endif
+#ifdef CYGPKG_CYGMON
+#include <pkgconf/cygmon.h>
+#endif
+
+#include <cyg/infra/cyg_type.h>
+#include <cyg/infra/cyg_trac.h> // tracing macros
+#include <cyg/infra/cyg_ass.h> // assertion macros
+
+#include <cyg/hal/hal_arch.h> // HAL header
+#include <cyg/hal/hal_intr.h> // HAL header
+#include <string.h>
+#include <cyg/hal/hal_arch.h> // Register state info
+
+extern char __bss_start[];
+extern char __bss_end[];
+
+externC void cyg_hal_invoke_constructors (void);
+externC void cyg_start (void);
+externC void hal_hardware_init (void);
+externC void _initIO();
+
+void _premain(void)
+{
+ // clear BSS
+ memset(__bss_start, 0, __bss_end-__bss_start);
+
+ _initIO();
+
+ hal_hardware_init();
+
+ cyg_hal_invoke_constructors();
+
+ cyg_start();
+
+ __asm("breakpoint"); // stop debugger/sim here for now
+// for (;;); // hang forever
+}
+
+CYG_ADDRWORD hal_vsr_table[CYGNUM_HAL_VSR_COUNT];
+CYG_ADDRWORD hal_interrupt_handlers[CYGNUM_HAL_ISR_COUNT];
+CYG_ADDRWORD hal_interrupt_data[CYGNUM_HAL_ISR_COUNT];
+CYG_ADDRWORD hal_interrupt_objects[CYGNUM_HAL_ISR_COUNT];
+
+externC cyg_ucount32 cyg_scheduler_sched_lock;
+externC cyg_uint32 hal_IRQ_handler();
+
+externC void interrupt_end(
+ cyg_uint32 isr_ret,
+ CYG_ADDRWORD intr,
+ HAL_SavedRegisters *ctx
+ );
+
+
+#ifndef CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK
+
+
+void _zpu_interrupt(void)
+{
+ cyg_uint32 source;
+#ifdef CYGFUN_HAL_COMMON_KERNEL_SUPPORT
+ cyg_scheduler_sched_lock++;
+#endif
+ /* we don't support reentrant interrupts, so we disable interrupts here. */
+ cyg_uint32 t;
+ HAL_DISABLE_INTERRUPTS(t);
+
+ source=hal_IRQ_handler();
+ if (source!=CYGNUM_HAL_INTERRUPT_NONE)
+ {
+
+ cyg_uint32 result;
+
+ result=((cyg_uint32 (*)(cyg_uint32, CYG_ADDRWORD))hal_interrupt_handlers[source])(source, hal_interrupt_data[source]);
+ /* restore interrupts again. */
+ HAL_ENABLE_INTERRUPTS();
+ /* Interrupts must be enabled here as the scheduler is invoked here. */
+ interrupt_end(result, hal_interrupt_objects[source], NULL);
+ } else
+ {
+ /* restore interrupts again. */
+ HAL_ENABLE_INTERRUPTS();
+ }
+}
+#else
+/* low-level interrupt handling routine */
+cyg_uint32 _zpu_interrupt_stack(cyg_uint32 source)
+{
+#ifdef CYGFUN_HAL_COMMON_KERNEL_SUPPORT
+ cyg_scheduler_sched_lock++;
+#endif
+ /* we don't support reentrant interrupts, so we disable interrupts here. */
+ cyg_uint32 t;
+ HAL_DISABLE_INTERRUPTS(t);
+
+ cyg_uint32 result=0;
+ if (source!=CYGNUM_HAL_INTERRUPT_NONE)
+ {
+ cyg_uint32 result;
+ result=((cyg_uint32 (*)(cyg_uint32, CYG_ADDRWORD))hal_interrupt_handlers[source])(source, hal_interrupt_data[source]);
+ }
+ return result;
+}
+void _zpu_interrupt_thread(cyg_uint32 source, cyg_uint32 result)
+{
+ if (source!=CYGNUM_HAL_INTERRUPT_NONE)
+ {
+ /* Interrupts must be enabled here as the scheduler is invoked here. */
+ interrupt_end(result, hal_interrupt_objects[source], NULL);
+ }
+}
+#endif
diff --git a/zpu/sw/ecos/repository/hal/zylin/arch/current/src/zylin.ld b/zpu/sw/ecos/repository/hal/zylin/arch/current/src/zylin.ld new file mode 100644 index 0000000..eef2cd7 --- /dev/null +++ b/zpu/sw/ecos/repository/hal/zylin/arch/current/src/zylin.ld @@ -0,0 +1,226 @@ +//============================================================================= +// +// MLT linker script for ZYLIN +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// +// eCos 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 2 or (at your option) any later version. +// +// eCos 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 eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license/ +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= + +#include <pkgconf/system.h> + +STARTUP(crt0.o) +ENTRY(_start) +INPUT(crt_io.o) +INPUT(extras.o) +INPUT(vectors.o) +GROUP(libtarget.a libgcc.a libsupc++.a) + +// Keep RODATA in separate sections. +#define MERGE_IN_RODATA + +#define ALIGN_LMA 4 +#define FOLLOWING(_section_) AT ((LOADADDR (_section_) + SIZEOF (_section_) + ALIGN_LMA - 1) & ~ (ALIGN_LMA - 1)) +#define LMA_EQ_VMA +#define FORCE_OUTPUT . = . + +#define SECTIONS_BEGIN + +#define SECTION_fixed_vectors(_region_, _vma_, _lma_) \ + .fixed_vectors _vma_ : _lma_ \ + { FORCE_OUTPUT; KEEP (*(.fixed_vectors)) } \ + > _region_ + +#define SECTION_rom_vectors(_region_, _vma_, _lma_) \ + .rom_vectors _vma_ : _lma_ \ + { __rom_vectors_vma = ABSOLUTE(.); \ + FORCE_OUTPUT; KEEP (*(.vectors)) } \ + > _region_ \ + __rom_vectors_lma = LOADADDR(.rom_vectors); + +#define SECTION_text(_region_, _vma_, _lma_) \ + .text _vma_ : _lma_ \ + { _stext = ABSOLUTE(.); \ + PROVIDE (__stext = ABSOLUTE(.)); \ + *(.text*) *(.gnu.warning) *(.gnu.linkonce.t.*) *(.init) \ + *(.glue_7) *(.glue_7t) \ + } > _region_ \ + _etext = .; PROVIDE (__etext = .); + +#define SECTION_fini(_region_, _vma_, _lma_) \ + .fini _vma_ : _lma_ \ + { FORCE_OUTPUT; *(.fini) } \ + > _region_ + +#define SECTION_rodata(_region_, _vma_, _lma_) \ + .rodata _vma_ : _lma_ \ + { FORCE_OUTPUT; *(.rodata*) *(.gnu.linkonce.r.*) } \ + > _region_ + +#define SECTION_rodata1(_region_, _vma_, _lma_) \ + .rodata1 _vma_ : _lma_ \ + { FORCE_OUTPUT; *(.rodata1) } \ + > _region_ + +#define SECTION_fixup(_region_, _vma_, _lma_) \ + .fixup _vma_ : _lma_ \ + { FORCE_OUTPUT; *(.fixup) } \ + > _region_ + +#define SECTION_gcc_except_table(_region_, _vma_, _lma_) \ + .gcc_except_table _vma_ : _lma_ \ + { FORCE_OUTPUT; *(.gcc_except_table) } \ + > _region_ + +#define SECTION_eh_frame(_region_, _vma_, _lma_) \ + .eh_frame _vma_ : _lma_ \ + { \ + FORCE_OUTPUT; __EH_FRAME_BEGIN__ = .; \ + KEEP(*(.eh_frame)) \ + __FRAME_END__ = .; \ + . = . + 8; \ + } > _region_ = 0 + +#define SECTION_RELOCS(_region_, _vma_, _lma_) \ + .rel.text : \ + { \ + *(.rel.text) \ + *(.rel.text.*) \ + *(.rel.gnu.linkonce.t*) \ + } > _region_ \ + .rela.text : \ + { \ + *(.rela.text) \ + *(.rela.text.*) \ + *(.rela.gnu.linkonce.t*) \ + } > _region_ \ + .rel.data : \ + { \ + *(.rel.data) \ + *(.rel.data.*) \ + *(.rel.gnu.linkonce.d*) \ + } > _region_ \ + .rela.data : \ + { \ + *(.rela.data) \ + *(.rela.data.*) \ + *(.rela.gnu.linkonce.d*) \ + } > _region_ \ + .rel.rodata : \ + { \ + *(.rel.rodata) \ + *(.rel.rodata.*) \ + *(.rel.gnu.linkonce.r*) \ + } > _region_ \ + .rela.rodata : \ + { \ + *(.rela.rodata) \ + *(.rela.rodata.*) \ + *(.rela.gnu.linkonce.r*) \ + } > _region_ \ + .rel.got : { *(.rel.got) } > _region_ \ + .rela.got : { *(.rela.got) } > _region_ \ + .rel.ctors : { *(.rel.ctors) } > _region_ \ + .rela.ctors : { *(.rela.ctors) } > _region_ \ + .rel.dtors : { *(.rel.dtors) } > _region_ \ + .rela.dtors : { *(.rela.dtors) } > _region_ \ + .rel.init : { *(.rel.init) } > _region_ \ + .rela.init : { *(.rela.init) } > _region_ \ + .rel.fini : { *(.rel.fini) } > _region_ \ + .rela.fini : { *(.rela.fini) } > _region_ \ + .rel.bss : { *(.rel.bss) } > _region_ \ + .rela.bss : { *(.rela.bss) } > _region_ \ + .rel.plt : { *(.rel.plt) } > _region_ \ + .rela.plt : { *(.rela.plt) } > _region_ \ + .rel.dyn : { *(.rel.dyn) } > _region_ + +#define SECTION_got(_region_, _vma_, _lma_) \ + .got _vma_ : _lma_ \ + { \ + FORCE_OUTPUT; *(.got.plt) *(.got) \ + _GOT1_START_ = ABSOLUTE (.); *(.got1) _GOT1_END_ = ABSOLUTE (.); \ + _GOT2_START_ = ABSOLUTE (.); *(.got2) _GOT2_END_ = ABSOLUTE (.); \ + } > _region_ + +#define SECTION_mmu_tables(_region_, _vma_, _lma_) \ + .mmu_tables _vma_ : _lma_ \ + { FORCE_OUTPUT; *(.mmu_tables) } \ + > _region_ + +#define SECTION_sram(_region_, _vma_, _lma_) \ + .sram _vma_ : _lma_ \ + { FORCE_OUTPUT; *(.sram*) } \ + > _region_ + +#define SECTION_data(_region_, _vma_, _lma_) \ + .data _vma_ : _lma_ \ + { __ram_data_start = ABSOLUTE (.); \ + *(.data*) *(.data1) *(.gnu.linkonce.d.*) MERGE_IN_RODATA \ + . = ALIGN (4); \ + KEEP(*( SORT (.ecos.table.*))) ; \ + . = ALIGN (4); \ + __CTOR_LIST__ = ABSOLUTE (.); KEEP (*(SORT (.ctors*))) __CTOR_END__ = ABSOLUTE (.); \ + __DTOR_LIST__ = ABSOLUTE (.); KEEP (*(SORT (.dtors*))) __DTOR_END__ = ABSOLUTE (.); \ + *(.dynamic) *(.sdata*) *(.gnu.linkonce.s.*) \ + . = ALIGN (4); *(.2ram.*) } \ + > _region_ \ + __rom_data_start = LOADADDR (.data); \ + __ram_data_end = .; PROVIDE (__ram_data_end = .); _edata = .; PROVIDE (edata = .); \ + PROVIDE (__rom_data_end = LOADADDR (.data) + SIZEOF(.data)); + +#define SECTION_bss(_region_, _vma_, _lma_) \ + .bss _vma_ : _lma_ \ + { __bss_start = ABSOLUTE (.); \ + *(.scommon) *(.dynsbss) *(.sbss*) *(.gnu.linkonce.sb.*) \ + *(.dynbss) *(.bss*) *(.gnu.linkonce.b.*) *(COMMON) \ + __bss_end = ABSOLUTE (.); } \ + > _region_ + +// Some versions of gcc define "zpu" which causes problems with .note.arm.ident +#undef zpu +#define SECTIONS_END . = ALIGN(4); _end = .; PROVIDE (end = .); \ + /* Debug information */ \ + .debug_aranges 0 : { *(.debug_aranges) } \ + .debug_pubnames 0 : { *(.debug_pubnames) } \ + .debug_info 0 : { *(.debug_info) } \ + .debug_abbrev 0 : { *(.debug_abbrev) } \ + .debug_line 0 : { *(.debug_line) } \ + .debug_frame 0 : { *(.debug_frame) } \ + .debug_str 0 : { *(.debug_str) } \ + .debug_loc 0 : { *(.debug_loc) } \ + .debug_macinfo 0 : { *(.debug_macinfo) } \ + .note.gnu.zpu.ident 0 : { KEEP (*(.note.gnu.zpu.ident)) } + + +#include <pkgconf/hal_zylin.h> +#include CYGHWR_MEMORY_LAYOUT_LDI |