source: rtems/c/src/lib/libbsp/sh/shsim/startup/bspstart.c @ 558bc25

4.104.114.95
Last change on this file since 558bc25 was 558bc25, checked in by Joel Sherrill <joel.sherrill@…>, on 12/03/07 at 22:26:33

2007-12-03 Joel Sherrill <joel.sherrill@…>

  • Makefile.am, startup/bspstart.c: Moved most of the remaining CPU Table fields to the Configuration Table. This included pretasking_hook, predriver_hook, postdriver_hook, idle_task, do_zero_of_workspace, extra_mpci_receive_server_stack, stack_allocate_hook, and stack_free_hook. As a side-effect of this effort some multiprocessing code was made conditional and some style clean up occurred.
  • Property mode set to 100644
File size: 3.3 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 *  COPYRIGHT (c) 2001.
8 *  Ralf Corsepius (corsepiu@faw.uni-ulm.de).
9 *
10 *  This program is distributed in the hope that it will be useful,
11 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 *
14 *  COPYRIGHT (c) 2001.
15 *  On-Line Applications Research Corporation (OAR).
16 *
17 *  The license and distribution terms for this file may be
18 *  found in the file LICENSE in this distribution or at
19 *  http://www.rtems.com/license/LICENSE.
20 *
21 *  $Id$
22 */
23
24#include <string.h>
25
26#include <bsp.h>
27#include <rtems/libio.h>
28#include <rtems/libcsupport.h>
29
30uint32_t bsp_clicks_per_second;
31
32/*
33 *  The original table from the application and our copy of it with
34 *  some changes.
35 */
36
37extern rtems_configuration_table Configuration;
38
39rtems_configuration_table  BSP_Configuration;
40
41rtems_cpu_table Cpu_table;
42
43char *rtems_progname;
44
45/*
46 *  Use the shared implementations of the following routines
47 */
48
49void bsp_postdriver_hook(void);
50void bsp_libc_init( void *, uint32_t, int );
51
52/*
53 *  Function:   bsp_pretasking_hook
54 *
55 *  Description:
56 *      BSP pretasking hook.  Called just before drivers are initialized.
57 *      Used to setup libc and install any BSP extensions.
58 *
59 *  NOTES:
60 *      Must not use libc (to do io) from here, since drivers are
61 *      not yet initialized.
62 *
63 */
64
65void bsp_pretasking_hook(void)
66{
67    bsp_libc_init(&HeapStart, (char *)&HeapEnd - (char *)&HeapStart, 0);
68
69#ifdef RTEMS_DEBUG
70    rtems_debug_enable( RTEMS_DEBUG_ALL_MASK );
71#endif
72}
73
74/*
75 *  bsp_start
76 *
77 *  This routine does the bulk of the system initialization.
78 */
79
80void bsp_start( void )
81{
82  /*
83     For real boards you need to setup the hardware
84     and need to copy the vector table from rom to ram.
85
86     Depending on the board this can either be done from inside the rom
87     startup code, rtems startup code or here.
88   */
89
90  /*
91   *  Allocate the memory for the RTEMS Work Space.  This can come from
92   *  a variety of places: hard coded address, malloc'ed from outside
93   *  RTEMS world (e.g. simulator or primitive memory manager), or (as
94   *  typically done by stock BSPs) by subtracting the required amount
95   *  of work space from the last physical address on the CPU board.
96   */
97
98  /*
99   *  Need to "allocate" the memory for the RTEMS Workspace and
100   *  tell the RTEMS configuration where it is.  This memory is
101   *  not malloc'ed.  It is just "pulled from the air".
102   */
103
104  BSP_Configuration.work_space_start = (void *) &WorkSpaceStart ;
105  BSP_Configuration.work_space_size  =
106    (uint32_t) &WorkSpaceEnd -
107    (uint32_t) &WorkSpaceStart ;
108
109  /*
110   *  initialize the CPU table for this BSP
111   */
112
113#if ( CPU_ALLOCATE_INTERRUPT_STACK == FALSE )
114  _CPU_Interrupt_stack_low = &CPU_Interrupt_stack_low ;
115  _CPU_Interrupt_stack_high = &CPU_Interrupt_stack_high ;
116
117  Cpu_table.interrupt_stack_size =
118    (uint32_t) (&CPU_Interrupt_stack_high) -
119    (uint32_t) (&CPU_Interrupt_stack_low) ;
120#endif
121
122#if ( CPU_ALLOCATE_INTERRUPT_STACK == TRUE )
123  Cpu_table.interrupt_stack_size = CONFIGURE_INTERRUPT_STACK_MEMORY;
124#endif
125  bsp_clicks_per_second = CPU_CLOCK_RATE_HZ;
126}
Note: See TracBrowser for help on using the repository browser.