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

4.104.114.84.95
Last change on this file since ac7d5ef0 was ac7d5ef0, checked in by Joel Sherrill <joel.sherrill@…>, on 05/11/95 at 17:39:37

Initial revision

  • 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 "cpu.h"
26#include "libcsupport.h"
27
28unsigned char *duart_base;
29extern struct duart_regs duart_info;
30
31#define DELAY 5000
32
33void led_putnum();
34
35/*
36 *  The original table from the application and our copy of it with
37 *  some changes.
38 */
39 
40extern rtems_configuration_table  Configuration;
41rtems_configuration_table         BSP_Configuration;
42
43rtems_cpu_table Cpu_table;
44 
45/*      Initialize whatever libc we are using
46 *      called from postdriver hook
47 */
48 
49void bsp_libc_init()
50{
51    extern int end;
52    rtems_unsigned32        heap_start;
53 
54    heap_start = (rtems_unsigned32) &end;
55    if (heap_start & (CPU_ALIGNMENT-1))
56        heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1);
57 
58        /* Create 64 KByte memory region for RTEMS executive */
59    RTEMS_Malloc_Initialize((void *) heap_start, 64 * 1024, 0);
60 
61    /*
62     * Set up for the libc handling.
63     */
64 
65    if (BSP_Configuration.ticks_per_timeslice > 0)
66        libc_init(1);                /* reentrant if possible */
67        else
68        libc_init(0);                /* non-reentrant */
69 
70    /*
71     *  Initialize the stack bounds checker
72     */
73 
74#ifdef STACK_CHECKER_ON
75    Stack_check_Initialize();
76#endif
77}
78 
79
80int bsp_start(
81  int argc,
82  char **argv,
83  char **environp
84)
85{
86  m68k_isr *monitors_vector_table;
87  int          index;
88
89  duart_base = (unsigned char *)DUART_ADDR;
90
91  /*
92   *  Set the VBR here to the monitor's default.
93   */
94
95  monitors_vector_table = (m68k_isr *)0;   /* This is where
96                                                                                          you set vector base
97                                                                                          register = 0 */
98  m68k_set_vbr( monitors_vector_table );
99
100  /* The vector interrupt table for the 680x0 is in appendix B-2
101         of the M68000 Family Programmer's reference table */
102  for ( index=2 ; index<=255 ; index++ )
103    M68Kvec[ index ] = monitors_vector_table[ 32 ];
104
105
106  M68Kvec[  2 ] = monitors_vector_table[  2 ];   /* bus error vector */
107  M68Kvec[  4 ] = monitors_vector_table[  4 ];   /* breakpoints vector */
108  M68Kvec[  9 ] = monitors_vector_table[  9 ];   /* trace vector */
109
110  /*
111   *  Set the VBR here if you do not want to use the monitor's vector table.
112   */
113
114  m68k_set_vbr( &M68Kvec );
115
116  m68k_enable_caching();
117
118  /*
119   *  we only use a hook to get the C library initialized.
120   */
121 
122  Cpu_table.pretasking_hook = NULL;
123 
124  Cpu_table.predriver_hook = bsp_libc_init;  /* RTEMS resources available */
125 
126  Cpu_table.postdriver_hook = NULL;
127 
128  Cpu_table.idle_task = NULL;  /* do not override system IDLE task */
129
130  Cpu_table.do_zero_of_workspace = TRUE;
131 
132  Cpu_table.interrupt_vector_table = (m68k_isr *) &M68Kvec;
133 
134  Cpu_table.interrupt_stack_size = 4096;
135
136  Cpu_table.extra_system_initialization_stack = 0;
137
138  /*
139   *  Copy the table
140   */
141 
142  BSP_Configuration = Configuration;
143 
144  BSP_Configuration.work_space_start = (void *)
145     (RAM_END - BSP_Configuration.work_space_size);
146 
147  /*
148   * Add 1 region for the RTEMS Malloc
149   */
150 
151  BSP_Configuration.maximum_regions++;
152 
153  /*
154   * Add 1 extension for newlib libc
155   */
156 
157#ifdef RTEMS_NEWLIB
158    BSP_Configuration.maximum_extensions++;
159#endif
160 
161  /*
162   * Add another extension if using the stack checker
163   */
164 
165#ifdef STACK_CHECKER_ON
166    BSP_Configuration.maximum_extensions++;
167#endif
168 
169/*  led_putnum('e'); * for debugging purposes only */
170  rtems_initialize_executive( &BSP_Configuration, &Cpu_table );/* does not return */
171 
172  /* Clock_exit is done as an atexit() function */
173
174  return 0;
175}
Note: See TracBrowser for help on using the repository browser.