OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [freertos-6.1.1/] [Demo/] [CORTEX_LM3Sxxxx_Eclipse/] [RTOSDemo/] [startup.c] - Blame information for rev 611

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 581 jeremybenn
//*****************************************************************************
2
//
3
// startup.c - Boot code for Stellaris.
4
//
5
// Copyright (c) 2005-2007 Luminary Micro, Inc.  All rights reserved.
6
// 
7
// Software License Agreement
8
// 
9
// Luminary Micro, Inc. (LMI) is supplying this software for use solely and
10
// exclusively on LMI's microcontroller products.
11
// 
12
// The software is owned by LMI and/or its suppliers, and is protected under
13
// applicable copyright laws.  All rights are reserved.  Any use in violation
14
// of the foregoing restrictions may subject the user to criminal sanctions
15
// under applicable laws, as well as to civil liability for the breach of the
16
// terms and conditions of this license.
17
// 
18
// THIS SOFTWARE IS PROVIDED "AS IS".  NO WARRANTIES, WHETHER EXPRESS, IMPLIED
19
// OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
20
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
21
// LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
22
// CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
23
// 
24
// This is part of revision 1392 of the Stellaris Peripheral Driver Library.
25
//
26
//*****************************************************************************
27
 
28
//*****************************************************************************
29
//
30
// Forward declaration of the default fault handlers.
31
//
32
//*****************************************************************************
33
void ResetISR(void);
34
static void NmiSR(void);
35
static void FaultISR(void);
36
static void IntDefaultHandler(void);
37
 
38
//*****************************************************************************
39
//
40
// The entry point for the application.
41
//
42
//*****************************************************************************
43
extern int main(void);
44
extern void xPortPendSVHandler(void);
45
extern void xPortSysTickHandler(void);
46
extern void vPortSVCHandler( void );
47
extern void Timer0IntHandler( void );
48
extern void vT2InterruptHandler( void );
49
extern void vT3InterruptHandler( void );
50
extern void vEMAC_ISR(void);
51
 
52
//*****************************************************************************
53
//
54
// Reserve space for the system stack.
55
//
56
//*****************************************************************************
57
#ifndef STACK_SIZE
58
#define STACK_SIZE                              120
59
#endif
60
static unsigned long pulStack[STACK_SIZE];
61
 
62
//*****************************************************************************
63
//
64
// The minimal vector table for a Cortex M3.  Note that the proper constructs
65
// must be placed on this to ensure that it ends up at physical address
66
// 0x0000.0000.
67
//
68
//*****************************************************************************
69
__attribute__ ((section(".isr_vector")))
70
void (* const g_pfnVectors[])(void) =
71
{
72
    (void (*)(void))((unsigned long)pulStack + sizeof(pulStack)),
73
                                            // The initial stack pointer
74
    ResetISR,                               // The reset handler
75
    NmiSR,                                  // The NMI handler
76
    FaultISR,                               // The hard fault handler
77
    IntDefaultHandler,                      // The MPU fault handler
78
    IntDefaultHandler,                      // The bus fault handler
79
    IntDefaultHandler,                      // The usage fault handler
80
    0,                                      // Reserved
81
    0,                                      // Reserved
82
    0,                                      // Reserved
83
    0,                                      // Reserved
84
    vPortSVCHandler,                                            // SVCall handler
85
    IntDefaultHandler,                      // Debug monitor handler
86
    0,                                      // Reserved
87
    xPortPendSVHandler,                     // The PendSV handler
88
    xPortSysTickHandler,                    // The SysTick handler
89
    IntDefaultHandler,                      // GPIO Port A
90
    IntDefaultHandler,                      // GPIO Port B
91
    IntDefaultHandler,                      // GPIO Port C
92
    IntDefaultHandler,                      // GPIO Port D
93
    IntDefaultHandler,                      // GPIO Port E
94
    IntDefaultHandler,                      // UART0 Rx and Tx
95
    IntDefaultHandler,                      // UART1 Rx and Tx
96
    IntDefaultHandler,                      // SSI Rx and Tx
97
    IntDefaultHandler,                      // I2C Master and Slave
98
    IntDefaultHandler,                      // PWM Fault
99
    IntDefaultHandler,                      // PWM Generator 0
100
    IntDefaultHandler,                      // PWM Generator 1
101
    IntDefaultHandler,                      // PWM Generator 2
102
    IntDefaultHandler,                      // Quadrature Encoder
103
    IntDefaultHandler,                      // ADC Sequence 0
104
    IntDefaultHandler,                      // ADC Sequence 1
105
    IntDefaultHandler,                      // ADC Sequence 2
106
    IntDefaultHandler,                      // ADC Sequence 3
107
    IntDefaultHandler,                      // Watchdog timer
108
    Timer0IntHandler,                      // Timer 0 subtimer A
109
    IntDefaultHandler,                      // Timer 0 subtimer B
110
    IntDefaultHandler,                      // Timer 1 subtimer A
111
    IntDefaultHandler,                      // Timer 1 subtimer B
112
    vT2InterruptHandler,                      // Timer 2 subtimer A
113
    IntDefaultHandler,                      // Timer 2 subtimer B
114
    IntDefaultHandler,                      // Analog Comparator 0
115
    IntDefaultHandler,                      // Analog Comparator 1
116
    IntDefaultHandler,                      // Analog Comparator 2
117
    IntDefaultHandler,                      // System Control (PLL, OSC, BO)
118
    IntDefaultHandler,                      // FLASH Control
119
    IntDefaultHandler,                      // GPIO Port F
120
    IntDefaultHandler,                      // GPIO Port G
121
    IntDefaultHandler,                      // GPIO Port H
122
    IntDefaultHandler,                      // UART2 Rx and Tx
123
    IntDefaultHandler,                      // SSI1 Rx and Tx
124
    vT3InterruptHandler,                    // Timer 3 subtimer A
125
    IntDefaultHandler,                      // Timer 3 subtimer B
126
    IntDefaultHandler,                      // I2C1 Master and Slave
127
    IntDefaultHandler,                      // Quadrature Encoder 1
128
    IntDefaultHandler,                      // CAN0
129
    IntDefaultHandler,                      // CAN1
130
    0,                                      // Reserved
131
    vEMAC_ISR,                              // Ethernet
132
    IntDefaultHandler                       // Hibernate
133
};
134
 
