source: rtems/c/src/lib/libbsp/sh/gensh1/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 May 15, 2008 at 3:55:28 PM

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: 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 *  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
22 *  http://www.rtems.com/license/LICENSE.
23 *
24 *  $Id$
25 */
26
27#include <string.h>
28
29#include <bsp.h>
30#include <rtems/libio.h>
31#include <rtems/libcsupport.h>
32
33uint32_t bsp_clicks_per_second;
34
35/*
36 *  Use the shared implementations of the following routines
37 */
38
39void bsp_libc_init( void *, uint32_t, int );
40
41/*
42 *  Function:   bsp_pretasking_hook
43 *
44 *  Description:
45 *      BSP pretasking hook.  Called just before drivers are initialized.
46 *      Used to setup libc and install any BSP extensions.
47 *
48 *  NOTES:
49 *      Must not use libc (to do io) from here, since drivers are
50 *      not yet initialized.
51 *
52 */
53
54void bsp_pretasking_hook(void)
55{
56    bsp_libc_init(&HeapStart, (char *)&HeapEnd - (char *)&HeapStart, 0);
57}
58
59/*
60 *  bsp_start
61 *
62 *  This routine does the bulk of the system initialization.
63 */
64
65void bsp_start(void)
66{
67  /*
68     For real boards you need to setup the hardware
69     and need to copy the vector table from rom to ram.
70
71     Depending on the board this can either be done from inside the rom
72     startup code, rtems startup code or here.
73   */
74
75  /*
76   *  Allocate the memory for the RTEMS Work Space.  This can come from
77   *  a variety of places: hard coded address, malloc'ed from outside
78   *  RTEMS world (e.g. simulator or primitive memory manager), or (as
79   *  typically done by stock BSPs) by subtracting the required amount
80   *  of work space from the last physical address on the CPU board.
81   */
82
83  /*
84   *  Need to "allocate" the memory for the RTEMS Workspace and
85   *  tell the RTEMS configuration where it is.  This memory is
86   *  not malloc'ed.  It is just "pulled from the air".
87   */
88
89  Configuration.work_space_start = (void *) &WorkSpaceStart ;
90  rtems_configuration_get_work_space_size()  =
91    (uint32_t) &WorkSpaceEnd -
92    (uint32_t) &WorkSpaceStart ;
93
94  /*
95   *  initialize the CPU table for this BSP
96   */
97
98#if ( CPU_ALLOCATE_INTERRUPT_STACK == FALSE )
99  _CPU_Interrupt_stack_low = &CPU_Interrupt_stack_low ;
100  _CPU_Interrupt_stack_high = &CPU_Interrupt_stack_high ;
101#endif
102  bsp_clicks_per_second = CPU_CLOCK_RATE_HZ;
103}
Note: See TracBrowser for help on using the repository browser.