source: rtems/c/src/lib/libbsp/sh/gensh1/startup/bspstart.c @ 8262fda

4.104.114.84.95
Last change on this file since 8262fda was 8262fda, checked in by Joel Sherrill <joel.sherrill@…>, on Nov 1, 2000 at 9:29:47 PM

2000-11-01 Joel Sherrill <joel@…>

  • startup/bspstart.c: assoc.h, error.h, libio_.h, libio.h, and libcsupport.h moved from libc to lib/include/rtems and now must be referenced as <rtems/XXX.h>. Header file order was cleaned up while doing this.
  • Property mode set to 100644
File size: 3.5 KB
Line 
1/*
2 *  This routine starts the application.  It includes application,
3 *  board, and monitor specific initialization and configuration.
4 *  The generic CPU dependent initialization has been performed
5 *  before this routine is invoked.
6 *
7 *  Authors: Ralf Corsepius (corsepiu@faw.uni-ulm.de) and
8 *           Bernd Becker (becker@faw.uni-ulm.de)
9 *
10 *  COPYRIGHT (c) 1997-1998, FAW Ulm, Germany
11 *
12 *  This program is distributed in the hope that it will be useful,
13 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15 *
16 *
17 *  COPYRIGHT (c) 1998.
18 *  On-Line Applications Research Corporation (OAR).
19 *  Copyright assigned to U.S. Government, 1994.
20 *
21 *  The license and distribution terms for this file may be
22 *  found in the file LICENSE in this distribution or at
23 *  http://www.OARcorp.com/rtems/license.html.
24 *
25 *  $Id$
26 */
27
28#include <string.h>
29
30#include <bsp.h>
31#include <rtems/libio.h>
32#include <rtems/libcsupport.h>
33 
34/*
35 *  The original table from the application and our copy of it with
36 *  some changes.
37 */
38
39extern rtems_configuration_table Configuration;
40
41rtems_configuration_table  BSP_Configuration;
42
43rtems_cpu_table Cpu_table;
44
45char *rtems_progname;
46
47/*
48 *  Use the shared implementations of the following routines
49 */
50 
51void bsp_postdriver_hook(void);
52void bsp_libc_init( void *, unsigned32, int );
53
54/*
55 *  Function:   bsp_pretasking_hook
56 *
57 *  Description:
58 *      BSP pretasking hook.  Called just before drivers are initialized.
59 *      Used to setup libc and install any BSP extensions.
60 *
61 *  NOTES:
62 *      Must not use libc (to do io) from here, since drivers are
63 *      not yet initialized.
64 *
65 */
66 
67void bsp_pretasking_hook(void)
68{
69    bsp_libc_init(&HeapStart, sizeof(unsigned32) * (&HeapEnd - &HeapStart), 0);
70 
71#ifdef RTEMS_DEBUG
72    rtems_debug_enable( RTEMS_DEBUG_ALL_MASK );
73#endif
74}
75
76/*
77 *  bsp_start
78 *
79 *  This routine does the bulk of the system initialization.
80 */
81
82void bsp_start(void)
83{
84  /*
85     For real boards you need to setup the hardware
86     and need to copy the vector table from rom to ram.
87
88     Depending on the board this can either be done from inside the rom
89     startup code, rtems startup code or here.
90   */
91   
92  /*
93   *  Allocate the memory for the RTEMS Work Space.  This can come from
94   *  a variety of places: hard coded address, malloc'ed from outside
95   *  RTEMS world (e.g. simulator or primitive memory manager), or (as
96   *  typically done by stock BSPs) by subtracting the required amount
97   *  of work space from the last physical address on the CPU board.
98   */
99
100  /*
101   *  Need to "allocate" the memory for the RTEMS Workspace and
102   *  tell the RTEMS configuration where it is.  This memory is
103   *  not malloc'ed.  It is just "pulled from the air".
104   */
105
106  BSP_Configuration.work_space_start = (void *) &WorkSpaceStart ;
107  BSP_Configuration.work_space_size  = 
108    (unsigned32) &WorkSpaceEnd - 
109    (unsigned32) &WorkSpaceStart ;
110 
111  /*
112   *  initialize the CPU table for this BSP
113   */
114
115#if ( CPU_ALLOCATE_INTERRUPT_STACK == FALSE )
116  _CPU_Interrupt_stack_low = &CPU_Interrupt_stack_low ;
117  _CPU_Interrupt_stack_high = &CPU_Interrupt_stack_high ;
118
119  Cpu_table.interrupt_stack_size = 
120    (unsigned32) (&CPU_Interrupt_stack_high) -
121    (unsigned32) (&CPU_Interrupt_stack_low) ;
122#endif
123
124
125  Cpu_table.pretasking_hook = bsp_pretasking_hook;  /* init libc, etc. */
126  Cpu_table.postdriver_hook = bsp_postdriver_hook;
127 
128#if ( CPU_ALLOCATE_INTERRUPT_STACK == TRUE )
129  Cpu_table.interrupt_stack_size = CONFIGURE_INTERRUPT_STACK_MEMORY;
130#endif
131  Cpu_table.clicks_per_second = HZ ;
132}
Note: See TracBrowser for help on using the repository browser.