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

4.104.114.84.95
Last change on this file since 40a12376 was 40a12376, checked in by Joel Sherrill <joel.sherrill@…>, on May 15, 2007 at 5:38:51 PM

2007-05-15 Joel Sherrill <joel.sherrill@…>

  • shared/bspstart.c: Add include <rtems/bspIo.h> to remove warning.
  • 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#include <rtems/bspIo.h>
33
34/*
35 *  The original table from the application and our copy of it with
36 *  some changes.
37 */
38
39extern rtems_configuration_table  Configuration;
40rtems_configuration_table         BSP_Configuration;
41
42rtems_cpu_table Cpu_table;
43
44/*
45 *  Tells us where to put the workspace in case remote debugger is present.
46 */
47
48extern uint32_t rdb_start;
49
50/*
51 *  Use the shared implementations of the following routines
52 */
53
54void bsp_postdriver_hook(void);
55void bsp_libc_init( void *, uint32_t, int );
56extern void bsp_spurious_initialize();
57
58/*
59 *  bsp_pretasking_hook
60 *
61 *  BSP pretasking hook.  Called just before drivers are initialized.
62 *  Used to setup libc and install any BSP extensions.
63 */
64
65void bsp_pretasking_hook(void)
66{
67  extern int end;
68  uint32_t heap_start;
69  uint32_t heap_size;
70
71  heap_start = (uint32_t) &end;
72  if (heap_start & (CPU_ALIGNMENT-1))
73    heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1);
74
75  heap_size = BSP_Configuration.work_space_start - (void *)&end - STACK_SIZE;
76  heap_size &= 0xfffffff0;  /* keep it as a multiple of 16 bytes */
77
78  bsp_libc_init((void *) heap_start, heap_size, 0);
79
80#ifdef RTEMS_DEBUG
81  rtems_debug_enable( RTEMS_DEBUG_ALL_MASK );
82#endif
83
84  bsp_spurious_initialize();
85}
86
87/*
88 *  bsp_start
89 *
90 *  This routine does the bulk of the system initialization.
91 */
92
93void bsp_start( void )
94{
95  unsigned char *work_space_start;
96
97  /*
98   * Set up our hooks
99   * Make sure libc_init is done before drivers initialized so that
100   * they can use atexit()
101   */
102
103  Cpu_table.pretasking_hook = bsp_pretasking_hook;    /* init libc, etc. */
104  Cpu_table.postdriver_hook = bsp_postdriver_hook;
105
106  /*
107   *  This should be enough interrupt stack.
108   */
109
110  Cpu_table.interrupt_stack_size = CONFIGURE_INTERRUPT_STACK_MEMORY;
111
112  work_space_start =
113    (unsigned char *)rdb_start - BSP_Configuration.work_space_size;
114
115  if ( work_space_start <= (unsigned char *)&end ) {
116    printk( "bspstart: Not enough RAM!!!\n" );
117    BSP_fatal_return();
118  }
119
120  BSP_Configuration.work_space_start = work_space_start;
121}
Note: See TracBrowser for help on using the repository browser.