source: rtems/c/src/lib/libbsp/sh/gensh4/startup/bspstart.c @ 6ea100c1

4.104.114.95
Last change on this file since 6ea100c1 was 6ea100c1, checked in by Joel Sherrill <joel.sherrill@…>, on 05/12/08 at 18:43:55

2008-05-12 Joel Sherrill <joel.sherrill@…>

  • startup/bspstart.c: Refactored and renamed initialization routines to rtems_initialize_data_structures, rtems_initialize_before_drivers, rtems_initialize_device_drivers, and rtems_initialize_start_multitasking. This opened the sequence up so that bootcard() could provide a more robust and flexible framework which is easier to explain and understand. This also lays the groundwork for sharing the division of available memory between the RTEMS workspace and heap and the C library initialization across all BSPs.
  • Property mode set to 100644
File size: 3.1 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-2001.
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.rtems.com/license/LICENSE.
23 *
24 *  $Id$
25 */
26
27#include <bsp.h>
28#include <rtems/libio.h>
29
30#include <rtems/libcsupport.h>
31
32#include <string.h>
33
34uint32_t bsp_clicks_per_second;
35
36extern void bsp_hw_init(void);
37
38/*
39 *  Use the shared implementations of the following routines
40 */
41
42void bsp_libc_init( void *, uint32_t, int );
43
44/*
45 *  Function:   bsp_pretasking_hook
46 *
47 *  Description:
48 *      BSP pretasking hook.  Called just before drivers are initialized.
49 *      Used to setup libc and install any BSP extensions.
50 *
51 *  NOTES:
52 *      Must not use libc (to do io) from here, since drivers are
53 *      not yet initialized.
54 *
55 */
56
57void bsp_pretasking_hook(void)
58{
59    bsp_libc_init(&HeapStart, (char *)&HeapEnd - (char *)&HeapStart, 0);
60
61#ifdef RTEMS_DEBUG
62    rtems_debug_enable( RTEMS_DEBUG_ALL_MASK );
63#endif
64}
65
66/*
67 *  bsp_start
68 *
69 *  This routine does the bulk of the system initialization.
70 */
71
72void bsp_start(void)
73{
74  /*
75     For real boards you need to setup the hardware
76     and need to copy the vector table from rom to ram.
77
78     Depending on the board this can ether be done from inside the rom
79     startup code, rtems startup code or here.
80   */
81
82#ifndef START_HW_INIT
83  /* board hardware setup here, or from 'start.S' */
84  bsp_hw_init();
85#endif
86
87  /*
88   *  Allocate the memory for the RTEMS Work Space.  This can come from
89   *  a variety of places: hard coded address, malloc'ed from outside
90   *  RTEMS world (e.g. simulator or primitive memory manager), or (as
91   *  typically done by stock BSPs) by subtracting the required amount
92   *  of work space from the last physical address on the CPU board.
93   */
94
95  /*
96   *  Need to "allocate" the memory for the RTEMS Workspace and
97   *  tell the RTEMS configuration where it is.  This memory is
98   *  not malloc'ed.  It is just "pulled from the air".
99   */
100
101  Configuration.work_space_start = (void *) &WorkSpaceStart ;
102  rtems_configuration_get_work_space_size()  =
103    (uint32_t) &WorkSpaceEnd -
104    (uint32_t) &WorkSpaceStart ;
105
106  /*
107   *  initialize the CPU table for this BSP
108   */
109
110#if ( CPU_ALLOCATE_INTERRUPT_STACK == FALSE )
111  _CPU_Interrupt_stack_low = &CPU_Interrupt_stack_low ;
112  _CPU_Interrupt_stack_high = &CPU_Interrupt_stack_high ;
113#endif
114
115  /*
116   *  initialize the device driver parameters
117   */
118  bsp_clicks_per_second = CPU_CLOCK_RATE_HZ;
119}
Note: See TracBrowser for help on using the repository browser.