source: arduino-1-6-7/trunk/fuentes/arduino-ide-amd64/hardware/arduino/avr/firmwares/wifishield/wifi_dnld/src/SOFTWARE_FRAMEWORK/UTILS/STARTUP_FILES/GCC/crt0.x @ 4837

Last change on this file since 4837 was 4837, checked in by daduve, 2 years ago

Adding new version

File size: 3.7 KB
RevLine 
[4837]1/* This file is part of the ATMEL AVR-UC3-SoftwareFramework-1.7.0 Release */
2
3/*This file is prepared for Doxygen automatic documentation generation.*/
4/*! \file *********************************************************************
5 *
6 * \brief AVR32UC C runtime startup file.
7 *
8 * This file has been built from the Newlib crt0.S.
9 *
10 * - Compiler:           GNU GCC for AVR32
11 * - Supported devices:  All AVR32UC devices can be used.
12 *
13 * \author               Atmel Corporation: http://www.atmel.com \n
14 *                       Support and FAQ: http://support.atmel.no/
15 *
16 ******************************************************************************/
17
18/* Copyright (c) 2009 Atmel Corporation. All rights reserved.
19 *
20 * Redistribution and use in source and binary forms, with or without
21 * modification, are permitted provided that the following conditions are met:
22 *
23 * 1. Redistributions of source code must retain the above copyright notice, this
24 * list of conditions and the following disclaimer.
25 *
26 * 2. Redistributions in binary form must reproduce the above copyright notice,
27 * this list of conditions and the following disclaimer in the documentation
28 * and/or other materials provided with the distribution.
29 *
30 * 3. The name of Atmel may not be used to endorse or promote products derived
31 * from this software without specific prior written permission.
32 *
33 * 4. This software may only be redistributed and used in connection with an Atmel
34 * AVR product.
35 *
36 * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
37 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
38 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
39 * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
40 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
41 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
42 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
43 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
44 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
45 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
46 *
47 */
48
49#include <avr32/io.h>
50
51
52//! @{
53//! \verbatim
54
55
56  // This must be linked @ 0x80000000 if it is to be run upon reset.
57  .section  .reset, "ax", @progbits
58
59
60  .global _start
61  .type _start, @function
62_start:
63  // Jump to the C runtime startup routine.
64  lda.w   pc, _stext
65
66
67  // _stext is placed outside the .reset section so that the program entry point
68  // can be changed without affecting the C runtime startup.
69  .section  .text._stext, "ax", @progbits
70
71
72  .global _stext
73  .type _stext, @function
74_stext:
75  // Set initial stack pointer.
76  lda.w   sp, _estack
77
78  // Set up EVBA so interrupts can be enabled.
79  lda.w   r0, _evba
80  mtsr    AVR32_EVBA, r0
81
82  // Enable the exception processing.
83  csrf    AVR32_SR_EM_OFFSET
84
85  // Load initialized data having a global lifetime from the data LMA.
86  lda.w   r0, _data
87  lda.w   r1, _edata
88  cp      r0, r1
89  brhs    idata_load_loop_end
90  lda.w   r2, _data_lma
91idata_load_loop:
92  ld.d    r4, r2++
93  st.d    r0++, r4
94  cp      r0, r1
95  brlo    idata_load_loop
96idata_load_loop_end:
97
98  // Clear uninitialized data having a global lifetime in the blank static storage section.
99  lda.w   r0, __bss_start
100  lda.w   r1, _end
101  cp      r0, r1
102  brhs    udata_clear_loop_end
103  mov     r2, 0
104  mov     r3, 0
105udata_clear_loop:
106  st.d    r0++, r2
107  cp      r0, r1
108  brlo    udata_clear_loop
109udata_clear_loop_end:
110
111#ifdef CONFIG_FRAME_POINTER
112  // Safety: Set the default "return" @ to the exit routine address.
113  lda.w   lr, exit
114#endif
115
116  // Start the show.
117  lda.w   pc, main
118
119
120//! \endverbatim
121//! @}
Note: See TracBrowser for help on using the repository browser.