00001 /*This file is prepared for Doxygen automatic documentation generation.*/ 00020 /* Copyright (c) 2009 Atmel Corporation. All rights reserved. 00021 * 00022 * Redistribution and use in source and binary forms, with or without 00023 * modification, are permitted provided that the following conditions are met: 00024 * 00025 * 1. Redistributions of source code must retain the above copyright notice, this 00026 * list of conditions and the following disclaimer. 00027 * 00028 * 2. Redistributions in binary form must reproduce the above copyright notice, 00029 * this list of conditions and the following disclaimer in the documentation 00030 * and/or other materials provided with the distribution. 00031 * 00032 * 3. The name of Atmel may not be used to endorse or promote products derived 00033 * from this software without specific prior written permission. 00034 * 00035 * 4. This software may only be redistributed and used in connection with an Atmel 00036 * AVR product. 00037 * 00038 * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED 00039 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 00040 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE 00041 * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR 00042 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 00043 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00044 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 00045 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00046 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00047 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE 00048 * 00049 */ 00050 00051 #include "../CONF/conf_isp.h" 00052 00053 00056 00057 00058 // Performs efficiently a bitwise logical Exclusive-OR between the specified 00059 // register and an immediate value of up to 32 bits. The result is stored in 00060 // the destination register. 00061 .macro eor.w rd, imm 00062 .if \imm & 0x0000FFFF 00063 eorl \rd, LO(\imm) 00064 .endif 00065 .if \imm & 0xFFFF0000 00066 eorh \rd, HI(\imm) 00067 .endif 00068 .endm 00069 00070 // Moves efficiently an immediate value of up to 32 bits into a register. 00071 .macro mov.w rd, imm 00072 .if ((-(1 << (21 - 1))) <= \imm) && (\imm <= ((1 << (21 - 1)) - 1)) 00073 mov \rd, \imm 00074 #if __AVR32_UC__ >= 2 00075 .elseif !(\imm & 0x0000FFFF) 00076 movh \rd, HI(\imm) 00077 #endif 00078 .else 00079 mov \rd, LO(\imm) 00080 orh \rd, HI(\imm) 00081 .endif 00082 .endm 00083 00084 // Performs efficiently a bitwise logical OR between the specified register 00085 // and an immediate value of up to 32 bits. The result is stored in the 00086 // destination register. 00087 .macro or.w rd, imm 00088 .if \imm & 0x0000FFFF 00089 orl \rd, LO(\imm) 00090 .endif 00091 .if \imm & 0xFFFF0000 00092 orh \rd, HI(\imm) 00093 .endif 00094 .endm 00095 00096 .section .reset, "ax", @progbits 00097 00098 .balign 2 00099 00100 .global _trampoline 00101 .type _trampoline, @function 00102 _trampoline: 00103 // Workaround for AT32UC3C0512C revC - Disable WDT at startup 00104 mov.w r10, AVR32_WDT_ADDRESS 00105 ld.w r12, r10[AVR32_WDT_CTRL] 00106 orh r12, 0x5500 00107 cbr r12, 0 00108 st.w r10[AVR32_WDT_CTRL], r12 00109 mov.w r10, AVR32_WDT_ADDRESS 00110 ld.w r12, r10[AVR32_WDT_CTRL] 00111 orh r12, 0xAA00 00112 cbr r12, 0 00113 st.w r10[AVR32_WDT_CTRL], r12 00114 // Jump to program start. 00115 rjmp program_start 00116 00117 .org PROGRAM_START_OFFSET 00118 program_start: 00119 // Jump to the C runtime startup routine. 00120 lda.w pc, _stext 00121 00122