135
//*****************************************************************************
136
//
137
// The following are constructs created by the linker, indicating where the
138
// the "data" and "bss" segments reside in memory.  The initializers for the
139
// for the "data" segment resides immediately following the "text" segment.
140
//
141
//*****************************************************************************
142
extern unsigned long _etext;
143
extern unsigned long _data;
144
extern unsigned long _edata;
145
extern unsigned long _bss;
146
extern unsigned long _ebss;
147
 
148
//*****************************************************************************
149
//
150
// This is the code that gets called when the processor first starts execution
151
// following a reset event.  Only the absolutely necessary set is performed,
152
// after which the application supplied main() routine is called.  Any fancy
153
// actions (such as making decisions based on the reset cause register, and
154
// resetting the bits in that register) are left solely in the hands of the
155
// application.
156
//
157
//*****************************************************************************
158
void
159
ResetISR(void)
160
{
161
    unsigned long *pulSrc, *pulDest;
162
 
163
    //
164
    // Copy the data segment initializers from flash to SRAM.
165
    //
166
    pulSrc = &_etext;
167
    for(pulDest = &_data; pulDest < &_edata; )
168
    {
169
        *pulDest++ = *pulSrc++;
170
    }
171
 
172
    //
173
    // Zero fill the bss segment.
174
    //
175
    for(pulDest = &_bss; pulDest < &_ebss; )
176
    {
177
        *pulDest++ = 0;
178
    }
179
 
180
    //
181
    // Call the application's entry point.
182
    //
183
    main();
184
}
185
 
186
//*****************************************************************************
187
//
188
// This is the code that gets called when the processor receives a NMI.  This
189
// simply enters an infinite loop, preserving the system state for examination
190
// by a debugger.
191
//
192
//*****************************************************************************
193
static void
194
NmiSR(void)
195
{
196
    //
197
    // Enter an infinite loop.
198
    //
199
    while(1)
200
    {
201
    }
202
}
203
 
204
//*****************************************************************************
205
//
206
// This is the code that gets called when the processor receives a fault
207
// interrupt.  This simply enters an infinite loop, preserving the system state
208
// for examination by a debugger.
209
//
210
//*****************************************************************************
211
static void
212
FaultISR(void)
213
{
214
    //
215
    // Enter an infinite loop.
216
    //
217
    while(1)
218
    {
219
    }
220
}
221
 
222
//*****************************************************************************
223
//
224
// This is the code that gets called when the processor receives an unexpected
225
// interrupt.  This simply enters an infinite loop, preserving the system state
226
// for examination by a debugger.
227
//
228
//*****************************************************************************
229
static void
230
IntDefaultHandler(void)
231
{
232
    //
233
    // Go into an infinite loop.
234
    //
235
    while(1)
236
    {
237
    }
238
}
239
 
240
//*****************************************************************************
241
//
242
// A dummy printf function to satisfy the calls to printf from uip.  This
243
// avoids pulling in the run-time library.
244
//
245
//*****************************************************************************
246
int
247
uipprintf(const char *fmt, ...)
248
{
249
    return(0);
250
}
251
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.