source: rtems/c/src/lib/libbsp/sh/gensh1/startup/bspstart.c @ 6dd5650

4.104.114.84.95
Last change on this file since 6dd5650 was 6dd5650, checked in by Joel Sherrill <joel.sherrill@…>, on 10/12/01 at 21:05:50

2001-10-12 Joel Sherrill <joel@…>

  • include/bsp.h, include/coverhd.h, start/start.S, startup/bspclean.c, startup/bspstart.c, startup/linkcmds: Fixed typo.
  • Property mode set to 100644
File size: 3.5 KB
RevLine 
[b6394ae]1/*
[50cf94da]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 *
20 *  The license and distribution terms for this file may be
21 *  found in the file LICENSE in this distribution or at
22 *  http://www.OARcorp.com/rtems/license.html.
23 *
24 *  $Id$
25 */
26
[8262fda]27#include <string.h>
28
[50cf94da]29#include <bsp.h>
30#include <rtems/libio.h>
[8262fda]31#include <rtems/libcsupport.h>
[50cf94da]32 
33/*
34 *  The original table from the application and our copy of it with
35 *  some changes.
36 */
37
38extern rtems_configuration_table Configuration;
39
40rtems_configuration_table  BSP_Configuration;
41
42rtems_cpu_table Cpu_table;
43
44char *rtems_progname;
45
[b6394ae]46/*
47 *  Use the shared implementations of the following routines
[50cf94da]48 */
[b6394ae]49 
50void bsp_postdriver_hook(void);
51void bsp_libc_init( void *, unsigned32, int );
[50cf94da]52
53/*
54 *  Function:   bsp_pretasking_hook
55 *
56 *  Description:
57 *      BSP pretasking hook.  Called just before drivers are initialized.
58 *      Used to setup libc and install any BSP extensions.
59 *
60 *  NOTES:
61 *      Must not use libc (to do io) from here, since drivers are
62 *      not yet initialized.
63 *
64 */
65 
[b6394ae]66void bsp_pretasking_hook(void)
[50cf94da]67{
[bd9c3d1]68    bsp_libc_init(&HeapStart, sizeof(unsigned32) * (&HeapEnd - &HeapStart), 0);
[50cf94da]69 
70#ifdef RTEMS_DEBUG
71    rtems_debug_enable( RTEMS_DEBUG_ALL_MASK );
72#endif
73}
74
75/*
[b6394ae]76 *  bsp_start
77 *
78 *  This routine does the bulk of the system initialization.
[50cf94da]79 */
80
[e2a2ec60]81void bsp_start(void)
[50cf94da]82{
83  /*
84     For real boards you need to setup the hardware
85     and need to copy the vector table from rom to ram.
86
[2e26bbd]87     Depending on the board this can either be done from inside the rom
[50cf94da]88     startup code, rtems startup code or here.
89   */
90   
91  /*
92   *  Allocate the memory for the RTEMS Work Space.  This can come from
93   *  a variety of places: hard coded address, malloc'ed from outside
94   *  RTEMS world (e.g. simulator or primitive memory manager), or (as
95   *  typically done by stock BSPs) by subtracting the required amount
96   *  of work space from the last physical address on the CPU board.
97   */
98
99  /*
100   *  Need to "allocate" the memory for the RTEMS Workspace and
101   *  tell the RTEMS configuration where it is.  This memory is
102   *  not malloc'ed.  It is just "pulled from the air".
103   */
104
105  BSP_Configuration.work_space_start = (void *) &WorkSpaceStart ;
106  BSP_Configuration.work_space_size  =
107    (unsigned32) &WorkSpaceEnd -
108    (unsigned32) &WorkSpaceStart ;
109 
110  /*
111   *  initialize the CPU table for this BSP
112   */
113
114#if ( CPU_ALLOCATE_INTERRUPT_STACK == FALSE )
115  _CPU_Interrupt_stack_low = &CPU_Interrupt_stack_low ;
116  _CPU_Interrupt_stack_high = &CPU_Interrupt_stack_high ;
117
118  Cpu_table.interrupt_stack_size =
119    (unsigned32) (&CPU_Interrupt_stack_high) -
120    (unsigned32) (&CPU_Interrupt_stack_low) ;
121#endif
122
123
124  Cpu_table.pretasking_hook = bsp_pretasking_hook;  /* init libc, etc. */
125  Cpu_table.postdriver_hook = bsp_postdriver_hook;
[4a238002]126 
[50cf94da]127#if ( CPU_ALLOCATE_INTERRUPT_STACK == TRUE )
[df49c60]128  Cpu_table.interrupt_stack_size = CONFIGURE_INTERRUPT_STACK_MEMORY;
[50cf94da]129#endif
[60391a2]130  Cpu_table.clicks_per_second = CPU_CLOCK_RATE_HZ ;
[50cf94da]131}
Note: See TracBrowser for help on using the repository browser.