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

4.104.114.84.95
Last change on this file since 4564566 was 4564566, checked in by Joel Sherrill <joel.sherrill@…>, on 09/13/00 at 13:45:05

2000-09-13 Emmanuel Raguet <raguet@…>

  • vegaplus BSP submitted by Emmanuel Raguet <raguet@…> and Eric Valette <valette@…>.
  • vegaplus/bsp_specs, configure.in, console/Makefile.am, include/Makefile.am, include/bsp.h, include/registers.h, irq/Makefile.am, irq/bsp_irq_asm.S, irq/bsp_irq_init.c, irq/irq.c, irq/irq.h, start/Makefile.am, start/start.S, startup/Makefile.am, startup/bspstart.c, startup/exit.c, startup/linkcmds, wrapup/Makefile.am: New files.
  • Property mode set to 100644
File size: 5.8 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.OARcorp.com/rtems/license.html.
13|
14+--------------------------------------------------------------------------*/
15
16
17#include <bsp.h>
18#include <uart.h>
19#include <libcsupport.h>
20#include <rtems/libio.h>
21
22/*-------------------------------------------------------------------------+
23| Global Variables
24+--------------------------------------------------------------------------*/
25volatile unsigned long *Regs = (unsigned long*)0xF0000;                 /* Chip registers */
26
27extern rtems_unsigned32 _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 */
32rtems_unsigned32 _heap_size = 0;
33
34/* Size of stack used during initialization. Defined in 'start.s'.  */
35extern rtems_unsigned32 _stack_size;
36
37rtems_unsigned32 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 *, unsigned32, 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
80#ifdef RTEMS_DEBUG
81
82  rtems_debug_enable(RTEMS_DEBUG_ALL_MASK);
83
84#endif /* RTEMS_DEBUG */
85
86} /* bsp_pretasking_hook */
87 
88
89/*-------------------------------------------------------------------------+
90|         Function: bsp_start
91|      Description: Called before main is invoked.
92| Global Variables: None.
93|        Arguments: None.
94|          Returns: Nothing.
95+--------------------------------------------------------------------------*/
96void bsp_start_default( void )
97{
98  rtemsFreeMemStart = (rtems_unsigned32)(&_end);  /* &_end+_stack_size;*/
99                                    /* set the value of start of free memory. */
100
101  /* If we don't have command line arguments set default program name. */
102
103  Cpu_table.pretasking_hook         = bsp_pretasking_hook; /* init libc, etc. */
104  Cpu_table.predriver_hook          = NULL;                /* use system's    */
105  Cpu_table.postdriver_hook         = bsp_postdriver_hook;
106  Cpu_table.idle_task               = NULL;
107                                          /* do not override system IDLE task */
108  Cpu_table.do_zero_of_workspace    = TRUE;
109  Cpu_table.interrupt_stack_size    = 4096;
110  Cpu_table.extra_mpci_receive_server_stack = 0;
111
112  /* Place RTEMS workspace at beginning of free memory. */
113  BSP_Configuration.work_space_start = (void *)rtemsFreeMemStart;
114 
115   rtemsFreeMemStart += BSP_Configuration.work_space_size;
116
117  console_reserve_resources(&BSP_Configuration);
118
119  /*
120   * Init rtems exceptions management
121   */
122  rtems_exception_init_mngt();
123
124  /*
125   * Init rtems interrupt management
126   */
127  rtems_irq_mngt_init();
128
129  /*
130   *  The following information is very useful when debugging.
131   */
132
133#if 0
134  printk( "work_space_size = 0x%x\n", BSP_Configuration.work_space_size );
135  printk( "maximum_extensions = 0x%x\n", BSP_Configuration.maximum_extensions );
136  printk( "microseconds_per_tick = 0x%x\n",
137     BSP_Configuration.microseconds_per_tick );
138  printk( "ticks_per_timeslice = 0x%x\n",
139     BSP_Configuration.ticks_per_timeslice );
140  printk( "maximum_devices = 0x%x\n", BSP_Configuration.maximum_devices );
141  printk( "number_of_device_drivers = 0x%x\n",
142     BSP_Configuration.number_of_device_drivers );
143  printk( "Device_driver_table = 0x%x\n",
144     BSP_Configuration.Device_driver_table );
145
146  printk( "_heap_size = 0x%x\n", _heap_size );
147  /*  printk( "_stack_size = 0x%x\n", _stack_size );*/
148  printk( "rtemsFreeMemStart = 0x%x\n", rtemsFreeMemStart );
149  printk( "work_space_start = 0x%x\n", BSP_Configuration.work_space_start );
150  printk( "work_space_size = 0x%x\n", BSP_Configuration.work_space_size );
151#endif
152
153} /* bsp_start */
154
155/*
156 *  By making this a weak alias for bsp_start_default, a brave soul
157 *  can override the actual bsp_start routine used.
158 */
159
160void bsp_start (void) __attribute__ ((weak, alias("bsp_start_default")));
Note: See TracBrowser for help on using the repository browser.