Changeset 0ba2736 in rtems


Ignore:
Timestamp:
Jun 18, 2013, 2:12:56 PM (6 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
ff538bbf
Parents:
546c1056
git-author:
Sebastian Huber <sebastian.huber@…> (06/18/13 14:12:56)
git-committer:
Sebastian Huber <sebastian.huber@…> (06/24/13 08:53:59)
Message:

bsp/virtex: Replace low-level BSP start code

Use linkcmds.base. Use EABI with small-data area.

Location:
c/src/lib/libbsp/powerpc/virtex
Files:
1 added
1 deleted
8 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/powerpc/virtex/Makefile.am

    r546c1056 r0ba2736  
    1616nodist_include_HEADERS = include/bspopts.h
    1717nodist_include_bsp_HEADERS = ../../shared/include/bootcard.h
     18
     19include_bsp_HEADERS =
     20
    1821DISTCLEANFILES = include/bspopts.h
    1922
     
    2124
    2225include_HEADERS += include/coverhd.h
     26
     27include_bsp_HEADERS += ../shared/include/linker-symbols.h
    2328
    2429noinst_LIBRARIES = libbspstart.a
     
    2833libbspstart_a_SOURCES += ../../powerpc/shared/start/rtems_crti.S
    2934project_lib_DATA += rtems_crti.$(OBJEXT)
     35
     36# Link commands
     37project_lib_DATA += startup/linkcmds
     38dist_project_lib_DATA += ../shared/startup/linkcmds.base
    3039
    3140noinst_LIBRARIES += libbsp.a
     
    3847    ../../shared/bsppredriverhook.c ../../shared/bsppretaskinghook.c \
    3948    ../../shared/sbrk.c ../../shared/gnatinstallhandler.c
     49libbsp_a_SOURCES += ../shared/src/bsp-start-zero.S
     50
    4051# bspconsole
    4152libbsp_a_SOURCES += console/consolelite.c ../../shared/console.c \
    4253    ../../shared/console_select.c ../../shared/console_control.c \
    4354    ../../shared/console_read.c ../../shared/console_write.c
    44 include_bsp_HEADERS = include/opbintctrl.h
     55include_bsp_HEADERS += include/opbintctrl.h
    4556# opbintctrl
    4657libbsp_a_SOURCES += opbintctrl/opbintctrl.c
  • c/src/lib/libbsp/powerpc/virtex/README

    r546c1056 r0ba2736  
    4747RAM:            64MByte DRAM
    4848
    49 virtex only supports single processor operations.
     49Virtex only supports single processor operations.
    5050
    51 Porting
    52 -------
     51Configuration
     52-------------
     53
    5354This board support package is written for a typical virtex/PPC FPGA
    5455system. The rough features of such a board are described above.
     
    5758software), a parameter file "xparameters.h" is also created, which
    5859describes the basic features of the hardware (like peripherals
    59 inculded, interrupt routing etc).
     60included, interrupt routing etc.).
    6061
    6162This BSP normally takes its basic HW description for the file
     
    6465"xparameters.h" can be provided on the "configure" command line.
    6566
    66 For adapting this BSP to other boards,
     67For adapting this BSP to other boards, you can specify several configuration
     68options at the configure command line (use "./configure --help" in this
     69directory).  Here is an example for the top-level configure invocation:
    6770
    68 the following files should be
    69 modified:
    70 
    71 - c/src/lib/libbsp/powerpc/virtex/startup/linkcmds
    72         for the memory layout required
    73 
    74 - c/src/lib/libbsp/powerpc/virtex/startup/bspstart.c
    75         Here you can select the clock source for the timers and the
    76         serial interface (system clock or external clock pin), the clock
    77         rates, initial baud rate and other stuff
    78 
    79 - c/src/lib/libbsp/powerpc/virtex/include/bsp.h
    80         some BSP-related constants
    81 
    82 - c/src/lib/libbsp/powerpc/virtex/*
    83         well, they should be generic, so there _should_ be no reason
    84         to mess around there (but who knows...)
    85 
    86 
     71/path/to/rtems/sources/configure \
     72  --target=powerpc-rtems4.11 \
     73  --enable-rtemsbsp=virtex \
     74  --enable-maintainer-mode \
     75  --enable-posix \
     76  --enable-tests \
     77  --disable-networking \
     78  'RTEMS_XPARAMETERS_H="/path/to/xparameters.h"' \
     79  VIRTEX_RAM_ORIGIN=0xfffc0000 \
     80  VIRTEX_RAM_LENGTH=0x3ffec \
     81  VIRTEX_RESET_ORIGIN=0xffffffec
  • c/src/lib/libbsp/powerpc/virtex/configure.ac

    r546c1056 r0ba2736  
    1818AM_CONDITIONAL(HAS_NETWORKING,test "$HAS_NETWORKING" = "yes")
    1919
     20RTEMS_BSPOPTS_SET([BSP_START_STACK_SIZE],[*],[4096])
     21RTEMS_BSPOPTS_HELP([BSP_START_STACK_SIZE],[size of low-level start stack])
     22
    2023RTEMS_BSPOPTS_SET([PPC_USE_SPRG],[*],[1])
    2124RTEMS_BSPOPTS_HELP([PPC_USE_SPRG],
     
    3336RTEMS_BSPOPTS_HELP([RTEMS_XPARAMETERS_H],
    3437[This defines the location of the hardware specific "xparameters.h" file.
    35  in the file system. Specify an absolute path. Don't forget the double quotes])
     38 in the file system. Specify an absolute path. Do not forget the double quotes])
    3639
    3740#RSG Start - Actually, I think this is wrong
     
    4043#RSG End
    4144
     45AC_DEFUN([VIRTEX_REGION],[
     46AC_ARG_VAR([$1],[$2; default $3])dnl
     47[$1]=[$]{[$1]:-[$3]}
     48])
     49
     50VIRTEX_REGION([VIRTEX_RAM_ORIGIN],[normal RAM region origin],[0x0])
     51VIRTEX_REGION([VIRTEX_RAM_LENGTH],[normal RAM region length],[0x7ffffec])
     52VIRTEX_REGION([VIRTEX_FAST_RAM_ORIGIN],[fast RAM region origin],[0x0])
     53VIRTEX_REGION([VIRTEX_FAST_RAM_LENGTH],[fast RAM region length],[0x0])
     54VIRTEX_REGION([VIRTEX_RESET_ORIGIN],[reset region origin],[0x7ffffec])
     55VIRTEX_REGION([VIRTEX_RESET_LENGTH],[reset region length],[0x14])
     56
    4257RTEMS_BSP_CLEANUP_OPTIONS(0, 1)
    4358
    4459# Explicitly list all Makefiles here
    45 AC_CONFIG_FILES([Makefile])
     60AC_CONFIG_FILES([
     61Makefile
     62startup/linkcmds
     63])
    4664
    4765RTEMS_PPC_EXCEPTIONS
  • c/src/lib/libbsp/powerpc/virtex/include/bsp.h

    r546c1056 r0ba2736  
    6262#include <bsp/default-initial-extension.h>
    6363
     64#define BSP_INTERRUPT_STACK_AT_WORK_AREA_BEGIN
     65
    6466/* miscellaneous stuff assumed to exist */
    6567extern bool bsp_timer_internal_clock;   /* TRUE, when timer runs with CPU clk */
  • c/src/lib/libbsp/powerpc/virtex/make/custom/virtex.cfg

    r546c1056 r0ba2736  
    1111#  and (hopefully) optimize for it.
    1212#
    13 CPU_CFLAGS = -mcpu=403 -Dppc405
     13CPU_CFLAGS = -mcpu=403 -Dppc405 -meabi -msdata -fno-common
    1414
    1515# optimize flag: typically -0, could use -O4 or -fast
  • c/src/lib/libbsp/powerpc/virtex/preinstall.am

    r546c1056 r0ba2736  
    6767PREINSTALL_FILES += $(PROJECT_INCLUDE)/coverhd.h
    6868
     69$(PROJECT_INCLUDE)/bsp/linker-symbols.h: ../shared/include/linker-symbols.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
     70        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/linker-symbols.h
     71PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/linker-symbols.h
     72
    6973$(PROJECT_LIB)/start.$(OBJEXT): start.$(OBJEXT) $(PROJECT_LIB)/$(dirstamp)
    7074        $(INSTALL_DATA) $< $(PROJECT_LIB)/start.$(OBJEXT)
     
    7781$(PROJECT_LIB)/linkcmds: startup/linkcmds $(PROJECT_LIB)/$(dirstamp)
    7882        $(INSTALL_DATA) $< $(PROJECT_LIB)/linkcmds
    79 PREINSTALL_FILES += $(PROJECT_LIB)/linkcmds
     83TMPINSTALL_FILES += $(PROJECT_LIB)/linkcmds
     84
     85$(PROJECT_LIB)/linkcmds.base: ../shared/startup/linkcmds.base $(PROJECT_LIB)/$(dirstamp)
     86        $(INSTALL_DATA) $< $(PROJECT_LIB)/linkcmds.base
     87PREINSTALL_FILES += $(PROJECT_LIB)/linkcmds.base
    8088
    8189$(PROJECT_INCLUDE)/bsp/opbintctrl.h: include/opbintctrl.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
  • c/src/lib/libbsp/powerpc/virtex/start/start.S

    r546c1056 r0ba2736  
    11/*
    2  *  This file contains the entry code for RTEMS programs starting
    3  *  after download to RAM
     2 * Copyright (c) 2010-2013 embedded brains GmbH.  All rights reserved.
    43 *
    5  *  Author:     Thomas Doerfler <td@imd.m.isar.de>
    6  *              IMD Ingenieurbuero fuer Microcomputertechnik
     4 *  embedded brains GmbH
     5 *  Dornierstr. 4
     6 *  82178 Puchheim
     7 *  Germany
     8 *  <rtems@embedded-brains.de>
    79 *
    8  *  COPYRIGHT (c) 1998 by IMD
    9  *
    10  *  Changes from IMD are covered by the original distributions terms.
    11  *  This file has been derived from the papyrus BSP:
    12  *
    13  *  This file contains the entry veneer for RTEMS programs
    14  *  downloaded to Papyrus.
    15  *
    16  *  Author:     Andrew Bray <andy@i-cubed.co.uk>
    17  *
    18  *  COPYRIGHT (c) 1995 by i-cubed ltd.
    19  *
    20  *  To anyone who acknowledges that this file is provided "AS IS"
    21  *  without any express or implied warranty:
    22  *      permission to use, copy, modify, and distribute this file
    23  *      for any purpose is hereby granted without fee, provided that
    24  *      the above copyright notice and this notice appears in all
    25  *      copies, and that the name of i-cubed limited not be used in
    26  *      advertising or publicity pertaining to distribution of the
    27  *      software without specific, written prior permission.
    28  *      i-cubed limited makes no representations about the suitability
    29  *      of this software for any purpose.
    30  *
    31  *  derived from "helas403/dlentry.S":
    32  *  Id: dlentry.S,v 1.2 2000/08/02 16:30:57 joel Exp
     10 * The license and distribution terms for this file may be
     11 * found in the file LICENSE in this distribution or at
     12 * http://www.rtems.com/license/LICENSE.
    3313 */
    3414
    3515#include <rtems/asm.h>
    3616
    37 /*
    38  *  The virtex ELF link scripts support three special sections:
    39  *    .entry    The actual entry point
    40  *    .vectors  The section containing the interrupt entry veneers.
    41  */
     17#include <bspopts.h>
    4218
    43 /*
    44  *  Downloaded code loads the vectors separately to 0x00000100,
    45  *  so .entry can be over 256 bytes.
    46  *
    47  *  The other sections are linked in the following order:
    48  *    .entry
    49  *    .text
    50  *    .data
    51  *    .bss
    52  * see linker command file for section placement
    53  *
    54  *  The initial stack is set to stack.end
    55  *
    56  *  All the entry veneer has to do is to clear the BSS.
    57  */
     19#include <libcpu/powerpc-utility.h>
    5820
    59 /*
    60  *  GDB likes to have debugging information for the entry veneer.
    61  *  Here was some DWARF information. IMD removed it, because we
    62  *  could not check, whether it was still correct. Sorry.
     21        .globl _start
     22        .globl virtex_exc_vector_base
    6323
    64  */
     24        .section ".bsp_start_text", "ax"
    6525
    66         .section .entry
     26virtex_exc_vector_base:
    6727
    68         PUBLIC_VAR (start)
    69         PUBLIC_VAR (download_entry)
    70         PUBLIC_VAR (__rtems_entry_point)
    71 SYM(start):
    72 SYM(download_entry):
    73 SYM(__rtems_entry_point):
    74         bl      .startup
    75 base_addr:
     28        b       _start
    7629
    77 /*---------------------------------------------------------------------------
    78  * Parameters from linker
    79  *--------------------------------------------------------------------------*/
    80 toc_pointer:
    81         .long   s.got
    82 bss_length:
    83         .long   bss.size
    84 bss_addr:
    85         .long   bss.start
    86 stack_top:
    87         .long   stack.end
    88 PUBLIC_VAR (text_addr)
    89 text_addr:
    90         .long   text.start
     30        /* Critical Input 0x0100 */
     31        /* Machine Check 0x0200 */
     32        /* Data Storage 0x0300 */
     33        /* Instruction Storage 0x0400 */
     34        /* External 0x0500 */
     35        /* Alignment 0x0600 */
     36        /* Program 0x0700 */
     37        /* FPU Unavailable 0x0800 */
     38        /* System Call 0x0C00 */
     39        /* APU Unavailable 0x0F20 */
     40        /* Programmable-Interval Timer 0x1000 */
     41        /* Fixed-Interval Timer 0x1010 */
     42        /* Watchdog Timer 0x1020 */
     43        /* Data TLB Miss 0x1100 */
     44        /* Instruction TLB Miss 0x1200 */
     45        /* Debug 0x2000 */
     46.rept 0x2000 / 4 - 1
     47        b       twiddle
     48.endr
    9149
    92 PUBLIC_VAR (text_length)
    93 text_length:
    94         .long   text.size
    95 /*---------------------------------------------------------------------------
    96  * Reset_entry.
    97  *--------------------------------------------------------------------------*/
    98 .startup:
    99         /* Get start address, stack grows down from here... */
    100         mflr    r1
     50        /* Start stack area */
     51.rept BSP_START_STACK_SIZE / 4
     52        b       twiddle
     53.endr
    10154
    102         /* Assume Bank regs set up..., cache etc. */
    103         bl      bssclr
     55_start:
    10456
    105 #if 0
    106         .extern SYM(__vectors)
     57        /* Reset time base */
     58        li      r0, 0
     59        mtspr   TBWU, r0
     60        mtspr   TBWL, r0
    10761
    108         lis     r2,__vectors@h          /* set EVPR exc. vector prefix */
    109 #else
    110         lis     r2,0
    111 #endif
    112         mtspr   evpr,r2
     62        /* Initialize start stack */
     63        LWI     r1, _start
     64        stwu    r0, -4(r1)
     65        stwu    r0, -4(r1)
    11366
    114         /*-------------------------------------------------------------------
    115          * C_setup.
    116          *------------------------------------------------------------------*/
    117         lwz     r2,toc_pointer-base_addr(r1)       /* set r2 to toc */
    118         lwz     r1,stack_top-base_addr(r1)         /* set r1 to stack_top */
     67        /* Copy fast text */
     68        LWI     r3, bsp_section_fast_text_begin
     69        LWI     r4, bsp_section_fast_text_load_begin
     70        LWI     r5, bsp_section_fast_text_size
     71        bl      copy
    11972
    120         addi    r1,r1,-56-4              /* start stack at text_addr - 56 */
    121         addi    r3,r0,0x0                /* clear r3 */
    122         stw     r3, 0(r1)                /* Clear stack chain */
    123         stw     r3, 4(r1)
    124         stw     r3, 8(r1)
    125         stw     r3, 12(r1)
    126         lis     r5,environ@ha
    127         la      r5,environ@l(r5)        /* environp */
    128         li      r4, 0                   /* argv */
    129         li      r3, 0                   /* argc */
    130         .extern SYM(_SDA_BASE_)
    131         lis r13,SYM(_SDA_BASE_)@h
    132         ori r13,r13,SYM(_SDA_BASE_)@l
    133         .extern SYM (boot_card)
    134         b       SYM (boot_card)          /* call the first C routine */
     73        /* Copy fast data */
     74        LWI     r3, bsp_section_fast_data_begin
     75        LWI     r4, bsp_section_fast_data_load_begin
     76        LWI     r5, bsp_section_fast_data_size
     77        bl      copy
    13578
    136 /*---------------------------------------------------------------------------
    137  * bssclr.
    138  *--------------------------------------------------------------------------*/
    139 bssclr:
    140         /*-------------------------------------------------------------------
    141          * Data move finished, zero out bss.
    142          *------------------------------------------------------------------*/
    143         lwz     r2,bss_addr-base_addr(r1)   /* start of bss set by loader */
    144         lwz     r3,bss_length-base_addr(r1) /* bss length */
    145         rlwinm. r3,r3,30,0x3FFFFFFF     /* form length/4 */
    146         beqlr                           /* no bss */
    147         mtctr   r3                      /* set ctr reg */
    148         xor     r6,r6,r6                /* r6 = 0 */
    149 clear_bss:
    150         stswi   r6,r2,0x4               /* store r6 */
    151         addi    r2,r2,0x4               /* update r2 */
    152         bdnz    clear_bss               /* decrement counter and loop */
    153         blr                             /* return */
    154 .L_text_e:
     79        /* Clear SBSS */
     80        LWI     r3, bsp_section_sbss_begin
     81        LWI     r4, bsp_section_sbss_size
     82        bl      bsp_start_zero
    15583
    156         .comm   environ,4,4
     84        /* Clear BSS */
     85        LWI     r3, bsp_section_bss_begin
     86        LWI     r4, bsp_section_bss_size
     87        bl      bsp_start_zero
     88
     89        /* Set up EABI and SYSV environment */
     90        bl      __eabi
     91
     92        /* Clear command line */
     93        li      r3, 0
     94
     95        bl      boot_card
     96
     97twiddle:
     98
     99        bl      bsp_reset
     100        b       twiddle
     101
     102copy:
     103
     104        cmpw    r3, r4
     105        beqlr
     106        b       memcpy
     107
     108        /* Reset entry */
     109        .section ".virtex_reset", "ax"
     110
     111jump_to_start:
     112
     113        LWI     r3, _start
     114        mtctr   r3
     115        bctr
     116        b       jump_to_start
  • c/src/lib/libbsp/powerpc/virtex/startup/bspstart.c

    r546c1056 r0ba2736  
    6060#include <bsp.h>
    6161#include <bsp/irq.h>
     62#include <bsp/linker-symbols.h>
    6263#include <rtems/bspIo.h>
    6364#include <libcpu/cpuIdent.h>
     
    7172uint32_t _heap_end;
    7273uint32_t _top_of_ram;
     74
     75/* Symbols defined in linker command file */
     76LINKER_SYMBOL(virtex_exc_vector_base);
    7377
    7478/*
     
    8488uint32_t   bsp_timer_least_valid;      /* Least valid number from timer      */
    8589bool       bsp_timer_internal_clock;   /* TRUE, when timer runs with CPU clk */
    86 
    87 extern unsigned char IntrStack_start[];
    88 extern unsigned char IntrStack_end[];
    8990
    9091/*      Initialize whatever libc we are using
     
    105106void bsp_start( void )
    106107{
    107   ppc_cpu_id_t myCpu;
    108   ppc_cpu_revision_t myCpuRevision;
    109 
    110108  /*
    111109   * Get CPU identification dynamically. Note that the get_ppc_cpu_type()
     
    134132   * Initialize default raw exception handlers.
    135133   */
    136   ppc_exc_initialize(
     134  ppc_exc_initialize_with_vector_base(
    137135    PPC_INTERRUPT_DISABLE_MASK_DEFAULT,
    138     (uint32_t)IntrStack_start,
    139     IntrStack_end - IntrStack_start
     136    (uintptr_t) bsp_section_work_begin,
     137    rtems_configuration_get_interrupt_stack_size(),
     138    virtex_exc_vector_base
    140139  );
     140  __asm__ volatile ("mtevpr %0" : : "r" (virtex_exc_vector_base));
    141141
    142142  /*
Note: See TracChangeset for help on using the changeset viewer.