source: rtems/c/src/lib/libbsp/powerpc/psim/startup/bspstart.c @ 86ce52b

Last change on this file since 86ce52b was 86ce52b, checked in by Joel Sherrill <joel.sherrill@…>, on Sep 4, 2003 at 6:45:13 PM

2003-09-04 Joel Sherrill <joel@…>

  • console/console-io.c, include/bsp.h, include/coverhd.h, shmsupp/addrconv.c, shmsupp/getcfg.c, shmsupp/lock.c, shmsupp/mpisr.c, startup/bspclean.c, startup/bspstart.c, startup/linkcmds, startup/setvec.c, tools/psim, tools/runtest, vectors/vectors.S: URL for license changed.
  • Property mode set to 100644
File size: 3.2 KB
Line 
1/*
2 *  This set of routines 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 any of these are invoked.
6 *
7 *  COPYRIGHT (c) 1989-1999.
8 *  On-Line Applications Research Corporation (OAR).
9 *
10 *  The license and distribution terms for this file may be
11 *  found in the file LICENSE in this distribution or at
12 *  http://www.rtems.com/license/LICENSE.
13 *
14 *  $Id$
15 */
16
17#include <string.h>
18#include <fcntl.h>
19
20#include <bsp.h>
21#include <rtems/libio.h>
22#include <rtems/libcsupport.h>
23#include <rtems/bspIo.h>
24
25/*
26 *  The original table from the application and our copy of it with
27 *  some changes.
28 */
29 
30extern rtems_configuration_table  Configuration;
31rtems_configuration_table         BSP_Configuration;
32
33rtems_cpu_table   Cpu_table;
34rtems_unsigned32  bsp_isr_level;
35
36/*
37 *  Tells us where to put the workspace in case remote debugger is present.
38 */
39
40#if 0
41extern rtems_unsigned32  rdb_start;
42#endif
43
44/*
45 *  Use the shared implementations of the following routines
46 */
47 
48void bsp_postdriver_hook(void);
49void bsp_libc_init( void *, unsigned32, int );
50
51/*
52 *  bsp_pretasking_hook
53 *
54 *  BSP pretasking hook.  Called just before drivers are initialized.
55 *  Used to setup libc and install any BSP extensions.
56 */
57
58void bsp_pretasking_hook(void)
59{
60  extern int end;
61  rtems_unsigned32 heap_start;
62  rtems_unsigned32 heap_size;
63
64  heap_start = (rtems_unsigned32) &end;
65  if (heap_start & (CPU_ALIGNMENT-1))
66    heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1);
67
68  heap_size = BSP_Configuration.work_space_start - (void *)&end;
69  heap_size &= 0xfffffff0;  /* keep it as a multiple of 16 bytes */
70
71  bsp_libc_init((void *) heap_start, heap_size, 0);
72
73#ifdef RTEMS_DEBUG
74  rtems_debug_enable( RTEMS_DEBUG_ALL_MASK );
75#endif
76
77}
78
79/*
80 *  bsp_start
81 *
82 *  This routine does the bulk of the system initialization.
83 */
84
85void bsp_start( void )
86{
87  unsigned char *work_space_start;
88
89#if 0
90  /*
91   * Set MSR to show vectors at 0 XXX
92   */
93  _CPU_MSR_Value( msr_value );
94  msr_value &= ~PPC_MSR_EP;
95  _CPU_MSR_SET( msr_value );
96#endif
97
98  /*
99   * Set up our hooks
100   * Make sure libc_init is done before drivers initialized so that
101   * they can use atexit()
102   */
103
104  Cpu_table.pretasking_hook = bsp_pretasking_hook;    /* init libc, etc. */
105  Cpu_table.postdriver_hook = bsp_postdriver_hook;
106
107  /*
108   *  Is this true?
109   *
110   *  PSIM does zero out memory BUT only when IT begins execution.  Thus
111   *  if we want to have a clean slate in the workspace each time we
112   *  begin execution of OUR application, then we must zero the workspace.
113   *
114   *  It is true that it takes simulated time to clear the memory.
115   */
116
117  Cpu_table.do_zero_of_workspace = FALSE;
118
119  Cpu_table.interrupt_stack_size = CONFIGURE_INTERRUPT_STACK_MEMORY;
120
121  /*
122   *  The monitor likes the exception table to be at 0x0.
123   */
124
125  Cpu_table.exceptions_in_RAM = TRUE;
126
127  BSP_Configuration.work_space_size += 1024;
128
129  work_space_start = 
130    (unsigned char *)&RAM_END - BSP_Configuration.work_space_size;
131
132  if ( work_space_start <= (unsigned char *)&end ) {
133    printk( "bspstart: Not enough RAM!!!\n" );
134    bsp_cleanup();
135  }
136
137  BSP_Configuration.work_space_start = work_space_start;
138
139}
Note: See TracBrowser for help on using the repository browser.