source: rtems/c/src/lib/libbsp/sh/gensh4/startup/bspstart.c @ 96462044

4.104.114.84.95
Last change on this file since 96462044 was 96462044, checked in by Joel Sherrill <joel.sherrill@…>, on 10/11/01 at 19:04:12

2001-10-11 Alexandra Kossovsky <sasha@…>

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