source: rtems/c/src/lib/libbsp/m68k/idp/startup/bspstart.c @ 497428a2

4.104.114.84.95
Last change on this file since 497428a2 was 497428a2, checked in by Joel Sherrill <joel.sherrill@…>, on May 30, 1995 at 7:42:36 PM

cpu/*types.h added and successfully compiled.
IDLE task priority changed from 0 to 255 during initialization.

  • Property mode set to 100644
File size: 4.0 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
27unsigned char *duart_base;
28extern struct duart_regs duart_info;
29
30#define DELAY 5000
31
32void led_putnum();
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/*      Initialize whatever libc we are using
45 *      called from postdriver hook
46 */
47 
48void bsp_libc_init()
49{
50    extern int end;
51    rtems_unsigned32        heap_start;
52 
53    heap_start = (rtems_unsigned32) &end;
54    if (heap_start & (CPU_ALIGNMENT-1))
55        heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1);
56 
57        /* Create 64 KByte memory region for RTEMS executive */
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  m68k_isr_entry *monitors_vector_table;
86  int             index;
87
88  duart_base = (unsigned char *)DUART_ADDR;
89
90  /*
91   *  Set the VBR here to the monitor's default.
92   */
93
94  monitors_vector_table = (m68k_isr_entry *)0;
95   /* This is where you set vector base register = 0 */
96  m68k_set_vbr( monitors_vector_table );
97
98  /* The vector interrupt table for the 680x0 is in appendix B-2
99         of the M68000 Family Programmer's reference table */
100  for ( index=2 ; index<=255 ; index++ )
101    M68Kvec[ index ] = monitors_vector_table[ 32 ];
102
103
104  M68Kvec[  2 ] = monitors_vector_table[  2 ];   /* bus error vector */
105  M68Kvec[  4 ] = monitors_vector_table[  4 ];   /* breakpoints vector */
106  M68Kvec[  9 ] = monitors_vector_table[  9 ];   /* trace vector */
107
108  /*
109   *  Set the VBR here if you do not want to use the monitor's vector table.
110   */
111
112  m68k_set_vbr( &M68Kvec );
113
114  m68k_enable_caching();
115
116  /*
117   *  we only use a hook to get the C library initialized.
118   */
119 
120  Cpu_table.pretasking_hook = NULL;
121 
122  Cpu_table.predriver_hook = bsp_libc_init;  /* RTEMS resources available */
123 
124  Cpu_table.postdriver_hook = NULL;
125 
126  Cpu_table.idle_task = NULL;  /* do not override system IDLE task */
127
128  Cpu_table.do_zero_of_workspace = TRUE;
129 
130  Cpu_table.interrupt_vector_table = (m68k_isr_entry *) &M68Kvec;
131 
132  Cpu_table.interrupt_stack_size = 4096;
133
134  Cpu_table.extra_system_initialization_stack = 0;
135
136  /*
137   *  Copy the table
138   */
139 
140  BSP_Configuration = Configuration;
141 
142  BSP_Configuration.work_space_start = (void *)
143     (RAM_END - BSP_Configuration.work_space_size);
144 
145  /*
146   * Add 1 region for the RTEMS Malloc
147   */
148 
149  BSP_Configuration.maximum_regions++;
150 
151  /*
152   * Add 1 extension for newlib libc
153   */
154 
155#ifdef RTEMS_NEWLIB
156    BSP_Configuration.maximum_extensions++;
157#endif
158 
159  /*
160   * Add another extension if using the stack checker
161   */
162 
163#ifdef STACK_CHECKER_ON
164    BSP_Configuration.maximum_extensions++;
165#endif
166 
167/*  led_putnum('e'); * for debugging purposes only */
168  rtems_initialize_executive( &BSP_Configuration, &Cpu_table );/* does not return */
169 
170  /* Clock_exit is done as an atexit() function */
171
172  return 0;
173}
Note: See TracBrowser for help on using the repository browser.