source: rtems/c/src/lib/libbsp/powerpc/helas403/dlentry/dlentry.s @ be4284d0

4.104.114.84.95
Last change on this file since be4284d0 was be4284d0, checked in by Joel Sherrill <joel.sherrill@…>, on 09/30/98 at 21:50:42

BSP submitted by Thomas Doerfler <td@…>:

Finally I am through: I have found the last bugs that made RTEMS-
4.0-beta3 start on my ppc403 board from ROM. So now the '403
support is up to date again.

Roughly I have added the following features:

  • support for the on-chip interrupt controller (in a separate module)
  • interrupt support for the console device
  • termios support for the console device

==============================================
Since the BSP behaivour changed in some details (console no
longer is polling, other memory layout etc) I have created a new
BSP "helas403" rather than changing the "papyrus" BSP. The old
"polled" console driver still sticks around in "console.c.polled"
To get the BSP up and running, I had to create the new BSP files
(derived from papyrus). Besides that, the following source areas
have been changed:

  • c/src/lib/libcpu/powerpc/ppc403: changes to console driver, small changes to clock driver, new "ictrl" interrupt controller driver
  • c/src/exec/score/cpu/powerpc/ppc.h: some small changes (added ppc403 characteristics like a exception vector prefix register, some special register definitions). I am quite sure, they are compatible with the existing sources, although I did not check
  • c/src/exec/score/cpu/powerpc/cpu.c: There is one severe limitation in the exception entries: Due to the current code arrangement, the "branch absolute" to the ISR handler may only jump to the first 128MByte or the last 128MByte of the 4GByte address range. When the ppc403 is running out of ROM, the ROM functions are located in the last 128MByte (0xFFF00000 and up). These addresses were not handled correctly (sign reduced) in "install_raw_handler". The change I added should work on existing ppc BSPs aswell...
  • c/src/lib/libc/termios.c: During my tests, I added one change you sent me, so this patch will already be incorporated in the current source tree.

There are some smaller changes, see the attached diff file.

=========================================
Concerning the GNU toolchain:

I tried several tool chains. Finally I almost succeeded with

egcs-1.0.3a with patch egcs-1.0.3-rtems-diff-19980527

I had to add the following lines to the egcs files. Without them
configure complaint that the cross compiler could not generate
executable output.

  • additional lines needed in egcs distribution in file gcc/config/rs6000/rtems.h:

+++ lines start
#undef STARTFILE_DEFAULT_SPEC
#define STARTFILE_DEFAULT_SPEC "ecrti.o%s"

#undef ENDFILE_DEFAULT_SPEC
#define ENDFILE_DEFAULT_SPEC "ecrtn.o%s"
++++ lines end

