source: rtems/c/src/lib/libbsp/m68k/efi68k/startup/bspstart.c @ 9b2c969

4.104.114.84.95
Last change on this file since 9b2c969 was 9b2c969, checked in by Joel Sherrill <joel.sherrill@…>, on 01/13/00 at 15:07:03

Made sweep of changes to get all BSPs to the same point on the linkcmds
and memory layout. Next step is to share the same bsp_pretasking_hook.

  • Property mode set to 100644
File size: 2.8 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.OARcorp.com/rtems/license.html.
13 *
14 *  $Id$
15 */
16
17#include <bsp.h>
18#include <rtems/libio.h>
19#include <libcsupport.h>
20
21#include <string.h>
22 
23/*
24 *  The original table from the application and our copy of it with
25 *  some changes.
26 */
27
28extern rtems_configuration_table  Configuration;
29rtems_configuration_table         BSP_Configuration;
30
31rtems_cpu_table Cpu_table;
32
33char *rtems_progname;
34 
35rtems_unsigned32 Timer_interrupts;
36
37extern void set_debug_traps(void);
38extern void breakpoint(void);
39
40/*
41 *  Use the shared implementations of the following routines
42 */
43 
44void bsp_postdriver_hook(void);
45void bsp_libc_init( void *, unsigned32, int );
46
47/*
48 *  Function:   bsp_pretasking_hook
49 *  Created:    95/03/10
50 *
51 *  Description:
52 *      BSP pretasking hook.  Called just before drivers are initialized.
53 *      Used to setup libc and install any BSP extensions.
54 *
55 *  NOTES:
56 *      Must not use libc (to do io) from here, since drivers are
57 *      not yet initialized.
58 *
59 */
60 
61void bsp_pretasking_hook(void)
62{
63/*   extern int end; */
64  rtems_unsigned32        heap_start;
65 
66  heap_start = (rtems_unsigned32) BSP_Configuration.work_space_start +
67               (rtems_unsigned32) BSP_Configuration.work_space_size;
68  if (heap_start & (CPU_ALIGNMENT-1))
69    heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1);
70 
71  if (heap_start > (rtems_unsigned32) RAM_END) {
72    /* rtems_fatal_error_occurred can not be used before initalization */
73    RAW_PUTS("\n\rRTEMS: Out of memory.\n\r");
74    RAW_PUTS("RTEMS:    Check RAM_END and the size of the work space.\n\r");
75  }
76
77  bsp_libc_init((void *) heap_start, (RAM_END - heap_start), 0);
78 
79#ifdef RTEMS_DEBUG
80    rtems_debug_enable( RTEMS_DEBUG_ALL_MASK );
81#endif
82}
83 
84/*
85 *  bsp_start
86 *
87 *  This routine does the bulk of the system initialization.
88 */
89
90void bsp_start( void )
91{
92  void           *vbr;
93  extern        unsigned int _WorkspaceBase;
94
95/*   set_debug_traps();    */
96/*   breakpoint(); */
97
98  /*
99   *  we only use a hook to get the C library initialized.
100   */
101
102  Cpu_table.pretasking_hook = bsp_pretasking_hook;
103  Cpu_table.postdriver_hook = bsp_postdriver_hook;
104
105  m68k_get_vbr( vbr );
106  Cpu_table.interrupt_vector_table = vbr;
107
108  BSP_Configuration.work_space_start = (void *)
109    (((unsigned int)_WorkspaceBase + STACK_SIZE + 0x100) & 0xffffff00);
110
111#if 0
112    (((unsigned int)_end + STACK_SIZE + 0x100) & 0xffffff00);
113#endif
114
115  /* Clock_exit is done as an atexit() function */
116}
117
Note: See TracBrowser for help on using the repository browser.