summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/powerpc/virtex
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2013-06-18 16:12:56 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2013-06-24 10:53:59 +0200
commit0ba2736d9f1629b9f6d918674c933471a0c3d0eb (patch)
treed16158c4328eff7bbbe3cb16da8f5fcf39073b15 /c/src/lib/libbsp/powerpc/virtex
parentbsp/virtex: Rename file dlentry.S in start.S (diff)
downloadrtems-0ba2736d9f1629b9f6d918674c933471a0c3d0eb.tar.bz2
bsp/virtex: Replace low-level BSP start code
Use linkcmds.base. Use EABI with small-data area.
Diffstat (limited to 'c/src/lib/libbsp/powerpc/virtex')
-rw-r--r--c/src/lib/libbsp/powerpc/virtex/Makefile.am13
-rw-r--r--c/src/lib/libbsp/powerpc/virtex/README45
-rw-r--r--c/src/lib/libbsp/powerpc/virtex/configure.ac22
-rw-r--r--c/src/lib/libbsp/powerpc/virtex/include/bsp.h2
-rw-r--r--c/src/lib/libbsp/powerpc/virtex/make/custom/virtex.cfg2
-rw-r--r--c/src/lib/libbsp/powerpc/virtex/preinstall.am10
-rw-r--r--c/src/lib/libbsp/powerpc/virtex/start/start.S250
-rw-r--r--c/src/lib/libbsp/powerpc/virtex/startup/bspstart.c18
-rw-r--r--c/src/lib/libbsp/powerpc/virtex/startup/linkcmds288
-rw-r--r--c/src/lib/libbsp/powerpc/virtex/startup/linkcmds.in33
10 files changed, 211 insertions, 472 deletions
diff --git a/c/src/lib/libbsp/powerpc/virtex/Makefile.am b/c/src/lib/libbsp/powerpc/virtex/Makefile.am
index 17225beb27..314ab8e1ad 100644
--- a/c/src/lib/libbsp/powerpc/virtex/Makefile.am
+++ b/c/src/lib/libbsp/powerpc/virtex/Makefile.am
@@ -15,12 +15,17 @@ endif
nodist_include_HEADERS = include/bspopts.h
nodist_include_bsp_HEADERS = ../../shared/include/bootcard.h
+
+include_bsp_HEADERS =
+
DISTCLEANFILES = include/bspopts.h
noinst_PROGRAMS =
include_HEADERS += include/coverhd.h
+include_bsp_HEADERS += ../shared/include/linker-symbols.h
+
noinst_LIBRARIES = libbspstart.a
libbspstart_a_SOURCES = start/start.S
project_lib_DATA = start.$(OBJEXT)
@@ -28,6 +33,10 @@ project_lib_DATA = start.$(OBJEXT)
libbspstart_a_SOURCES += ../../powerpc/shared/start/rtems_crti.S
project_lib_DATA += rtems_crti.$(OBJEXT)
+# Link commands
+project_lib_DATA += startup/linkcmds
+dist_project_lib_DATA += ../shared/startup/linkcmds.base
+
noinst_LIBRARIES += libbsp.a
libbsp_a_SOURCES =
@@ -37,11 +46,13 @@ libbsp_a_SOURCES += ../../shared/bspclean.c ../../shared/bspgetworkarea.c \
../../shared/bsppost.c startup/bspstart.c ../../shared/bootcard.c \
../../shared/bsppredriverhook.c ../../shared/bsppretaskinghook.c \
../../shared/sbrk.c ../../shared/gnatinstallhandler.c
+libbsp_a_SOURCES += ../shared/src/bsp-start-zero.S
+
# bspconsole
libbsp_a_SOURCES += console/consolelite.c ../../shared/console.c \
../../shared/console_select.c ../../shared/console_control.c \
../../shared/console_read.c ../../shared/console_write.c
-include_bsp_HEADERS = include/opbintctrl.h
+include_bsp_HEADERS += include/opbintctrl.h
# opbintctrl
libbsp_a_SOURCES += opbintctrl/opbintctrl.c
diff --git a/c/src/lib/libbsp/powerpc/virtex/README b/c/src/lib/libbsp/powerpc/virtex/README
index fa81a7859a..7dbc7f5a0e 100644
--- a/c/src/lib/libbsp/powerpc/virtex/README
+++ b/c/src/lib/libbsp/powerpc/virtex/README
@@ -46,41 +46,36 @@ clock rate: 234 MHz
ROM: 16MByte FLASH
RAM: 64MByte DRAM
-virtex only supports single processor operations.
+Virtex only supports single processor operations.
+
+Configuration
+-------------
-Porting
--------
This board support package is written for a typical virtex/PPC FPGA
system. The rough features of such a board are described above.
When a new virtex FPGA system is created (using the Xilinx design
software), a parameter file "xparameters.h" is also created, which
describes the basic features of the hardware (like peripherals
-inculded, interrupt routing etc).
+included, interrupt routing etc.).
This BSP normally takes its basic HW description for the file
"xparameters_dflt.h", which describes my FPGA system. When this BSP
should run on a different hardware, a path to the proper
"xparameters.h" can be provided on the "configure" command line.
-For adapting this BSP to other boards,
-
-the following files should be
-modified:
-
-- c/src/lib/libbsp/powerpc/virtex/startup/linkcmds
- for the memory layout required
-
-- c/src/lib/libbsp/powerpc/virtex/startup/bspstart.c
- Here you can select the clock source for the timers and the
- serial interface (system clock or external clock pin), the clock
- rates, initial baud rate and other stuff
-
-- c/src/lib/libbsp/powerpc/virtex/include/bsp.h
- some BSP-related constants
-
-- c/src/lib/libbsp/powerpc/virtex/*
- well, they should be generic, so there _should_ be no reason
- to mess around there (but who knows...)
-
-
+For adapting this BSP to other boards, you can specify several configuration
+options at the configure command line (use "./configure --help" in this
+directory). Here is an example for the top-level configure invocation:
+
+/path/to/rtems/sources/configure \
+ --target=powerpc-rtems4.11 \
+ --enable-rtemsbsp=virtex \
+ --enable-maintainer-mode \
+ --enable-posix \
+ --enable-tests \
+ --disable-networking \
+ 'RTEMS_XPARAMETERS_H="/path/to/xparameters.h"' \
+ VIRTEX_RAM_ORIGIN=0xfffc0000 \
+ VIRTEX_RAM_LENGTH=0x3ffec \
+ VIRTEX_RESET_ORIGIN=0xffffffec
diff --git a/c/src/lib/libbsp/powerpc/virtex/configure.ac b/c/src/lib/libbsp/powerpc/virtex/configure.ac
index 9e2106655e..0645c31fb9 100644
--- a/c/src/lib/libbsp/powerpc/virtex/configure.ac
+++ b/c/src/lib/libbsp/powerpc/virtex/configure.ac
@@ -17,6 +17,9 @@ RTEMS_CHECK_NETWORKING
AM_CONDITIONAL(HAS_NETWORKING,test "$HAS_NETWORKING" = "yes")
+RTEMS_BSPOPTS_SET([BSP_START_STACK_SIZE],[*],[4096])
+RTEMS_BSPOPTS_HELP([BSP_START_STACK_SIZE],[size of low-level start stack])
+
RTEMS_BSPOPTS_SET([PPC_USE_SPRG],[*],[1])
RTEMS_BSPOPTS_HELP([PPC_USE_SPRG],
[If defined, then the PowerPC specific code in RTEMS will use some
@@ -32,17 +35,32 @@ RTEMS_BSPOPTS_HELP([PPC_VECTOR_FILE_BASE],
RTEMS_BSPOPTS_SET([RTEMS_XPARAMETERS_H],[*],[\<xparameters_dflt.h\>])
RTEMS_BSPOPTS_HELP([RTEMS_XPARAMETERS_H],
[This defines the location of the hardware specific "xparameters.h" file.
- in the file system. Specify an absolute path. Don't forget the double quotes])
+ in the file system. Specify an absolute path. Do not forget the double quotes])
#RSG Start - Actually, I think this is wrong
RTEMS_BSPOPTS_SET([RTEMS_XPPC_BASE],[*],[.])
RTEMS_BSPOPTS_HELP([RTEMS_XPPC_BASE],[Defines path to Xilinx XPS PPC libraries.])
#RSG End
+AC_DEFUN([VIRTEX_REGION],[
+AC_ARG_VAR([$1],[$2; default $3])dnl
+[$1]=[$]{[$1]:-[$3]}
+])
+
+VIRTEX_REGION([VIRTEX_RAM_ORIGIN],[normal RAM region origin],[0x0])
+VIRTEX_REGION([VIRTEX_RAM_LENGTH],[normal RAM region length],[0x7ffffec])
+VIRTEX_REGION([VIRTEX_FAST_RAM_ORIGIN],[fast RAM region origin],[0x0])
+VIRTEX_REGION([VIRTEX_FAST_RAM_LENGTH],[fast RAM region length],[0x0])
+VIRTEX_REGION([VIRTEX_RESET_ORIGIN],[reset region origin],[0x7ffffec])
+VIRTEX_REGION([VIRTEX_RESET_LENGTH],[reset region length],[0x14])
+
RTEMS_BSP_CLEANUP_OPTIONS(0, 1)
# Explicitly list all Makefiles here
-AC_CONFIG_FILES([Makefile])
+AC_CONFIG_FILES([
+Makefile
+startup/linkcmds
+])
RTEMS_PPC_EXCEPTIONS
diff --git a/c/src/lib/libbsp/powerpc/virtex/include/bsp.h b/c/src/lib/libbsp/powerpc/virtex/include/bsp.h
index 034ee543fd..fac8ca2795 100644
--- a/c/src/lib/libbsp/powerpc/virtex/include/bsp.h
+++ b/c/src/lib/libbsp/powerpc/virtex/include/bsp.h
@@ -61,6 +61,8 @@ extern "C" {
#include <bsp/vectors.h>
#include <bsp/default-initial-extension.h>
+#define BSP_INTERRUPT_STACK_AT_WORK_AREA_BEGIN
+
/* miscellaneous stuff assumed to exist */
extern bool bsp_timer_internal_clock; /* TRUE, when timer runs with CPU clk */
diff --git a/c/src/lib/libbsp/powerpc/virtex/make/custom/virtex.cfg b/c/src/lib/libbsp/powerpc/virtex/make/custom/virtex.cfg
index 0283bd020e..a91530cfd3 100644
--- a/c/src/lib/libbsp/powerpc/virtex/make/custom/virtex.cfg
+++ b/c/src/lib/libbsp/powerpc/virtex/make/custom/virtex.cfg
@@ -10,7 +10,7 @@ RTEMS_CPU_MODEL=ppc405
# This contains the compiler options necessary to select the CPU model
# and (hopefully) optimize for it.
#
-CPU_CFLAGS = -mcpu=403 -Dppc405
+CPU_CFLAGS = -mcpu=403 -Dppc405 -meabi -msdata -fno-common
# optimize flag: typically -0, could use -O4 or -fast
# -O4 is ok for RTEMS
diff --git a/c/src/lib/libbsp/powerpc/virtex/preinstall.am b/c/src/lib/libbsp/powerpc/virtex/preinstall.am
index d327cef9a2..95b748e651 100644
--- a/c/src/lib/libbsp/powerpc/virtex/preinstall.am
+++ b/c/src/lib/libbsp/powerpc/virtex/preinstall.am
@@ -66,6 +66,10 @@ $(PROJECT_INCLUDE)/coverhd.h: include/coverhd.h $(PROJECT_INCLUDE)/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/coverhd.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/coverhd.h
+$(PROJECT_INCLUDE)/bsp/linker-symbols.h: ../shared/include/linker-symbols.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
+ $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/linker-symbols.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/linker-symbols.h
+
$(PROJECT_LIB)/start.$(OBJEXT): start.$(OBJEXT) $(PROJECT_LIB)/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_LIB)/start.$(OBJEXT)
TMPINSTALL_FILES += $(PROJECT_LIB)/start.$(OBJEXT)
@@ -76,7 +80,11 @@ TMPINSTALL_FILES += $(PROJECT_LIB)/rtems_crti.$(OBJEXT)
$(PROJECT_LIB)/linkcmds: startup/linkcmds $(PROJECT_LIB)/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_LIB)/linkcmds
-PREINSTALL_FILES += $(PROJECT_LIB)/linkcmds
+TMPINSTALL_FILES += $(PROJECT_LIB)/linkcmds
+
+$(PROJECT_LIB)/linkcmds.base: ../shared/startup/linkcmds.base $(PROJECT_LIB)/$(dirstamp)
+ $(INSTALL_DATA) $< $(PROJECT_LIB)/linkcmds.base
+PREINSTALL_FILES += $(PROJECT_LIB)/linkcmds.base
$(PROJECT_INCLUDE)/bsp/opbintctrl.h: include/opbintctrl.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/opbintctrl.h
diff --git a/c/src/lib/libbsp/powerpc/virtex/start/start.S b/c/src/lib/libbsp/powerpc/virtex/start/start.S
index 2cb484eea5..73855ecfc4 100644
--- a/c/src/lib/libbsp/powerpc/virtex/start/start.S
+++ b/c/src/lib/libbsp/powerpc/virtex/start/start.S
@@ -1,156 +1,116 @@
/*
- * This file contains the entry code for RTEMS programs starting
- * after download to RAM
+ * Copyright (c) 2010-2013 embedded brains GmbH. All rights reserved.
*
- * Author: Thomas Doerfler <td@imd.m.isar.de>
- * IMD Ingenieurbuero fuer Microcomputertechnik
+ * embedded brains GmbH
+ * Dornierstr. 4
+ * 82178 Puchheim
+ * Germany
+ * <rtems@embedded-brains.de>
*
- * COPYRIGHT (c) 1998 by IMD
- *
- * Changes from IMD are covered by the original distributions terms.
- * This file has been derived from the papyrus BSP:
- *
- * This file contains the entry veneer for RTEMS programs
- * downloaded to Papyrus.
- *
- * Author: Andrew Bray <andy@i-cubed.co.uk>
- *
- * COPYRIGHT (c) 1995 by i-cubed ltd.
- *
- * To anyone who acknowledges that this file is provided "AS IS"
- * without any express or implied warranty:
- * permission to use, copy, modify, and distribute this file
- * for any purpose is hereby granted without fee, provided that
- * the above copyright notice and this notice appears in all
- * copies, and that the name of i-cubed limited not be used in
- * advertising or publicity pertaining to distribution of the
- * software without specific, written prior permission.
- * i-cubed limited makes no representations about the suitability
- * of this software for any purpose.
- *
- * derived from "helas403/dlentry.S":
- * Id: dlentry.S,v 1.2 2000/08/02 16:30:57 joel Exp
+ * 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.
*/
#include <rtems/asm.h>
-/*
- * The virtex ELF link scripts support three special sections:
- * .entry The actual entry point
- * .vectors The section containing the interrupt entry veneers.
- */
+#include <bspopts.h>
-/*
- * Downloaded code loads the vectors separately to 0x00000100,
- * so .entry can be over 256 bytes.
- *
- * The other sections are linked in the following order:
- * .entry
- * .text
- * .data
- * .bss
- * see linker command file for section placement
- *
- * The initial stack is set to stack.end
- *
- * All the entry veneer has to do is to clear the BSS.
- */
+#include <libcpu/powerpc-utility.h>
-/*
- * GDB likes to have debugging information for the entry veneer.
- * Here was some DWARF information. IMD removed it, because we
- * could not check, whether it was still correct. Sorry.
+ .globl _start
+ .globl virtex_exc_vector_base
- */
+ .section ".bsp_start_text", "ax"
+
+virtex_exc_vector_base:
+
+ b _start
+
+ /* Critical Input 0x0100 */
+ /* Machine Check 0x0200 */
+ /* Data Storage 0x0300 */
+ /* Instruction Storage 0x0400 */
+ /* External 0x0500 */
+ /* Alignment 0x0600 */
+ /* Program 0x0700 */
+ /* FPU Unavailable 0x0800 */
+ /* System Call 0x0C00 */
+ /* APU Unavailable 0x0F20 */
+ /* Programmable-Interval Timer 0x1000 */
+ /* Fixed-Interval Timer 0x1010 */
+ /* Watchdog Timer 0x1020 */
+ /* Data TLB Miss 0x1100 */
+ /* Instruction TLB Miss 0x1200 */
+ /* Debug 0x2000 */
+.rept 0x2000 / 4 - 1
+ b twiddle
+.endr
+
+ /* Start stack area */
+.rept BSP_START_STACK_SIZE / 4
+ b twiddle
+.endr
+
+_start:
+
+ /* Reset time base */
+ li r0, 0
+ mtspr TBWU, r0
+ mtspr TBWL, r0
+
+ /* Initialize start stack */
+ LWI r1, _start
+ stwu r0, -4(r1)
+ stwu r0, -4(r1)
+
+ /* Copy fast text */
+ LWI r3, bsp_section_fast_text_begin
+ LWI r4, bsp_section_fast_text_load_begin
+ LWI r5, bsp_section_fast_text_size
+ bl copy
+
+ /* Copy fast data */
+ LWI r3, bsp_section_fast_data_begin
+ LWI r4, bsp_section_fast_data_load_begin
+ LWI r5, bsp_section_fast_data_size
+ bl copy
+
+ /* Clear SBSS */
+ LWI r3, bsp_section_sbss_begin
+ LWI r4, bsp_section_sbss_size
+ bl bsp_start_zero
+
+ /* Clear BSS */
+ LWI r3, bsp_section_bss_begin
+ LWI r4, bsp_section_bss_size
+ bl bsp_start_zero
+
+ /* Set up EABI and SYSV environment */
+ bl __eabi
+
+ /* Clear command line */
+ li r3, 0
+
+ bl boot_card
+
+twiddle:
+
+ bl bsp_reset
+ b twiddle
+
+copy:
+
+ cmpw r3, r4
+ beqlr
+ b memcpy
+
+ /* Reset entry */
+ .section ".virtex_reset", "ax"
+
+jump_to_start:
- .section .entry
-
- PUBLIC_VAR (start)
- PUBLIC_VAR (download_entry)
- PUBLIC_VAR (__rtems_entry_point)
-SYM(start):
-SYM(download_entry):
-SYM(__rtems_entry_point):
- bl .startup
-base_addr:
-
-/*---------------------------------------------------------------------------
- * Parameters from linker
- *--------------------------------------------------------------------------*/
-toc_pointer:
- .long s.got
-bss_length:
- .long bss.size
-bss_addr:
- .long bss.start
-stack_top:
- .long stack.end
-PUBLIC_VAR (text_addr)
-text_addr:
- .long text.start
-
-PUBLIC_VAR (text_length)
-text_length:
- .long text.size
-/*---------------------------------------------------------------------------
- * Reset_entry.
- *--------------------------------------------------------------------------*/
-.startup:
- /* Get start address, stack grows down from here... */
- mflr r1
-
- /* Assume Bank regs set up..., cache etc. */
- bl bssclr
-
-#if 0
- .extern SYM(__vectors)
-
- lis r2,__vectors@h /* set EVPR exc. vector prefix */
-#else
- lis r2,0
-#endif
- mtspr evpr,r2
-
- /*-------------------------------------------------------------------
- * C_setup.
- *------------------------------------------------------------------*/
- lwz r2,toc_pointer-base_addr(r1) /* set r2 to toc */
- lwz r1,stack_top-base_addr(r1) /* set r1 to stack_top */
-
- addi r1,r1,-56-4 /* start stack at text_addr - 56 */
- addi r3,r0,0x0 /* clear r3 */
- stw r3, 0(r1) /* Clear stack chain */
- stw r3, 4(r1)
- stw r3, 8(r1)
- stw r3, 12(r1)
- lis r5,environ@ha
- la r5,environ@l(r5) /* environp */
- li r4, 0 /* argv */
- li r3, 0 /* argc */
- .extern SYM(_SDA_BASE_)
- lis r13,SYM(_SDA_BASE_)@h
- ori r13,r13,SYM(_SDA_BASE_)@l
- .extern SYM (boot_card)
- b SYM (boot_card) /* call the first C routine */
-
-/*---------------------------------------------------------------------------
- * bssclr.
- *--------------------------------------------------------------------------*/
-bssclr:
- /*-------------------------------------------------------------------
- * Data move finished, zero out bss.
- *------------------------------------------------------------------*/
- lwz r2,bss_addr-base_addr(r1) /* start of bss set by loader */
- lwz r3,bss_length-base_addr(r1) /* bss length */
- rlwinm. r3,r3,30,0x3FFFFFFF /* form length/4 */
- beqlr /* no bss */
- mtctr r3 /* set ctr reg */
- xor r6,r6,r6 /* r6 = 0 */
-clear_bss:
- stswi r6,r2,0x4 /* store r6 */
- addi r2,r2,0x4 /* update r2 */
- bdnz clear_bss /* decrement counter and loop */
- blr /* return */
-.L_text_e:
-
- .comm environ,4,4
+ LWI r3, _start
+ mtctr r3
+ bctr
+ b jump_to_start
diff --git a/c/src/lib/libbsp/powerpc/virtex/startup/bspstart.c b/c/src/lib/libbsp/powerpc/virtex/startup/bspstart.c
index 9a4dc9fe27..57d857d3a6 100644
--- a/c/src/lib/libbsp/powerpc/virtex/startup/bspstart.c
+++ b/c/src/lib/libbsp/powerpc/virtex/startup/bspstart.c
@@ -59,6 +59,7 @@
#include <bsp.h>
#include <bsp/irq.h>
+#include <bsp/linker-symbols.h>
#include <rtems/bspIo.h>
#include <libcpu/cpuIdent.h>
#include <libcpu/spr.h>
@@ -71,6 +72,9 @@ uint32_t _heap_start;
uint32_t _heap_end;
uint32_t _top_of_ram;
+/* Symbols defined in linker command file */
+LINKER_SYMBOL(virtex_exc_vector_base);
+
/*
* Driver configuration parameters
*/
@@ -84,9 +88,6 @@ uint32_t bsp_timer_average_overhead; /* Average overhead of timer in ticks */
uint32_t bsp_timer_least_valid; /* Least valid number from timer */
bool bsp_timer_internal_clock; /* TRUE, when timer runs with CPU clk */
-extern unsigned char IntrStack_start[];
-extern unsigned char IntrStack_end[];
-
/* Initialize whatever libc we are using
* called from postdriver hook
*/
@@ -104,9 +105,6 @@ void bsp_XAssertHandler(const char* file, int line) {
*/
void bsp_start( void )
{
- ppc_cpu_id_t myCpu;
- ppc_cpu_revision_t myCpuRevision;
-
/*
* Get CPU identification dynamically. Note that the get_ppc_cpu_type()
* function store the result in global variables
@@ -133,11 +131,13 @@ void bsp_start( void )
/*
* Initialize default raw exception handlers.
*/
- ppc_exc_initialize(
+ ppc_exc_initialize_with_vector_base(
PPC_INTERRUPT_DISABLE_MASK_DEFAULT,
- (uint32_t)IntrStack_start,
- IntrStack_end - IntrStack_start
+ (uintptr_t) bsp_section_work_begin,
+ rtems_configuration_get_interrupt_stack_size(),
+ virtex_exc_vector_base
);
+ __asm__ volatile ("mtevpr %0" : : "r" (virtex_exc_vector_base));
/*
* Install our own set of exception vectors
diff --git a/c/src/lib/libbsp/powerpc/virtex/startup/linkcmds b/c/src/lib/libbsp/powerpc/virtex/startup/linkcmds
deleted file mode 100644
index 0ca293d71b..0000000000
--- a/c/src/lib/libbsp/powerpc/virtex/startup/linkcmds
+++ /dev/null
@@ -1,288 +0,0 @@
-/*
- * This file contains directives for the GNU linker which are specific
- * to the virtex
- * This file is intended to be used together with dlentry.s
- * it will generate downloadable code
- *
- * Modifications for gen405 by Dennis Ehlin
- * Modifications for virtex by Keith, Greg, and Bob
- */
-
-OUTPUT_FORMAT("elf32-powerpc", "elf32-powerpc",
- "elf32-powerpc")
-OUTPUT_ARCH(powerpc)
-
-ENTRY(download_entry)
-
-
-RamBase = DEFINED(RamBase) ? RamBase : 0x0;
-RamSize = DEFINED(RamSize) ? RamSize : 128M;
-HeapSize = DEFINED(HeapSize) ? HeapSize : 0x0;
-
-MEMORY
-{
- RAM : ORIGIN = 0, LENGTH = 128M
- /*FLASH : ORIGIN = 0xFFE00000, LENGTH = 16M*/
-}
-SECTIONS
-{
- .text 0x10000:
- {
- text.start = . ;
- *(.entry)
- *(.entry2)
- *(.text*)
- *(.rodata*)
- *(.rodata1)
-
- /*
- * Special FreeBSD sysctl sections.
- */
- . = ALIGN (16);
- __start_set_sysctl_set = .;
- *(set_sysctl_*);
- __stop_set_sysctl_set = ABSOLUTE(.);
- *(set_domain_*);
- *(set_pseudo_*);
-
- /* C++ constructors/destructors */
- *(.gnu.linkonce.t*)
-
- /* Initialization and finalization code.
- *
- * Various files can provide initialization and finalization functions.
- * The bodies of these functions are in .init and .fini sections. We
- * accumulate the bodies here, and prepend function prologues from
- * ecrti.o and function epilogues from ecrtn.o. ecrti.o must be linked
- * first; ecrtn.o must be linked last. Because these are wildcards, it
- * doesn't matter if the user does not actually link against ecrti.o and
- * ecrtn.o; the linker won't look for a file to match a wildcard. The
- * wildcard also means that it doesn't matter which directory ecrti.o
- * and ecrtn.o are in.
- */
- PROVIDE (_init = .);
- *ecrti.o(.init)
- *(.init)
- *ecrtn.o(.init)
-
- PROVIDE (_fini = .);
- *ecrti.o(.fini)
- *(.fini)
- *ecrtn.o(.init)
-
- /*
- * C++ constructors and destructors for static objects.
- * PowerPC EABI does not use crtstuff yet, so we build "old-style"
- * constructor and destructor lists that begin with the list lenght
- * end terminate with a NULL entry.
- */
-
- PROVIDE (__CTOR_LIST__ = .);
- *crtbegin.o(.ctors)
- *(.ctors)
- *crtend.o(.ctors)
- LONG(0)
- PROVIDE (__CTOR_END__ = .);
-
- PROVIDE (__DTOR_LIST__ = .);
- *crtbegin.o(.dtors)
- *(.dtors)
- *crtend.o(.dtors)
- LONG(0)
- PROVIDE (__DTOR_END__ = .);
-
- /* Exception frame info */
- *(.eh_frame)
- /* Miscellaneous read-only data */
- _rodata_start = . ;
- *(.gnu.linkonce.r*)
- *(.lit)
- *(.shdata)
- *(.rodata)
- *(.rodata1)
- *(.descriptors)
- *(rom_ver)
- _erodata = .;
-
- PROVIDE (__EXCEPT_START__ = .);
- *(.gcc_except_table*)
- PROVIDE (__EXCEPT_END__ = .);
- __GOT_START__ = .;
- s.got = .;
- *(.got.plt)
- *(.got)
- *(.got1)
- PROVIDE (__GOT2_START__ = .);
- PROVIDE (_GOT2_START_ = .);
- *(.got2)
- PROVIDE (__GOT2_END__ = .);
- PROVIDE (_GOT2_END_ = .);
-
- PROVIDE (__FIXUP_START__ = .);
- PROVIDE (_FIXUP_START_ = .);
- *(.fixup)
- PROVIDE (_FIXUP_END_ = .);
- PROVIDE (__FIXUP_END__ = .);
-
-
- /* Various possible names for the end of the .text section */
- etext = ALIGN(0x10);
- _etext = .;
-
- *(.lit)
- *(.shdata)
- _endtext = ALIGN(0x10);
- text.end = .;
- text.size = text.end - text.start;
- } >RAM
-
- text.size = text.end - text.start;
-
- .jcr : { KEEP (*(.jcr)) } >RAM
-
- .rel.dyn : {
- *(.rel.init)
- *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*)
- *(.rel.fini)
- *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*)
- *(.rel.data.rel.ro* .rel.gnu.linkonce.d.rel.ro.*)
- *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*)
- *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*)
- *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*)
- *(.rel.ctors)
- *(.rel.dtors)
- *(.rel.got)
- *(.rel.sdata .rel.sdata.* .rel.gnu.linkonce.s.*)
- *(.rel.sbss .rel.sbss.* .rel.gnu.linkonce.sb.*)
- *(.rel.sdata2 .rel.sdata2.* .rel.gnu.linkonce.s2.*)
- *(.rel.sbss2 .rel.sbss2.* .rel.gnu.linkonce.sb2.*)
- *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*)
- } >RAM
- .rela.dyn : {
- *(.rela.init)
- *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*)
- *(.rela.fini)
- *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*)
- *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*)
- *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*)
- *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*)
- *(.rela.ctors)
- *(.rela.dtors)
- *(.rela.got)
- *(.rela.got1)
- *(.rela.got2)
- *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*)
- *(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*)
- *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*)
- *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*)
- *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*)
- } >RAM
-
-
- /* R/W Data */
- .data ( . ) :
- {
- . = ALIGN (4);
-
- data.start = .;
-
- *(.data)
- *(.data1)
- *(.data.* .gnu.linkonce.d.*)
- data.end = .;
- data.size = data.end - data.start;
- } >RAM
-
- /* Arrange as follows:
- * sdata
- * sbss
- * bss
- * sbss2
- * sdata2
- * so that we have a contiguous 'bss' area
- * which can be zeroed in one sweep.
- * (sdata/sbss and sdata2/sbss2 must also be
- * contiguous).
- */
-
- _SDA_BASE_ = __SDATA_START__ + 0x8000;
- .sdata : {
- *(.sdata .sdata.*)
- *(.gnu.linkonce.s.*)
- } > RAM
- _edata = .;
- .sbss : {
- PROVIDE (__sbss_start = .); PROVIDE (___sbss_start = .);
- *(.dynsbss)
- *(.sbss .sbss.* .gnu.linkonce.sb.*)
- *(.scommon)
- PROVIDE (__sbss_end = .); PROVIDE (___sbss_end = .);
- } > RAM
- .bss : {
- *(.dynbss)
- *(.bss .bss* .gnu.linkonce.b*)
- *(COMMON)
- } >RAM
- _SDA2_BASE_ = __SBSS2_START__ + 0x8000;
- .sbss2 : {
- *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*)
- } > RAM
- .sdata2 : {
- *(.sdata2 .sdata2.* .gnu.linkonce.s2.*)
- } > RAM
-
- PROVIDE(bss.start = __SBSS_START__);
- PROVIDE(bss.size = __SBSS2_END__ - __SBSS_START__);
-
- /* align bottom of 32k init stack at a 32k boundary */
- . = . + 0x4000;
- . = ALIGN( 0x8000 );
- stack.start = .;
- . = . + 0x8000;
- stack.end = .;
- /*
- * Interrupt stack setup
- */
- IntrStack_start = ALIGN(0x10);
- . += 0x4000;
- IntrStack_end = .;
-
- PROVIDE(_end = . );
- WorkAreaBase = .;
-
- .gzipmalloc : {
- . = ALIGN (16);
- _startmalloc = .;
- } >RAM
-
-
- /* Sections for compressed .text and .data */
- /* after the .datarom section is an int specifying */
- /* the length of the following compressed image */
- /* Executes once then could get overwritten */
- .textrom 0x100000 :
- {
- *(.textrom)
- _endloader = .;
- } >RAM
-
- .datarom :
- {
- _dr_start = .;
- *(.datarom)
- _dr_end = .;
- } >RAM
- dr_len = _dr_end - _dr_start;
-
-
- .line 0 : { *(.line) }
- .debug 0 : { *(.debug) }
- .debug_sfnames 0 : { *(.debug_sfnames) }
- .debug_srcinfo 0 : { *(.debug_srcinfo) }
- .debug_pubnames 0 : { *(.debug_pubnames) }
- .debug_aranges 0 : { *(.debug_aranges) }
- .debug_aregion 0 : { *(.debug_aregion) }
- .debug_macinfo 0 : { *(.debug_macinfo) }
- .stab 0 : { *(.stab) }
- .stabstr 0 : { *(.stabstr) }
-}
diff --git a/c/src/lib/libbsp/powerpc/virtex/startup/linkcmds.in b/c/src/lib/libbsp/powerpc/virtex/startup/linkcmds.in
new file mode 100644
index 0000000000..0de4cad1f9
--- /dev/null
+++ b/c/src/lib/libbsp/powerpc/virtex/startup/linkcmds.in
@@ -0,0 +1,33 @@
+MEMORY {
+ RAM : ORIGIN = @VIRTEX_RAM_ORIGIN@, LENGTH = @VIRTEX_RAM_LENGTH@
+ FAST_RAM : ORIGIN = @VIRTEX_FAST_RAM_ORIGIN@, LENGTH = @VIRTEX_FAST_RAM_LENGTH@
+ RESET : ORIGIN = @VIRTEX_RESET_ORIGIN@, LENGTH = @VIRTEX_RESET_LENGTH@
+ EMPTY : ORIGIN = 0x0, LENGTH = 0x0
+}
+
+REGION_ALIAS ("REGION_START", RAM);
+REGION_ALIAS ("REGION_FAST_TEXT", FAST_RAM);
+REGION_ALIAS ("REGION_FAST_TEXT_LOAD", RAM);
+REGION_ALIAS ("REGION_TEXT", RAM);
+REGION_ALIAS ("REGION_TEXT_LOAD", RAM);
+REGION_ALIAS ("REGION_RODATA", RAM);
+REGION_ALIAS ("REGION_RODATA_LOAD", RAM);
+REGION_ALIAS ("REGION_FAST_DATA", FAST_RAM);
+REGION_ALIAS ("REGION_FAST_DATA_LOAD", RAM);
+REGION_ALIAS ("REGION_DATA", RAM);
+REGION_ALIAS ("REGION_DATA_LOAD", RAM);
+REGION_ALIAS ("REGION_BSS", RAM);
+REGION_ALIAS ("REGION_RWEXTRA", RAM);
+REGION_ALIAS ("REGION_WORK", RAM);
+REGION_ALIAS ("REGION_STACK", RAM);
+REGION_ALIAS ("REGION_NOCACHE", EMPTY);
+REGION_ALIAS ("REGION_NOCACHE_LOAD", EMPTY);
+REGION_ALIAS ("REGION_NVRAM", EMPTY);
+
+SECTIONS {
+ .virtex_reset : {
+ KEEP (*(.virtex_reset))
+ } > RESET AT > RESET
+}
+
+INCLUDE linkcmds.base