As far as I have seen in the Changelog of egcs, you have recently
sent two patches affecting the powerpc support, but they were
added in the wrong order.... :-(

egcs-19980628 with patch egcs-19980628-rtems-diff-19980707 does
not work!

I used binutils 2.9.1 with patch binutils-2.9.1-rtems-diff-19980515

(binutils 2.8.1 does not work, internal error in gas)

and newlib-1.8.0 with patch newlib-1.8.0-rtems-diff-19980707

Finally I had to poke a line in the "bit" script, since, on my LINUX
machine, the GNU make is only available as "make", not as
"gmake"...

For all the tools and newlib I selected configuration "powerpc-
rtems".


IMD Ingenieurbuero fuer Microcomputertechnik
Thomas Doerfler Herbststrasse 8
D-82178 Puchheim Germany
email: td@…

  • Property mode set to 100644
File size: 4.5 KB
RevLine 
[be4284d0]1/*  dlentry.s
2 *
3 *  This file contains the entry code for RTEMS programs starting
4 *  after download to RAM
5 *
6 *  Author:     Thomas Doerfler <td@imd.m.isar.de>
7 *              IMD Ingenieurbuero fuer Microcomputertechnik
8 *
9 *  COPYRIGHT (c) 1998 by IMD
10 *
11 *  Changes from IMD are covered by the original distributions terms.
12 *  This file has been derived from the papyrus BSP:   
13 *
14 *  This file contains the entry veneer for RTEMS programs
15 *  downloaded to Papyrus.
16 *
17 *  Author:     Andrew Bray <andy@i-cubed.co.uk>
18 *
19 *  COPYRIGHT (c) 1995 by i-cubed ltd.
20 *
21 *  To anyone who acknowledges that this file is provided "AS IS"
22 *  without any express or implied warranty:
23 *      permission to use, copy, modify, and distribute this file
24 *      for any purpose is hereby granted without fee, provided that
25 *      the above copyright notice and this notice appears in all
26 *      copies, and that the name of i-cubed limited not be used in
27 *      advertising or publicity pertaining to distribution of the
28 *      software without specific, written prior permission.
29 *      i-cubed limited makes no representations about the suitability
30 *      of this software for any purpose.
31 *
32 *  $Id$
33 */
34
35#include "asm.h"
36
37/*
38 *  The helas403 ELF link scripts support three special sections:
39 *    .entry    The actual entry point
40 *    .vectors  The section containing the interrupt entry veneers.
41 */
42
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 */
58
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.
63       
64 */
65                               
66#if PPC_ASM == PPC_ASM_ELF
67        .section .entry
68#else
69        .csect .text[PR]
70#endif
71
72        PUBLIC_VAR (download_entry)
73SYM(download_entry):
74        bl      .startup
75base_addr:     
76
77/*---------------------------------------------------------------------------
78 * Parameters from linker
79 *--------------------------------------------------------------------------*/
80toc_pointer:   
81#if PPC_ASM == PPC_ASM_ELF
82        .long   s.got
83#else
84        .long   TOC[tc0]
85#endif
86bss_length:     
87        .long   bss.size
88bss_addr:       
89        .long   bss.start
90stack_top:
91        .long   stack.end
92/*---------------------------------------------------------------------------
93 * Reset_entry.
94 *--------------------------------------------------------------------------*/
95.startup:
96        /* Get start address, stack grows down from here... */
97        mflr    r1
98
99        /* Assume Bank regs set up..., cache etc. */
100        bl      bssclr
101
102        .extern SYM(__vectors)
103
104        lis     r2,__vectors@h          /* set EVPR exc. vector prefix */
105        mtspr   evpr,r2
106       
107        /*-------------------------------------------------------------------
108         * C_setup.
109         *------------------------------------------------------------------*/
110        lwz     r2,toc_pointer-base_addr(r1)       /* set r2 to toc */
111        lwz     r1,stack_top-base_addr(r1)         /* set r1 to stack_top */
112
113        addi    r1,r1,-56-4              /* start stack at text_addr - 56 */
114        addi    r3,r0,0x0                /* clear r3 */
115        stw     r3, 0(r1)                /* Clear stack chain */
116        stw     r3, 4(r1)
117        stw     r3, 8(r1)
118        stw     r3, 12(r1)
119        .extern SYM (boot_card)
120        b       SYM (boot_card)          /* call the first C routine */
121
122/*---------------------------------------------------------------------------
123 * bssclr.
124 *--------------------------------------------------------------------------*/
125bssclr:
126        /*-------------------------------------------------------------------
127         * Data move finished, zero out bss.
128         *------------------------------------------------------------------*/
129        lwz     r2,bss_addr-base_addr(r1)   /* start of bss set by loader */
130        lwz     r3,bss_length-base_addr(r1) /* bss length */
131        rlwinm. r3,r3,30,0x3FFFFFFF     /* form length/4 */
132        beqlr                           /* no bss */
133        mtctr   r3                      /* set ctr reg */
134        xor     r6,r6,r6                /* r6 = 0 */
135clear_bss:
136        stswi   r6,r2,0x4               /* store r6 */
137        addi    r2,r2,0x4               /* update r2 */
138        bdnz    clear_bss               /* decrement counter and loop */
139        blr                             /* return */
140.L_text_e:
141
142#if PPC_ABI == PPC_ABI_POWEROPEN
143        DESCRIPTOR (startup)
144#endif
Note: See TracBrowser for help on using the repository browser.