source: rtems/c/src/lib/libbsp/sh/gensh2/startup/bspstart.c @ dde1fedb

4.104.114.95
Last change on this file since dde1fedb was dde1fedb, checked in by Joel Sherrill <joel.sherrill@…>, on 05/15/08 at 15:55:28

2008-05-15 Joel Sherrill <joel.sherrill@…>

  • startup/bspstart.c: Add capability for bootcard.c BSP Initialization Framework to ask the BSP where it has memory for the RTEMS Workspace and C Program Heap. These collectively are referred to as work area. If the BSP supports this, then it does not have to include code to split the available memory between the two areas. This reduces the amount of code in the BSP specific bspstart.c file. Additionally, the shared framework can initialize the C Library, call rtems_debug_enable(), and dirty the work area memory. Until most/all BSPs support this new capability, if the BSP supports this, it should call RTEMS_BSP_BOOTCARD_HANDLES_RAM_ALLOCATION from its configure.ac. When the transition is complete, this autoconf macro can be removed.
  • Property mode set to 100644
File size: 3.0 KB
RevLine 
[4a238002]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.
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
[5e1b695]22 *  http://www.rtems.com/license/LICENSE.
[4a238002]23 *
24 *  $Id$
25 */
26
[eba2e4f]27#include <string.h>
28
[4a238002]29#include <bsp.h>
30#include <rtems/libio.h>
[eba2e4f]31#include <rtems/libcsupport.h>
[0fdc099]32
[26d47f8]33uint32_t bsp_clicks_per_second;
34
[df49c60]35extern void bsp_hw_init(void);
[4a238002]36
37/*
38 *  Use the shared implementations of the following routines
39 */
[0fdc099]40
[8cf4fac5]41void bsp_libc_init( void *, uint32_t, int );
[4a238002]42
43/*
44 *  Function:   bsp_pretasking_hook
45 *
46 *  Description:
47 *      BSP pretasking hook.  Called just before drivers are initialized.
48 *      Used to setup libc and install any BSP extensions.
49 *
50 *  NOTES:
51 *      Must not use libc (to do io) from here, since drivers are
52 *      not yet initialized.
53 *
54 */
[0fdc099]55
[4a238002]56void bsp_pretasking_hook(void)
57{
[536f5f94]58    bsp_libc_init(&HeapStart, (char *)&HeapEnd - (char *)&HeapStart, 0);
[4a238002]59}
60
61/*
62 *  bsp_start
63 *
64 *  This routine does the bulk of the system initialization.
65 */
66
67void bsp_start(void)
68{
69  /*
[0fdc099]70     For real boards you need to setup the hardware
[4a238002]71     and need to copy the vector table from rom to ram.
72
[0fdc099]73     Depending on the board this can ether be done from inside the rom
[4a238002]74     startup code, rtems startup code or here.
75   */
[8b91282]76
77#ifndef START_HW_INIT
78  /* board hardware setup here, or from 'start.S' */
[df49c60]79  bsp_hw_init();
[8b91282]80#endif
[4a238002]81
82  /*
83   *  Allocate the memory for the RTEMS Work Space.  This can come from
84   *  a variety of places: hard coded address, malloc'ed from outside
85   *  RTEMS world (e.g. simulator or primitive memory manager), or (as
86   *  typically done by stock BSPs) by subtracting the required amount
87   *  of work space from the last physical address on the CPU board.
88   */
89
90  /*
91   *  Need to "allocate" the memory for the RTEMS Workspace and
92   *  tell the RTEMS configuration where it is.  This memory is
93   *  not malloc'ed.  It is just "pulled from the air".
94   */
95
[4130d8e2]96  Configuration.work_space_start = (void *) &WorkSpaceStart ;
97  rtems_configuration_get_work_space_size()  =
[8cf4fac5]98    &WorkSpaceEnd - &WorkSpaceStart ;
[0fdc099]99
[4a238002]100  /*
101   *  initialize the CPU table for this BSP
102   */
103
104#if ( CPU_ALLOCATE_INTERRUPT_STACK == FALSE )
105  _CPU_Interrupt_stack_low = &CPU_Interrupt_stack_low ;
106  _CPU_Interrupt_stack_high = &CPU_Interrupt_stack_high ;
107#endif
108
[d34d8692]109  /*
110   *  initialize the device driver parameters
111   */
[26d47f8]112  bsp_clicks_per_second = CPU_CLOCK_RATE_HZ;
[4a238002]113}
Note: See TracBrowser for help on using the repository browser.