source: rtems/c/src/lib/libbsp/m68k/idp/startup/bspstart.c @ 88d594a

4.104.114.84.95
Last change on this file since 88d594a was 88d594a, checked in by Joel Sherrill <joel.sherrill@…>, on 05/24/95 at 21:39:42

Fully tested on all in-house targets

  • 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 *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 *)0;   /* This is where
95                                                                                          you set vector base
96                                                                                          register = 0 */
97  m68k_set_vbr( monitors_vector_table );
98
99  /* The vector interrupt table for the 680x0 is in appendix B-2
100         of the M68000 Family Programmer's reference table */
101  for ( index=2 ; index<=255 ; index++ )
102    M68Kvec[ index ] = monitors_vector_table[ 32 ];
103
104
105  M68Kvec[  2 ] = monitors_vector_table[  2 ];   /* bus error vector */
106  M68Kvec[  4 ] = monitors_vector_table[  4 ];   /* breakpoints vector */
107  M68Kvec[  9 ] = monitors_vector_table[  9 ];   /* trace vector */
108
109  /*
110   *  Set the VBR here if you do not want to use the monitor's vector table.
111   */
112
113  m68k_set_vbr( &M68Kvec );
114
115  m68k_enable_caching();
116
117  /*
118   *  we only use a hook to get the C library initialized.
119   */
120 
121  Cpu_table.pretasking_hook = NULL;
122 
123  Cpu_table.predriver_hook = bsp_libc_init;  /* RTEMS resources available */
124 
125  Cpu_table.postdriver_hook = NULL;
126 
127  Cpu_table.idle_task = NULL;  /* do not override system IDLE task */
128
129  Cpu_table.do_zero_of_workspace = TRUE;
130 
131  Cpu_table.interrupt_vector_table = (m68k_isr *) &M68Kvec;
132 
133  Cpu_table.interrupt_stack_size = 4096;
134
135  Cpu_table.extra_system_initialization_stack = 0;
136
137  /*
138   *  Copy the table
139   */
140 
141  BSP_Configuration = Configuration;
142 
143  BSP_Configuration.work_space_start = (void *)
144     (RAM_END - BSP_Configuration.work_space_size);
145 
146  /*
147   * Add 1 region for the RTEMS Malloc
148   */
149 
150  BSP_Configuration.maximum_regions++;
151 
152  /*
153   * Add 1 extension for newlib libc
154   */
155 
156#ifdef RTEMS_NEWLIB
157    BSP_Configuration.maximum_extensions++;
158#endif
159 
160  /*
161   * Add another extension if using the stack checker
162   */
163 
164#ifdef STACK_CHECKER_ON
165    BSP_Configuration.maximum_extensions++;
166#endif
167 
168/*  led_putnum('e'); * for debugging purposes only */
169  rtems_initialize_executive( &BSP_Configuration, &Cpu_table );/* does not return */
170 
171  /* Clock_exit is done as an atexit() function */
172
173  return 0;
174}
Note: See TracBrowser for help on using the repository browser.