source: rtems/c/src/lib/libbsp/sparc/shared/bspstart.c @ e523ebea

4.104.114.84.95
Last change on this file since e523ebea was e523ebea, checked in by Joel Sherrill <joel.sherrill@…>, on 03/11/07 at 15:22:05

2007-03-11 Joel Sherrill <joel@…>

  • shared/bspstart.c: Remove assignments of Cpu_table.do_zero_of_workspace to TRUE since TRUE is the default value in boot_card.c
  • Property mode set to 100644
File size: 2.9 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-2006.
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 *  Ported to ERC32 implementation of the SPARC by On-Line Applications
15 *  Research Corporation (OAR) under contract to the European Space
16 *  Agency (ESA).
17 *
18 *  ERC32 modifications of respective RTEMS file: COPYRIGHT (c) 1995.
19 *  European Space Agency.
20 *
21 *  $Id$
22 */
23
24/* must be identical to STACK_SIZE in start.S */
25#define STACK_SIZE 16 * 1024
26
27#include <string.h>
28
29#include <bsp.h>
30#include <rtems/libio.h>
31#include <rtems/libcsupport.h>
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;
39rtems_configuration_table         BSP_Configuration;
40
41rtems_cpu_table Cpu_table;
42
43/*
44 *  Tells us where to put the workspace in case remote debugger is present.
45 */
46
47extern uint32_t rdb_start;
48
49/*
50 *  Use the shared implementations of the following routines
51 */
52
53void bsp_postdriver_hook(void);
54void bsp_libc_init( void *, uint32_t, int );
55extern void bsp_spurious_initialize();
56
57/*
58 *  bsp_pretasking_hook
59 *
60 *  BSP pretasking hook.  Called just before drivers are initialized.
61 *  Used to setup libc and install any BSP extensions.
62 */
63
64void bsp_pretasking_hook(void)
65{
66  extern int end;
67  uint32_t heap_start;
68  uint32_t heap_size;
69
70  heap_start = (uint32_t) &end;
71  if (heap_start & (CPU_ALIGNMENT-1))
72    heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1);
73
74  heap_size = BSP_Configuration.work_space_start - (void *)&end - STACK_SIZE;
75  heap_size &= 0xfffffff0;  /* keep it as a multiple of 16 bytes */
76
77  bsp_libc_init((void *) heap_start, heap_size, 0);
78
79#ifdef RTEMS_DEBUG
80  rtems_debug_enable( RTEMS_DEBUG_ALL_MASK );
81#endif
82
83  bsp_spurious_initialize();
84}
85
86/*
87 *  bsp_start
88 *
89 *  This routine does the bulk of the system initialization.
90 */
91
92void bsp_start( void )
93{
94  unsigned char *work_space_start;
95
96  /*
97   * Set up our hooks
98   * Make sure libc_init is done before drivers initialized so that
99   * they can use atexit()
100   */
101
102  Cpu_table.pretasking_hook = bsp_pretasking_hook;    /* init libc, etc. */
103  Cpu_table.postdriver_hook = bsp_postdriver_hook;
104
105  /*
106   *  This should be enough interrupt stack.
107   */
108
109  Cpu_table.interrupt_stack_size = CONFIGURE_INTERRUPT_STACK_MEMORY;
110
111  work_space_start =
112    (unsigned char *)rdb_start - BSP_Configuration.work_space_size;
113
114  if ( work_space_start <= (unsigned char *)&end ) {
115    DEBUG_puts( "bspstart: Not enough RAM!!!\n" );
116    BSP_fatal_return();
117  }
118
119  BSP_Configuration.work_space_start = work_space_start;
120}
Note: See TracBrowser for help on using the repository browser.