source: rtems/c/src/lib/libbsp/mips/p4000/startup/bspstart.c @ bd9c3d1

4.104.114.84.9
Last change on this file since bd9c3d1 was bd9c3d1, checked in by Joel Sherrill <joel.sherrill@…>, on Apr 15, 1998 at 8:50:31 PM

Numerous changes which in total greatly reduced the amount of source
code in each BSP's bspstart.c. These changes were:

+ confdefs.h now knows libio's semaphore requirements
+ shared/main.c now copies Configuration to BSP_Configuration
+ shared/main.c fills in the Cpu_table with default values

This removed the need for rtems_libio_config() and the constant
BSP_LIBIO_MAX_FDS in every BSP. Plus now the maximum number of open
files can now be set on the gcc command line.

  • Property mode set to 100644
File size: 3.0 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) 1989-1998.
8 *  On-Line Applications Research Corporation (OAR).
9 *  Copyright assigned to U.S. Government, 1994.
10 *
11 *  The license and distribution terms for this file may be
12 *  found in the file LICENSE in this distribution or at
13 *  http://www.OARcorp.com/rtems/license.html.
14 *
15 *  $Id$
16 */
17
18/*
19 *  Rather than deleting this, it is commented out to (hopefully) help
20 *  the submitter send updates.
21 *
22 *  static char _sccsid[] = "@(#)bspstart.c 06/11/96     1.2\n";
23 */
24
25
26#include <bsp.h>
27#include <rtems/libio.h>
28 
29#include <libcsupport.h>
30 
31#include <string.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;
39
40rtems_configuration_table  BSP_Configuration;
41
42rtems_cpu_table Cpu_table;
43
44char *rtems_progname;
45
46/*
47 *  Use the shared implementations of the following routines
48 */
49 
50void bsp_postdriver_hook(void);
51void bsp_libc_init( void *, unsigned32, int );
52
53/*
54 *  Function:   bsp_pretasking_hook
55 *  Created:    95/03/10
56 *
57 *  Description:
58 *      BSP pretasking hook.  Called just before drivers are initialized.
59 *      Used to setup libc and install any BSP extensions.
60 *
61 *  NOTES:
62 *      Must not use libc (to do io) from here, since drivers are
63 *      not yet initialized.
64 *
65 */
66 
67#define LIBC_HEAP_SIZE (64 * 1024)
68
69void bsp_pretasking_hook(void)
70{
71    extern int end;
72    rtems_unsigned32        heap_start;
73
74    heap_start = (rtems_unsigned32) &end;
75    if (heap_start & (CPU_ALIGNMENT-1))
76        heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1);
77
78    bsp_libc_init((void *) heap_start, LIBC_HEAP_SIZE, 0);
79
80#ifdef RTEMS_DEBUG
81    rtems_debug_enable( RTEMS_DEBUG_ALL_MASK );
82#endif
83}
84 
85extern int end; /* defined by linker */
86
87/*
88 *  bsp_start
89 *
90 *  This routine does the bulk of the system initialization.
91 */
92
93void bsp_start( void )
94{
95  /*
96   *  Allocate the memory for the RTEMS Work Space.  This can come from
97   *  a variety of places: hard coded address, malloc'ed from outside
98   *  RTEMS world (e.g. simulator or primitive memory manager), or (as
99   *  typically done by stock BSPs) by subtracting the required amount
100   *  of work space from the last physical address on the CPU board.
101   */
102
103  /*
104   *  Need to "allocate" the memory for the RTEMS Workspace and
105   *  tell the RTEMS configuration where it is.  This memory is
106   *  not malloc'ed.  It is just "pulled from the air".
107   */
108
109  BSP_Configuration.work_space_start =
110       (void *)((unsigned64)((&end) + LIBC_HEAP_SIZE + 0x2000) & ~0x7);
111
112  /*
113   *  initialize the CPU table for this BSP
114   */
115
116  Cpu_table.pretasking_hook = bsp_pretasking_hook;  /* init libc, etc. */
117  Cpu_table.postdriver_hook = bsp_postdriver_hook;
118  Cpu_table.interrupt_stack_size = 4096;
119}
Note: See TracBrowser for help on using the repository browser.