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 | * bspstart.c,v 1.4.2.1 2003/09/04 18:44:49 joel Exp |
---|
15 | */ |
---|
16 | |
---|
17 | #include <string.h> |
---|
18 | |
---|
19 | #include <bsp.h> |
---|
20 | #include <rtems/libio.h> |
---|
21 | #include <rtems/libcsupport.h> |
---|
22 | |
---|
23 | #define LIBC_HEAP_SIZE (64 * 1024) |
---|
24 | |
---|
25 | extern int end; /* defined by linker */ |
---|
26 | |
---|
27 | /* |
---|
28 | * The original table from the application and our copy of it with |
---|
29 | * some changes. |
---|
30 | */ |
---|
31 | |
---|
32 | extern rtems_configuration_table Configuration; |
---|
33 | |
---|
34 | rtems_configuration_table BSP_Configuration; |
---|
35 | |
---|
36 | rtems_cpu_table Cpu_table; |
---|
37 | |
---|
38 | char *rtems_progname; |
---|
39 | |
---|
40 | /* |
---|
41 | * Use the shared implementations of the following routines |
---|
42 | */ |
---|
43 | |
---|
44 | void bsp_postdriver_hook(void); |
---|
45 | void bsp_libc_init( void *, uint32_t, int ); |
---|
46 | |
---|
47 | void init_exc_vecs(void); |
---|
48 | |
---|
49 | /* |
---|
50 | * Function: bsp_pretasking_hook |
---|
51 | * Created: 95/03/10 |
---|
52 | * |
---|
53 | * Description: |
---|
54 | * BSP pretasking hook. Called just before drivers are initialized. |
---|
55 | * Used to setup libc and install any BSP extensions. |
---|
56 | * |
---|
57 | * NOTES: |
---|
58 | * Must not use libc (to do io) from here, since drivers are |
---|
59 | * not yet initialized. |
---|
60 | * |
---|
61 | */ |
---|
62 | |
---|
63 | void bsp_pretasking_hook(void) |
---|
64 | { |
---|
65 | uint32_t heap_start; |
---|
66 | |
---|
67 | heap_start = (uint32_t) &end; |
---|
68 | if (heap_start & (CPU_ALIGNMENT-1)) |
---|
69 | heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1); |
---|
70 | |
---|
71 | bsp_libc_init((void *) heap_start, LIBC_HEAP_SIZE, 0); |
---|
72 | |
---|
73 | #ifdef RTEMS_DEBUG |
---|
74 | rtems_debug_enable( RTEMS_DEBUG_ALL_MASK ); |
---|
75 | #endif |
---|
76 | |
---|
77 | } |
---|
78 | |
---|
79 | /* |
---|
80 | * bsp_start |
---|
81 | * |
---|
82 | * This routine does the bulk of the system initialization. |
---|
83 | */ |
---|
84 | |
---|
85 | void bsp_start( void ) |
---|
86 | { |
---|
87 | extern int WorkspaceBase; |
---|
88 | extern void mips_install_isr_entries(void); |
---|
89 | |
---|
90 | Cpu_table.interrupt_stack_size = 4096; |
---|
91 | |
---|
92 | BSP_Configuration.work_space_start = |
---|
93 | (void *)((uint64_t)((&end) + LIBC_HEAP_SIZE + 0x100) & ~0x7); |
---|
94 | |
---|
95 | mips_install_isr_entries(); /* Install generic MIPS exception handler */ |
---|
96 | } |
---|
97 | |
---|