source: rtems/c/src/lib/libbsp/arm/vegaplus/startup/bspstart.c @ f05b2ac

4.104.114.84.95
Last change on this file since f05b2ac was f05b2ac, checked in by Ralf Corsepius <ralf.corsepius@…>, on 04/21/04 at 16:01:48

Remove duplicate white lines.

  • Property mode set to 100644
File size: 5.7 KB
Line 
1/*-------------------------------------------------------------------------+
2| This file contains the ARM BSP startup package. It includes application,
3| board, and monitor specific initialization and configuration. The generic CPU
4| dependent initialization has been performed before this routine is invoked.
5+--------------------------------------------------------------------------+
6|
7| Copyright (c) 2000 Canon Research Centre France SA.
8| Emmanuel Raguet, mailto:raguet@crf.canon.fr
9|
10|   The license and distribution terms for this file may be
11|   found in found in the file LICENSE in this distribution or at
12|   http://www.rtems.com/license/LICENSE.
13|
14+--------------------------------------------------------------------------*/
15
16#include <bsp.h>
17#include <rtems/libcsupport.h>
18#include <rtems/libio.h>
19
20#include <uart.h>
21
22/*-------------------------------------------------------------------------+
23| Global Variables
24+--------------------------------------------------------------------------*/
25volatile unsigned long *Regs = (unsigned long*)0xF0000;                 /* Chip registers */
26
27extern uint32_t         _end;         /* End of BSS. Defined in 'linkcmds'. */
28/*
29 * Size of heap if it is 0 it will be dynamically defined by memory size,
30 * otherwise the value should be changed by binary patch
31 */
32uint32_t         _heap_size = 0;
33
34/* Size of stack used during initialization. Defined in 'start.s'.  */
35extern uint32_t         _stack_size;
36
37uint32_t         rtemsFreeMemStart;
38                         /* Address of start of free memory - should be updated
39                            after creating new partitions or regions.         */
40
41/* The original BSP configuration table from the application and our copy of it
42   with some changes. */
43
44extern rtems_configuration_table  Configuration;
45       rtems_configuration_table  BSP_Configuration;
46
47rtems_cpu_table Cpu_table;                     /* CPU configuration table.    */
48char            *rtems_progname;               /* Program name - from main(). */
49
50/*-------------------------------------------------------------------------+
51| External Prototypes
52+--------------------------------------------------------------------------*/
53extern void rtems_irq_mngt_init(void);
54void bsp_libc_init( void *, uint32_t, int );
55void bsp_postdriver_hook(void);
56
57/*-------------------------------------------------------------------------+
58|         Function: bsp_pretasking_hook
59|      Description: BSP pretasking hook.  Called just before drivers are
60|                   initialized. Used to setup libc and install any BSP
61|                   extensions. NOTE: Must not use libc (to do io) from here,
62|                   since drivers are not yet initialized.
63| Global Variables: None.
64|        Arguments: None.
65|          Returns: Nothing.
66+--------------------------------------------------------------------------*/
67void bsp_pretasking_hook(void)
68{
69
70  if(_heap_size == 0)
71    {
72      _heap_size = 0x420000 - rtemsFreeMemStart;
73    }
74
75  bsp_libc_init((void *)rtemsFreeMemStart, _heap_size, 0);
76
77  rtemsFreeMemStart += _heap_size;           /* HEAP_SIZE  in KBytes */
78
79#ifdef RTEMS_DEBUG
80
81  rtems_debug_enable(RTEMS_DEBUG_ALL_MASK);
82
83#endif /* RTEMS_DEBUG */
84
85} /* bsp_pretasking_hook */
86
87/*-------------------------------------------------------------------------+
88|         Function: bsp_start
89|      Description: Called before main is invoked.
90| Global Variables: None.
91|        Arguments: None.
92|          Returns: Nothing.
93+--------------------------------------------------------------------------*/
94void bsp_start_default( void )
95{
96  rtemsFreeMemStart = (uint32_t)(&_end);  /* &_end+_stack_size;*/
97                                    /* set the value of start of free memory. */
98
99  /* If we don't have command line arguments set default program name. */
100
101  Cpu_table.pretasking_hook         = bsp_pretasking_hook; /* init libc, etc. */
102  Cpu_table.predriver_hook          = NULL;                /* use system's    */
103  Cpu_table.postdriver_hook         = bsp_postdriver_hook;
104  Cpu_table.idle_task               = NULL;
105                                          /* do not override system IDLE task */
106  Cpu_table.do_zero_of_workspace    = TRUE;
107  Cpu_table.interrupt_stack_size    = 4096;
108  Cpu_table.extra_mpci_receive_server_stack = 0;
109
110  /* Place RTEMS workspace at beginning of free memory. */
111  BSP_Configuration.work_space_start = (void *)rtemsFreeMemStart;
112
113   rtemsFreeMemStart += BSP_Configuration.work_space_size;
114
115  /*
116   * Init rtems exceptions management
117   */
118  rtems_exception_init_mngt();
119
120  /*
121   * Init rtems interrupt management
122   */
123  rtems_irq_mngt_init();
124
125  /*
126   *  The following information is very useful when debugging.
127   */
128
129#if 0
130  printk( "work_space_size = 0x%x\n", BSP_Configuration.work_space_size );
131  printk( "maximum_extensions = 0x%x\n", BSP_Configuration.maximum_extensions );
132  printk( "microseconds_per_tick = 0x%x\n",
133     BSP_Configuration.microseconds_per_tick );
134  printk( "ticks_per_timeslice = 0x%x\n",
135     BSP_Configuration.ticks_per_timeslice );
136  printk( "maximum_devices = 0x%x\n", BSP_Configuration.maximum_devices );
137  printk( "number_of_device_drivers = 0x%x\n",
138     BSP_Configuration.number_of_device_drivers );
139  printk( "Device_driver_table = 0x%x\n",
140     BSP_Configuration.Device_driver_table );
141
142  printk( "_heap_size = 0x%x\n", _heap_size );
143  /*  printk( "_stack_size = 0x%x\n", _stack_size );*/
144  printk( "rtemsFreeMemStart = 0x%x\n", rtemsFreeMemStart );
145  printk( "work_space_start = 0x%x\n", BSP_Configuration.work_space_start );
146  printk( "work_space_size = 0x%x\n", BSP_Configuration.work_space_size );
147#endif
148
149} /* bsp_start */
150
151/*
152 *  By making this a weak alias for bsp_start_default, a brave soul
153 *  can override the actual bsp_start routine used.
154 */
155
156void bsp_start (void) __attribute__ ((weak, alias("bsp_start_default")));
Note: See TracBrowser for help on using the repository browser.