OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [lib/] [libbsp/] [sh/] [gensh1/] [startup/] [bspstart.c] - Blame information for rev 562

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 30 unneback
/*
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: bspstart.c,v 1.2 2001-09-27 12:01:11 chris Exp $
26
 */
27
 
28
#include <bsp.h>
29
#include <rtems/libio.h>
30
 
31
#include <libcsupport.h>
32
 
33
#include <string.h>
34
 
35
/*
36
 *  The original table from the application and our copy of it with
37
 *  some changes.
38
 */
39
 
40
extern rtems_configuration_table Configuration;
41
 
42
rtems_configuration_table  BSP_Configuration;
43
 
44
rtems_cpu_table Cpu_table;
45
 
46
char *rtems_progname;
47
 
48
/*
49
 *  Use the shared implementations of the following routines
50
 */
51
 
52
void bsp_postdriver_hook(void);
53
void bsp_libc_init( void *, unsigned32, int );
54
 
55
/*
56
 *  Function:   bsp_pretasking_hook
57
 *
58
 *  Description:
59
 *      BSP pretasking hook.  Called just before drivers are initialized.
60
 *      Used to setup libc and install any BSP extensions.
61
 *
62
 *  NOTES:
63
 *      Must not use libc (to do io) from here, since drivers are
64
 *      not yet initialized.
65
 *
66
 */
67
 
68
void bsp_pretasking_hook(void)
69
{
70
    bsp_libc_init(&HeapStart, sizeof(unsigned32) * (&HeapEnd - &HeapStart), 0);
71
 
72
#ifdef RTEMS_DEBUG
73
    rtems_debug_enable( RTEMS_DEBUG_ALL_MASK );
74
#endif
75
}
76
 
77
/*
78
 *  bsp_start
79
 *
80
 *  This routine does the bulk of the system initialization.
81
 */
82
 
83
void bsp_start(void)
84
{
85
  /*
86
     For real boards you need to setup the hardware
87
     and need to copy the vector table from rom to ram.
88
 
89
     Depending on the board this can either be done from inside the rom
90
     startup code, rtems startup code or here.
91
   */
92
 
93
  /*
94
   *  Allocate the memory for the RTEMS Work Space.  This can come from
95
   *  a variety of places: hard coded address, malloc'ed from outside
96
   *  RTEMS world (e.g. simulator or primitive memory manager), or (as
97
   *  typically done by stock BSPs) by subtracting the required amount
98
   *  of work space from the last physical address on the CPU board.
99
   */
100
 
101
  /*
102
   *  Need to "allocate" the memory for the RTEMS Workspace and
103
   *  tell the RTEMS configuration where it is.  This memory is
104
   *  not malloc'ed.  It is just "pulled from the air".
105
   */
106
 
107
  BSP_Configuration.work_space_start = (void *) &WorkSpaceStart ;
108
  BSP_Configuration.work_space_size  =
109
    (unsigned32) &WorkSpaceEnd -
110
    (unsigned32) &WorkSpaceStart ;
111
 
112
  /*
113
   *  initialize the CPU table for this BSP
114
   */
115
 
116
#if ( CPU_ALLOCATE_INTERRUPT_STACK == FALSE )
117
  _CPU_Interrupt_stack_low = &CPU_Interrupt_stack_low ;
118
  _CPU_Interrupt_stack_high = &CPU_Interrupt_stack_high ;
119
 
120
  Cpu_table.interrupt_stack_size =
121
    (unsigned32) (&CPU_Interrupt_stack_high) -
122
    (unsigned32) (&CPU_Interrupt_stack_low) ;
123
#endif
124
 
125
 
126
  Cpu_table.pretasking_hook = bsp_pretasking_hook;  /* init libc, etc. */
127
  Cpu_table.postdriver_hook = bsp_postdriver_hook;
128
 
129
#if ( CPU_ALLOCATE_INTERRUPT_STACK == TRUE )
130
  Cpu_table.interrupt_stack_size = CONFIGURE_INTERRUPT_STACK_MEMORY;
131
#endif
132
  Cpu_table.clicks_per_second = HZ ;
133
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.