source: rtems/c/src/lib/libbsp/arm/arm_bare_bsp/startup/bspstart.c @ 6617845

4.104.114.84.95
Last change on this file since 6617845 was 2d354ea6, checked in by Joel Sherrill <joel.sherrill@…>, on 07/27/00 at 06:17:44

Minor problems addressed with the merger and with the arm_bare_bsp.
That BSP now has a stub clock driver so the tests can link even
if they won't execute. A handful of Makefiles had to be updated
and we had to account for printk.c being a shared file now.

  • 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+--------------------------------------------------------------------------*/
25
26/*
27 * must be initialized with the right address
28 */
29volatile unsigned long *Regs = (unsigned long*)0xdeadbeef; /* Chip registers */
30
31extern rtems_unsigned32 _end;         /* End of BSS. Defined in 'linkcmds'. */
32/*
33 * Size of heap if it is 0 it will be dynamically defined by memory size,
34 * otherwise the value should be changed by binary patch
35 */
36rtems_unsigned32 _heap_size = 0;
37
38/* Size of stack used during initialization. Defined in 'start.s'.  */
39extern rtems_unsigned32 _stack_size;
40
41rtems_unsigned32 rtemsFreeMemStart;
42                         /* Address of start of free memory - should be updated
43                            after creating new partitions or regions.         */
44
45/* The original BSP configuration table from the application and our copy of it
46   with some changes. */
47
48extern rtems_configuration_table  Configuration;
49       rtems_configuration_table  BSP_Configuration;
50
51rtems_cpu_table Cpu_table;                     /* CPU configuration table.    */
52char            *rtems_progname;               /* Program name - from main(). */
53
54/*-------------------------------------------------------------------------+
55| External Prototypes
56+--------------------------------------------------------------------------*/
57extern void rtems_irq_mngt_init(void);
58void bsp_libc_init( void *, unsigned32, int );
59void bsp_postdriver_hook(void);
60
61/*-------------------------------------------------------------------------+
62|         Function: bsp_pretasking_hook
63|      Description: BSP pretasking hook.  Called just before drivers are
64|                   initialized. Used to setup libc and install any BSP
65|                   extensions. NOTE: Must not use libc (to do io) from here,
66|                   since drivers are not yet initialized.
67| Global Variables: None.
68|        Arguments: None.
69|          Returns: Nothing.
70+--------------------------------------------------------------------------*/
71void bsp_pretasking_hook(void)
72{
73
74  if(_heap_size == 0)
75    {
76      _heap_size = 0x420000 - rtemsFreeMemStart;
77    }
78       
79  bsp_libc_init((void *)rtemsFreeMemStart, _heap_size, 0);
80 
81  rtemsFreeMemStart += _heap_size;           /* HEAP_SIZE  in KBytes */
82
83
84#ifdef RTEMS_DEBUG
85
86  rtems_debug_enable(RTEMS_DEBUG_ALL_MASK);
87
88#endif /* RTEMS_DEBUG */
89
90} /* bsp_pretasking_hook */
91 
92
93/*-------------------------------------------------------------------------+
94|         Function: bsp_start
95|      Description: Called before main is invoked.
96| Global Variables: None.
97|        Arguments: None.
98|          Returns: Nothing.
99+--------------------------------------------------------------------------*/
100void bsp_start_default( void )
101{
102  rtemsFreeMemStart = (rtems_unsigned32)(&_end);  /* &_end+_stack_size;*/
103                                    /* set the value of start of free memory. */
104
105  /* If we don't have command line arguments set default program name. */
106
107  Cpu_table.pretasking_hook         = bsp_pretasking_hook; /* init libc, etc. */
108  Cpu_table.predriver_hook          = NULL;                /* use system's    */
109  Cpu_table.postdriver_hook         = bsp_postdriver_hook;
110  Cpu_table.idle_task               = NULL;
111                                          /* do not override system IDLE task */
112  Cpu_table.do_zero_of_workspace    = TRUE;
113  Cpu_table.interrupt_stack_size    = 4096;
114  Cpu_table.extra_mpci_receive_server_stack = 0;
115
116  /* Place RTEMS workspace at beginning of free memory. */
117  BSP_Configuration.work_space_start = (void *)rtemsFreeMemStart;
118 
119   rtemsFreeMemStart += BSP_Configuration.work_space_size;
120
121  /*
122   * Init rtems exceptions management
123   */
124  rtems_exception_init_mngt();
125
126  /*
127   * Init rtems interrupt management
128   */
129  rtems_irq_mngt_init();
130
131  /*
132   *  The following information is very useful when debugging.
133   */
134
135#if 0
136  printk( "work_space_size = 0x%x\n", BSP_Configuration.work_space_size );
137  printk( "maximum_extensions = 0x%x\n", BSP_Configuration.maximum_extensions );
138  printk( "microseconds_per_tick = 0x%x\n",
139     BSP_Configuration.microseconds_per_tick );
140  printk( "ticks_per_timeslice = 0x%x\n",
141     BSP_Configuration.ticks_per_timeslice );
142  printk( "maximum_devices = 0x%x\n", BSP_Configuration.maximum_devices );
143  printk( "number_of_device_drivers = 0x%x\n",
144     BSP_Configuration.number_of_device_drivers );
145  printk( "Device_driver_table = 0x%x\n",
146     BSP_Configuration.Device_driver_table );
147
148  printk( "_heap_size = 0x%x\n", _heap_size );
149  /*  printk( "_stack_size = 0x%x\n", _stack_size );*/
150  printk( "rtemsFreeMemStart = 0x%x\n", rtemsFreeMemStart );
151  printk( "work_space_start = 0x%x\n", BSP_Configuration.work_space_start );
152  printk( "work_space_size = 0x%x\n", BSP_Configuration.work_space_size );
153#endif
154
155} /* bsp_start */
156
157/*
158 *  By making this a weak alias for bsp_start_default, a brave soul
159 *  can override the actual bsp_start routine used.
160 */
161
162void bsp_start (void) __attribute__ ((weak, alias("bsp_start_default")));
Note: See TracBrowser for help on using the repository browser.