source: rtems/c/src/lib/libbsp/arm/edb7312/startup/bspstart.c @ 3d6669cc

4.104.114.84.95
Last change on this file since 3d6669cc was 3d6669cc, checked in by Joel Sherrill <joel.sherrill@…>, on 11/13/02 at 17:55:09

2002-11-13 Jay Monkman <jtm@…>

  • New BSP.
  • .cvsignore, ChangeLog?, Makefile.am, bsp_specs, configure.ac, README, times, clock/.cvsignore, clock/Makefile.am, clock/clockdrv.c, console/.cvsignore, console/Makefile.am, console/uart.c, include/.cvsignore, include/Makefile.am, include/bsp.h, include/ep7312.h, irq/.cvsignore, irq/Makefile.am, irq/bsp_irq_asm.S, irq/bsp_irq_init.c, irq/irq.c, irq/irq.h, network/Makefile.am, network/network.c, start/.cvsignore, start/Makefile.am, start/start.S, startup/.cvsignore, startup/Makefile.am, startup/bspstart.c, startup/exit.c, startup/linkcmds, timer/.cvsignore, timer/Makefile.am, timer/timer.c, wrapup/.cvsignore, wrapup/Makefile.am: New file.
  • Property mode set to 100644
File size: 7.6 KB
Line 
1/*
2 * Cirrus EP7312 Startup code
3 *
4 * Copyright (c) 2002 by Jay Monkman <jtm@smoothsmoothie.com>
5 *     
6 *  The license and distribution terms for this file may be
7 *  found in the file LICENSE in this distribution or at
8 *
9 *  http://www.OARcorp.com/rtems/license.html.
10 *
11 *
12 *  $Id$
13*/
14
15#include <bsp.h>
16#include <rtems/libcsupport.h>
17#include <rtems/libio.h>
18#include <ep7312.h>
19#include <uart.h>
20
21/*************************************************************/
22/* Macros                                                    */
23/*************************************************************/
24
25/*************************************************************/
26/* Data Structures                                           */
27/*************************************************************/
28
29/*************************************************************/
30/* Global Variables                                          */
31/*************************************************************/
32extern void            *_flash_size;
33extern void            *_flash_base;
34extern void            *_sdram_size;
35extern void            *_sdram_base;
36extern void            *_bss_free_start;
37
38unsigned long           free_mem_start;
39unsigned long           free_mem_end;
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/* Function prototypes                                       */
52/*************************************************************/
53extern void rtems_irq_mngt_init(void);
54void bsp_libc_init( void *, unsigned32, int );
55void bsp_postdriver_hook(void);
56
57/**************************************************************************/
58/*                                                                        */
59/* NAME: bps_pretasking_hook - Function to setup system before startup    */
60/*                                                                        */
61/* DESCRIPTION:                                                           */
62/*   This function is called before drivers are initialized and used      */
63/*   to setup libc and BSP extensions. It configures non cacheable        */
64/*   SDRAM, SRAM, AIM, and ADM regions and sets up the CPU's memory       */
65/*   protection unit.                                                     */
66/*                                                                        */
67/* GLOBALS USED:                                                          */
68/*   free_mem_start                                                 */
69/*   free_mem_end                                                   */
70/*                                                                        */
71/* RESTRICTIONS/LIMITATIONS:                                              */
72/*   Since this function is setting up libc, it cannot use and libc       */
73/*   functions.                                                           */
74/*                                                                        */
75/**************************************************************************/
76void bsp_pretasking_hook(void)
77{
78    unsigned32 heap_start;
79    unsigned32 heap_size;
80
81
82    /*
83     * Set up the heap. It uses all free SDRAM except that reserved
84     * for non-cached uses.
85     */
86    heap_start =  free_mem_start;
87   
88    /*   heap_size = (free_mem_end - heap_start - MEM_NOCACHE_SIZE); */
89    heap_size = 0x200000;
90
91    bsp_libc_init((void *)heap_start, heap_size, 0);
92
93#ifdef RTEMS_DEBUG
94
95  rtems_debug_enable(RTEMS_DEBUG_ALL_MASK);
96
97#endif /* RTEMS_DEBUG */
98
99} /* bsp_pretasking_hook */
100 
101
102/**************************************************************************/
103/*                                                                        */
104/* NAME: bsp_start_default - BSP initialization function                  */
105/*                                                                        */
106/* DESCRIPTION:                                                           */
107/*   This function is called before RTEMS is initialized and used         */
108/*   adjust the kernel's configuration.                                   */
109/*                                                                        */
110/*   This function also configures the CPU's memory protection unit.      */
111/*                                                                        */
112/* GLOBALS USED:                                                          */
113/*    CPU_table                                                    */
114/*    BSP_Configuration                                            */
115/*    free_mem_start                                               */
116/*    free_mem_end                                                 */
117/*    free_mem_nocache_start                                       */
118/*    _bss_free_start                                              */
119/*    mpu_region_tbl                                               */
120/*                                                                        */
121/*                                                                        */
122/*                                                                        */
123/*                                                                        */
124/* RESTRICTIONS/LIMITATIONS:                                              */
125/*   Since RTEMS is not configured, no RTEMS functions can be called.     */
126/*                                                                        */
127/**************************************************************************/
128void bsp_start_default( void )
129{
130    /* disable interrupts */
131    *EP7312_INTMR1 = 0;
132    *EP7312_INTMR2 = 0;
133    Cpu_table.pretasking_hook        = bsp_pretasking_hook;
134    Cpu_table.postdriver_hook        = bsp_postdriver_hook;
135    Cpu_table.do_zero_of_workspace   = TRUE;
136   
137    /* Place RTEMS workspace at beginning of free memory. */
138    BSP_Configuration.work_space_start = (void *)&_bss_free_start;
139   
140    free_mem_start = ((unsigned32)&_bss_free_start +
141                      BSP_Configuration.work_space_size);
142   
143    free_mem_end = ((unsigned32)&_sdram_base + (unsigned32)&_sdram_size);
144   
145    /*
146     * Init rtems exceptions management
147     */
148    rtems_exception_init_mngt();
149   
150    /*
151     * Init rtems interrupt management
152     */
153    rtems_irq_mngt_init();
154   
155   
156    /*
157     *  The following information is very useful when debugging.
158     */
159#if 0
160    printk( "work_space_size = 0x%x\n", BSP_Configuration.work_space_size );
161    printk( "maximum_extensions = 0x%x\n", BSP_Configuration.maximum_extensions );
162    printk( "microseconds_per_tick = 0x%x\n",
163            BSP_Configuration.microseconds_per_tick );
164    printk( "ticks_per_timeslice = 0x%x\n",
165            BSP_Configuration.ticks_per_timeslice );
166    printk( "maximum_devices = 0x%x\n", BSP_Configuration.maximum_devices );
167    printk( "number_of_device_drivers = 0x%x\n",
168            BSP_Configuration.number_of_device_drivers );
169    printk( "Device_driver_table = 0x%x\n",
170            BSP_Configuration.Device_driver_table );
171   
172    /*  printk( "_stack_size = 0x%x\n", _stack_size );*/
173    printk( "work_space_start = 0x%x\n", BSP_Configuration.work_space_start );
174    printk( "work_space_size = 0x%x\n", BSP_Configuration.work_space_size );
175#endif
176} /* bsp_start */
177
178
179
180
181/*
182 *  By making this a weak alias for bsp_start_default, a brave soul
183 *  can override the actual bsp_start routine used.
184 */
185
186void bsp_start (void) __attribute__ ((weak, alias("bsp_start_default")));
Note: See TracBrowser for help on using the repository browser.