source: rtems/c/src/lib/libbsp/m68k/gen68302/startup/bspstart.c @ 9e86dd7d

4.104.114.84.95
Last change on this file since 9e86dd7d was 9e86dd7d, checked in by Joel Sherrill <joel.sherrill@…>, on Jun 7, 1995 at 1:27:28 AM

incorporated mc68302 support

  • Property mode set to 100644
File size: 3.8 KB
Line 
1/*  bsp_start()
2 *
3 *  This routine starts the application.  It includes application,
4 *  board, and monitor specific initialization and configuration.
5 *  The generic CPU dependent initialization has been performed
6 *  before this routine is invoked.
7 *
8 *  INPUT:  NONE
9 *
10 *  OUTPUT: NONE
11 *
12 *  COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
13 *  On-Line Applications Research Corporation (OAR).
14 *  All rights assigned to U.S. Government, 1994.
15 *
16 *  This material may be reproduced by or for the U.S. Government pursuant
17 *  to the copyright license under the clause at DFARS 252.227-7013.  This
18 *  notice must appear in all copies of this file and its derivatives.
19 *
20 *  $Id$
21 */
22
23#include <rtems.h>
24#include <bsp.h>
25#include <libcsupport.h>
26
27
28/*
29 *  The original table from the application and our copy of it with
30 *  some changes.
31 */
32
33extern rtems_configuration_table Configuration;
34rtems_configuration_table  BSP_Configuration;
35
36rtems_cpu_table Cpu_table;
37
38/*      Initialize whatever libc we are using
39 *      called from postdriver hook
40 */
41
42void bsp_libc_init()
43{
44    extern int end;
45    rtems_unsigned32        heap_start;
46
47    heap_start = (rtems_unsigned32) &end;
48    if (heap_start & (CPU_ALIGNMENT-1))
49        heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1);
50
51    /*
52     *  The last parameter to RTEMS_Malloc_Initialize is the "chunk"
53     *  size which a multiple of will be requested on each sbrk()
54     *  call by malloc().  A value of 0 indicates that sbrk() should
55     *  not be called to extend the heap.
56     */
57
58    RTEMS_Malloc_Initialize((void *) heap_start, 64 * 1024, 0);
59
60    /*
61     * Set up for the libc handling.
62     */
63
64    if (BSP_Configuration.ticks_per_timeslice > 0)
65        libc_init(1);                /* reentrant if possible */
66    else
67        libc_init(0);                /* non-reentrant */
68
69    /*
70     *  Initialize the stack bounds checker
71     */
72
73#ifdef STACK_CHECKER_ON
74    Stack_check_Initialize();
75#endif
76}
77
78
79int bsp_start(
80  int argc,
81  char **argv,
82  char **environp
83)
84{
85  /*
86   *  Allocate the memory for the RTEMS Work Space.  This can come from
87   *  a variety of places: hard coded address, malloc'ed from outside
88   *  RTEMS world (e.g. simulator or primitive memory manager), or (as
89   *  typically done by stock BSPs) by subtracting the required amount
90   *  of work space from the last physical address on the CPU board.
91   */
92#if 0
93a  Cpu_table.interrupt_vector_table = (mc68000_isr *) 0/*&M68Kvec*/;
94#endif
95
96
97  /*
98   *  Copy the Configuration Table .. so we can change it
99   */
100
101  BSP_Configuration = Configuration;
102
103  /*
104   * Add 1 region for the RTEMS Malloc
105   */
106
107  BSP_Configuration.maximum_regions++;
108
109  /*
110   * Add 1 extension for newlib libc
111   */
112
113#ifdef RTEMS_NEWLIB
114    BSP_Configuration.maximum_extensions++;
115#endif
116
117  /*
118   * Add another extension if using the stack checker
119   */
120
121#ifdef STACK_CHECKER_ON
122    BSP_Configuration.maximum_extensions++;
123#endif
124
125  /*
126   *  Need to "allocate" the memory for the RTEMS Workspace and
127   *  tell the RTEMS configuration where it is.  This memory is
128   *  not malloc'ed.  It is just "pulled from the air".
129   */
130
131  BSP_Configuration.work_space_start = (void *)
132      (RAM_END - BSP_Configuration.work_space_size);
133
134  /*
135   *  initialize the CPU table for this BSP
136   */
137
138  /*
139   *  we do not use the pretasking_hook
140   */
141
142  Cpu_table.pretasking_hook = NULL;
143
144  Cpu_table.predriver_hook = bsp_libc_init;    /* RTEMS resources available */
145
146  Cpu_table.postdriver_hook = NULL;
147
148  Cpu_table.idle_task = NULL;  /* do not override system IDLE task */
149
150  Cpu_table.do_zero_of_workspace = TRUE;
151
152  Cpu_table.interrupt_stack_size = 4096;
153
154  Cpu_table.extra_system_initialization_stack = 0;
155
156  /*
157   *  Don't forget the other CPU Table entries.
158   */
159
160  /*
161   *  Start RTEMS
162   */
163
164  rtems_initialize_executive( &BSP_Configuration, &Cpu_table );
165
166  bsp_cleanup();
167
168  return 0;
169}
Note: See TracBrowser for help on using the repository browser.