source: rtems/c/src/lib/libbsp/powerpc/helas403/startup/bspstart.c @ 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: 5.8 KB
Line 
1/*  bsp_start()
2 *
3 *  This routine starts the application.  It includes application,
4 *  board, and monitor specific initialization and configuration.
5 *  The generic CPU dependent initialization has been performed
6 *  before this routine is invoked.
7 *
8 *  INPUT:  NONE
9 *
10 *  OUTPUT: NONE
11 *
12 *  Author:     Thomas Doerfler <td@imd.m.isar.de>
13 *              IMD Ingenieurbuero fuer Microcomputertechnik
14 *
15 *  COPYRIGHT (c) 1998 by IMD
16 *
17 *  Changes from IMD are covered by the original distributions terms.
18 *  This file has been derived from the papyrus BSP:   
19 *
20 *  Author:     Andrew Bray <andy@i-cubed.co.uk>
21 *
22 *  COPYRIGHT (c) 1995 by i-cubed ltd.
23 *
24 *  To anyone who acknowledges that this file is provided "AS IS"
25 *  without any express or implied warranty:
26 *      permission to use, copy, modify, and distribute this file
27 *      for any purpose is hereby granted without fee, provided that
28 *      the above copyright notice and this notice appears in all
29 *      copies, and that the name of i-cubed limited not be used in
30 *      advertising or publicity pertaining to distribution of the
31 *      software without specific, written prior permission.
32 *      i-cubed limited makes no representations about the suitability
33 *      of this software for any purpose.
34 *
35 *  Modifications for spooling console driver and control of memory layout
36 *  with linker command file by
37 *              Thomas Doerfler <td@imd.m.isar.de>
38 *  for these modifications:
39 *  COPYRIGHT (c) 1997 by IMD, Puchheim, Germany.
40 *
41 *  To anyone who acknowledges that this file is provided "AS IS"
42 *  without any express or implied warranty:
43 *      permission to use, copy, modify, and distribute this file
44 *      for any purpose is hereby granted without fee, provided that
45 *      the above copyright notice and this notice appears in all
46 *      copies. IMD makes no representations about the suitability
47 *      of this software for any purpose.
48 *
49 *  Derived from c/src/lib/libbsp/no_cpu/no_bsp/startup/bspstart.c:
50 *
51 *  COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
52 *  On-Line Applications Research Corporation (OAR).
53 *  All rights assigned to U.S. Government, 1994.
54 *
55 *  This material may be reproduced by or for the U.S. Government pursuant
56 *  to the copyright license under the clause at DFARS 252.227-7013.  This
57 *  notice must appear in all copies of this file and its derivatives.
58 *
59 *  $Id$
60 */
61
62
63#include <bsp.h>
64#include <ictrl.h>
65#include <rtems/libio.h>
66 
67#include <libcsupport.h>
68 
69#include <string.h>
70#include <fcntl.h>
71 
72#ifdef STACK_CHECKER_ON
73#include <stackchk.h>
74#endif
75
76/*
77 *  The original table from the application and our copy of it with
78 *  some changes.
79 */
80
81extern rtems_configuration_table Configuration;
82
83rtems_configuration_table  BSP_Configuration;
84
85rtems_cpu_table Cpu_table;
86
87char *rtems_progname;
88void *bsp_ram_end = (void *)RAM_END;  /* first addr behind avail. ram area */
89
90/*      Initialize whatever libc we are using
91 *      called from postdriver hook
92 */
93 
94void bsp_postdriver_hook(void);
95void bsp_libc_init( void *, unsigned32, int );
96
97/*
98 *
99 *  bsp_predriver_hook
100 *
101 *  Before drivers are setup.
102 */
103
104void bsp_predriver_hook(void)
105{
106  rtems_status_code status;
107  /* init the PPC403GA external interrupt controller handler... */
108  status = ictrl_init();
109}
110
111/*
112 *  Function:   bsp_pretasking_hook
113 *  Created:    95/03/10
114 *
115 *  Description:
116 *      BSP pretasking hook.  Called just before drivers are initialized.
117 *      Used to setup libc and install any BSP extensions.
118 *
119 *  NOTES:
120 *      Must not use libc (to do io) from here, since drivers are
121 *      not yet initialized.
122 *
123 */
124 
125void bsp_pretasking_hook(void)
126{
127    extern int _end;
128    rtems_unsigned32        heap_start;
129
130    heap_start = (rtems_unsigned32) &_end;
131    if (heap_start & (CPU_ALIGNMENT-1))
132        heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1);
133
134    bsp_libc_init((void *) heap_start, 64 * 1024, 0);
135 
136#ifdef RTEMS_DEBUG
137    rtems_debug_enable( RTEMS_DEBUG_ALL_MASK );
138#endif
139}
140 
141
142/*
143 *  bsp_start
144 *
145 *  This routine does the bulk of the system initialization.
146 */
147
148void bsp_start( void )
149{
150  /*
151   *  Allocate the memory for the RTEMS Work Space.  This can come from
152   *  a variety of places: hard coded address, malloc'ed from outside
153   *  RTEMS world (e.g. simulator or primitive memory manager), or (as
154   *  typically done by stock BSPs) by subtracting the required amount
155   *  of work space from the last physical address on the CPU board.
156   */
157
158  /*
159   *  Need to "allocate" the memory for the RTEMS Workspace and
160   *  tell the RTEMS configuration where it is.  This memory is
161   *  not malloc'ed.  It is just "pulled from the air".
162   */
163  /* FIXME: this should be modified. work_space_size cannot be valid
164   * now, since console_reserve_resources will modify something...
165   */
166  /* FIME: plan usage of RAM better:
167     - make top of ram dynamic,
168     - take out some part for persistant log
169     - make rest of ram to heap...
170     -remove RAM_END from bsp.h, this cannot be valid...
171      or must be a function call
172   */
173  BSP_Configuration.work_space_start = (void *)
174      ((char *)(bsp_ram_end)) - BSP_Configuration.work_space_size;
175
176  /*
177   *  Account for the console's resources
178   */
179
180  console_reserve_resources( &BSP_Configuration );
181
182  /*
183   *  initialize the CPU table for this BSP
184   */
185
186  Cpu_table.pretasking_hook = bsp_pretasking_hook;  /* init libc, etc. */
187  Cpu_table.predriver_hook  = bsp_predriver_hook;
188  Cpu_table.postdriver_hook = bsp_postdriver_hook;
189  Cpu_table.interrupt_stack_size = 4 * 1024;
190
191  Cpu_table.clicks_per_usec = 25;
192  Cpu_table.serial_per_sec = 25000000;
193  Cpu_table.serial_external_clock = 0;
194  Cpu_table.timer_internal_clock  = 1;
195  Cpu_table.serial_xon_xoff = 0;
196  Cpu_table.serial_cts_rts = 1;
197  Cpu_table.serial_rate = 9600;
198  Cpu_table.timer_average_overhead = 2;
199  Cpu_table.timer_least_valid = 3;
200  Cpu_table.exceptions_in_RAM = TRUE;
201}
Note: See TracBrowser for help on using the repository browser.