source: rtems/c/src/lib/libbsp/sh/shsim/startup/bspstart.c @ f86582c8

4.104.114.84.95
Last change on this file since f86582c8 was f86582c8, checked in by Joel Sherrill <joel.sherrill@…>, on May 11, 2001 at 4:51:25 PM

2001-05-10 Ralf Corsepius <corsepiu@…>

  • configure.in: Use RTEMS_PROG_CC_FOR_TARGET([-ansi -fasm]), adapt bspopts.h handling to other sh-BSPs.
  • include/.cvsignore: Add stamp-h*, bspopts.h*.
  • include/Makefile.am: Use include_HEADERS instead of H_FILES.
  • startup/bspstart.c: Reworked, based on the amos BSP.
  • Property mode set to 100644
File size: 3.4 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) 2001.
8 *  Ralf Corsepius (corsepiu@faw.uni-ulm.de).
9 *
10 *  This program is distributed in the hope that it will be useful,
11 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 *
14 *  COPYRIGHT (c) 2001.
15 *  On-Line Applications Research Corporation (OAR).
16 *
17 *  The license and distribution terms for this file may be
18 *  found in the file LICENSE in this distribution or at
19 *  http://www.OARcorp.com/rtems/license.html.
20 *
21 *  $Id$
22 */
23
24#include <string.h>
25
26#include <bsp.h>
27#include <rtems/libio.h>
28#include <rtems/libcsupport.h>
29
30/*
31 *  The original table from the application and our copy of it with
32 *  some changes.
33 */
34
35extern rtems_configuration_table Configuration;
36
37rtems_configuration_table  BSP_Configuration;
38
39rtems_cpu_table Cpu_table;
40
41char *rtems_progname;
42
43/*
44 *  Use the shared implementations of the following routines
45 */
46 
47void bsp_postdriver_hook(void);
48void bsp_libc_init( void *, unsigned32, int );
49
50/*
51 *  Function:   bsp_pretasking_hook
52 *
53 *  Description:
54 *      BSP pretasking hook.  Called just before drivers are initialized.
55 *      Used to setup libc and install any BSP extensions.
56 *
57 *  NOTES:
58 *      Must not use libc (to do io) from here, since drivers are
59 *      not yet initialized.
60 *
61 */
62 
63void bsp_pretasking_hook(void)
64{
65    bsp_libc_init(&HeapStart, sizeof(unsigned32) * (&HeapEnd - &HeapStart), 0);
66 
67#ifdef RTEMS_DEBUG
68    rtems_debug_enable( RTEMS_DEBUG_ALL_MASK );
69#endif
70}
71
72/*
73 *  bsp_start
74 *
75 *  This routine does the bulk of the system initialization.
76 */
77
78void bsp_start( void )
79{
80  /*
81     For real boards you need to setup the hardware
82     and need to copy the vector table from rom to ram.
83
84     Depending on the board this can either be done from inside the rom
85     startup code, rtems startup code or here.
86   */
87   
88  /*
89   *  Allocate the memory for the RTEMS Work Space.  This can come from
90   *  a variety of places: hard coded address, malloc'ed from outside
91   *  RTEMS world (e.g. simulator or primitive memory manager), or (as
92   *  typically done by stock BSPs) by subtracting the required amount
93   *  of work space from the last physical address on the CPU board.
94   */
95
96  /*
97   *  Need to "allocate" the memory for the RTEMS Workspace and
98   *  tell the RTEMS configuration where it is.  This memory is
99   *  not malloc'ed.  It is just "pulled from the air".
100   */
101
102  BSP_Configuration.work_space_start = (void *) &WorkSpaceStart ;
103  BSP_Configuration.work_space_size  = 
104    (unsigned32) &WorkSpaceEnd - 
105    (unsigned32) &WorkSpaceStart ;
106 
107  /*
108   *  initialize the CPU table for this BSP
109   */
110
111#if ( CPU_ALLOCATE_INTERRUPT_STACK == FALSE )
112  _CPU_Interrupt_stack_low = &CPU_Interrupt_stack_low ;
113  _CPU_Interrupt_stack_high = &CPU_Interrupt_stack_high ;
114
115  Cpu_table.interrupt_stack_size = 
116    (unsigned32) (&CPU_Interrupt_stack_high) -
117    (unsigned32) (&CPU_Interrupt_stack_low) ;
118#endif
119
120
121  Cpu_table.pretasking_hook = bsp_pretasking_hook;  /* init libc, etc. */
122  Cpu_table.postdriver_hook = bsp_postdriver_hook;
123 
124#if ( CPU_ALLOCATE_INTERRUPT_STACK == TRUE )
125  Cpu_table.interrupt_stack_size = CONFIGURE_INTERRUPT_STACK_MEMORY;
126#endif
127  Cpu_table.clicks_per_second = CPU_CLOCK_RATE_HZ ;
128}
Note: See TracBrowser for help on using the repository browser.