source: rtems/c/src/lib/libbsp/sparc/leon3/startup/bspstart.c @ 55cb7c9

4.104.114.84.95
Last change on this file since 55cb7c9 was 55cb7c9, checked in by Joel Sherrill <joel.sherrill@…>, on 05/09/07 at 17:49:58

2007-05-09 Joel Sherrill <joel.sherrill@…>

  • console/debugputs.c, include/bsp.h, leon_smc91111/leon_smc91111.c, startup/bspstart.c, startup/spurious.c: Remove debug print methods that are redundant with prntk and replace their use with printk.
  • Property mode set to 100644
File size: 2.8 KB
Line 
1/*
2 *  This set of routines 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 any of these are invoked.
6 *
7 *  COPYRIGHT (c) 1989-2006.
8 *  On-Line Applications Research Corporation (OAR).
9 *
10 *  Modified for LEON3 BSP.
11 *  COPYRIGHT (c) 2004.
12 *  Gaisler Research.
13 *
14 *  The license and distribution terms for this file may be
15 *  found in the file LICENSE in this distribution or at
16 *  http://www.rtems.com/license/LICENSE.
17 *
18 *  $Id$
19 */
20
21/* must be identical to STACK_SIZE in start.S */
22#define STACK_SIZE 16 * 1024
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;
36rtems_configuration_table         BSP_Configuration;
37
38rtems_cpu_table Cpu_table;
39
40/*
41 *  Tells us where to put the workspace in case remote debugger is present.
42 */
43
44extern uint32_t rdb_start;
45
46void bsp_postdriver_hook(void);
47void bsp_libc_init( void *, uint32_t, int );
48extern void bsp_spurious_initialize();
49
50/*
51 *  bsp_pretasking_hook
52 *
53 *  BSP pretasking hook.  Called just before drivers are initialized.
54 *  Used to setup libc and install any BSP extensions.
55 */
56
57void bsp_pretasking_hook(void)
58{
59  extern int end;
60  uint32_t heap_start;
61  uint32_t heap_size;
62
63  heap_start = (uint32_t) &end;
64  if (heap_start & (CPU_ALIGNMENT-1))
65    heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1);
66
67  heap_size = BSP_Configuration.work_space_start - (void *)&end - STACK_SIZE;
68  heap_size &= 0xfffffff0;  /* keep it as a multiple of 16 bytes */
69
70  bsp_libc_init((void *) heap_start, heap_size, 0);
71
72#ifdef RTEMS_DEBUG
73  rtems_debug_enable( RTEMS_DEBUG_ALL_MASK );
74#endif
75
76  bsp_spurious_initialize();
77}
78
79void bsp_leon3_predriver_hook(void);
80
81/*
82 *  bsp_start
83 *
84 *  This routine does the bulk of the system initialization.
85 */
86
87void bsp_start( void )
88{
89  unsigned char *work_space_start;
90
91  /*
92   * Set up our hooks
93   * Make sure libc_init is done before drivers initialized so that
94   * they can use atexit()
95   */
96
97  Cpu_table.pretasking_hook = bsp_pretasking_hook;    /* init libc, etc. */
98  Cpu_table.postdriver_hook = bsp_postdriver_hook;
99  Cpu_table.predriver_hook = bsp_leon3_predriver_hook;     /* scan system bus */
100
101  /*
102   *  This should be enough interrupt stack.
103   */
104
105  Cpu_table.interrupt_stack_size = CONFIGURE_INTERRUPT_STACK_MEMORY;
106
107  work_space_start =
108    (unsigned char *)rdb_start - BSP_Configuration.work_space_size;
109
110  if ( work_space_start <= (unsigned char *)&end ) {
111    printk( "bspstart: Not enough RAM!!!\n" );
112    BSP_fatal_return();
113  }
114
115  BSP_Configuration.work_space_start = work_space_start;
116}
Note: See TracBrowser for help on using the repository browser.