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

4.104.114.84.95
Last change on this file since 480fc6e was 480fc6e, checked in by Joel Sherrill <joel.sherrill@…>, on Sep 4, 2003 at 6:52:15 PM

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

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