source: rtems/c/src/lib/libbsp/mips/csb350/startup/bspstart.c @ 4130d8e2

4.104.114.95
Last change on this file since 4130d8e2 was 4130d8e2, checked in by Joel Sherrill <joel.sherrill@…>, on 12/11/07 at 15:50:25

2007-12-11 Joel Sherrill <joel.sherrill@…>

  • include/bsp.h, startup/bspstart.c: Eliminate copies of the Configuration Table. Use the RTEMS provided accessor macros to obtain configuration fields.
  • Property mode set to 100644
File size: 2.7 KB
Line 
1/*
2 *  This routine 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 this routine is invoked.
6 *
7 *  COPYRIGHT (c) 1989-2000.
8 *  On-Line Applications Research Corporation (OAR).
9 *
10 *  The license and distribution terms for this file may be
11 *  found in the file LICENSE in this distribution or at
12 *  http://www.rtems.com/license/LICENSE.
13 *
14 *  $Id$
15 */
16
17#include <string.h>
18
19#include <bsp.h>
20#include <libcpu/au1x00.h>
21#include <rtems/libio.h>
22#include <rtems/libcsupport.h>
23
24/*
25 *  The original table from the application and our copy of it with
26 *  some changes.
27 */
28
29extern void            *_sdram_size;
30extern void            *_sdram_base;
31extern void            *_bss_free_start;
32
33unsigned long           free_mem_start;
34unsigned long           free_mem_end;
35
36au1x00_uart_t *uart0 = (au1x00_uart_t *)AU1X00_UART0_ADDR;
37au1x00_uart_t *uart3 = (au1x00_uart_t *)AU1X00_UART3_ADDR;
38
39/*
40 *  Use the shared implementations of the following routines
41 */
42 
43void bsp_postdriver_hook(void);
44void bsp_libc_init( void *, uint32_t, int );
45
46/*
47 *  Function:   bsp_pretasking_hook
48 *  Created:    95/03/10
49 *
50 *  Description:
51 *      BSP pretasking hook.  Called just before drivers are initialized.
52 *      Used to setup libc and install any BSP extensions.
53 *
54 *  NOTES:
55 *      Must not use libc (to do io) from here, since drivers are
56 *      not yet initialized.
57 *
58 */
59 
60void bsp_pretasking_hook(void)
61{
62    uint32_t heap_start;
63    uint32_t heap_size;
64
65    /*
66     * Set up the heap.
67     */
68    heap_start =  free_mem_start;
69    heap_size = free_mem_end - free_mem_start;
70
71        /* call rtems lib init - malloc stuff */
72    bsp_libc_init((void *)heap_start, heap_size, 0);
73
74#ifdef RTEMS_DEBUG
75    rtems_debug_enable( RTEMS_DEBUG_ALL_MASK );
76#endif
77
78}
79 
80/*
81 *  bsp_start
82 *
83 *  This routine does the bulk of the system initialization.
84 */
85
86void bsp_start( void )
87{
88  extern void mips_install_isr_entries(void);
89  unsigned int compare = 0;
90
91  /* Place RTEMS workspace at beginning of free memory. */
92  Configuration.work_space_start = (void *)&_bss_free_start;
93 
94  free_mem_start = ((uint32_t)&_bss_free_start +
95                    rtems_configuration_get_work_space_size());
96 
97  free_mem_end = ((uint32_t)&_sdram_base + (uint32_t)&_sdram_size);
98 
99  mips_set_sr( 0x7f00 );  /* all interrupts unmasked but globally off */
100                          /* depend on the IRC to take care of things */
101  asm volatile ("mtc0 %0, $11\n" :: "r" (compare));
102  mips_install_isr_entries();
103}
104
105
106/* These replace the ones in newlib. I'm not sure why the newlib ones
107 * don't work.
108 */
109void _init(void)
110{
111}
112
113void _fini(void)
114{
115}
Note: See TracBrowser for help on using the repository browser.