source: rtems/c/src/lib/libbsp/nios2/nios2_iss/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: 2.3 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) 2005-2006 Kolja Waschk rtemsdev/ixo.de
8 *  Derived from no_cpu/no_bsp/startup/bspstart.c 1.23.
9 *  COPYRIGHT (c) 1989-1999.
10 *  On-Line Applications Research Corporation (OAR).
11 *
12 *  The license and distribution terms for this file may be
13 *  found in the file LICENSE in this distribution or at
14 *  http://www.rtems.com/license/LICENSE.
15 *
16 *  $Id$
17 */
18
19#include <string.h>
20
21#include <bsp.h>
22#include <rtems/libio.h>
23#include <rtems/libcsupport.h>
24
25/*
26 *  Use the shared implementations of the following routines
27 */
28
29extern void bsp_libc_init( void *, uint32_t, int );
30
31#if 0
32extern char         _RAMBase[];
33extern char         _RAMSize[];
34extern char         _WorkspaceBase[];
35extern char         _HeapSize[];
36#else
37extern char __alt_heap_start[];
38#endif
39
40/*
41 *  Function:   bsp_pretasking_hook
42 *  Created:    95/03/10
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    unsigned long heapStart;
57    unsigned long ramSpace;
58
59    heapStart = (unsigned long)Configuration.work_space_start
60              + rtems_configuration_get_work_space_size();
61
62    if (heapStart & (CPU_ALIGNMENT-1))
63        heapStart = (heapStart + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1);
64
65    ramSpace = RAM_BASE + RAM_BYTES - heapStart;
66
67    /* TODO */
68    ramSpace -= 16384; /* Space for initial stack, not to be zeroed */
69
70    bsp_libc_init((void *)heapStart, ramSpace, 0);
71}
72
73/*
74 *  bsp_start
75 *
76 *  This routine does the bulk of the system initialization.
77 */
78
79void bsp_start( void )
80{
81  /*
82   *  Need to "allocate" the memory for the RTEMS Workspace and
83   *  tell the RTEMS configuration where it is.  This memory is
84   *  not malloc'ed.  It is just "pulled from the air".
85   */
86
87#if 0
88  Configuration.work_space_start = (void *)_WorkspaceBase;
89#else
90  Configuration.work_space_start = (void *)__alt_heap_start;
91#endif
92
93}
Note: See TracBrowser for help on using the repository browser.