1/* Startup code for M68HC11. 2 Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc. 3 4This file is free software; you can redistribute it and/or modify it 5under the terms of the GNU General Public License as published by the 6Free Software Foundation; either version 2, or (at your option) any 7later version. 8 9In addition to the permissions in the GNU General Public License, the 10Free Software Foundation gives you unlimited permission to link the 11compiled version of this file with other programs, and to distribute 12those programs without any restriction coming from the use of this 13file. (The General Public License restrictions do apply in other 14respects; for example, they cover modification of the file, and 15distribution when not linked into another program.) 16 17This file is distributed in the hope that it will be useful, but 18WITHOUT ANY WARRANTY; without even the implied warranty of 19MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 20General Public License for more details. 21 22You should have received a copy of the GNU General Public License 23along with this program; see the file COPYING. If not, write to 24the Free Software Foundation, 59 Temple Place - Suite 330, 25Boston, MA 02111-1307, USA. */ 26 27/* As a special exception, if you link this library with other files, 28 some of which are compiled with GCC, to produce an executable, 29 this library does not by itself cause the resulting executable 30 to be covered by the GNU General Public License. 31 This exception does not however invalidate any other reasons why 32 the executable file might be covered by the GNU General Public License. */ 33 34;----------------------------------------- 35; startup code 36;----------------------------------------- 37 .file "crt0.s" 38 39#ifdef __HAVE_SHORT_INT__ 40 .mode mshort 41#else 42 .mode mlong 43#endif 44 45#if defined(__USE_RTC__) && defined(mc68hc12) 46 .macro jsr name 47 call \name 48 .endm 49#endif 50;; 51;; 52;; The linker concatenate the .install* sections in the following order: 53;; 54;; .install0 Setup the stack pointer 55;; .install1 Place holder for applications 56;; .install2 Optional installation of data section in memory 57;; .install3 Place holder for applications 58;; .install4 Invokes the main 59;; 60 .sect .install0,"ax",@progbits 61 .globl _start 62 63_start: 64;; 65;; At this step, the stack is not initialized and interrupts are masked. 66;; Applications only have 64 cycles to initialize some registers. 67;; 68;; To have a generic/configurable startup, initialize the stack to 69;; the end of some memory region. The _stack symbol is defined by 70;; the linker. 71;; 72 lds #_stack 73 74 .sect .install2,"ax",@progbits 75;; 76;; Call a specific initialization operation. The default is empty. 77;; It can be overridden by applications. It is intended to initialize 78;; the 68hc11 registers. Function prototype is: 79;; 80;; int __premain(void); 81;; 82 jsr __premain 83 84;; 85;; 86;; 87 .sect .install4,"ax",@progbits 88 jsr main 89fatal: 90 jsr exit 91 bra fatal 92 93;----------------------------------------- 94; end startup code 95;----------------------------------------- 96;; Force loading of data section mapping and bss clear 97 .2byte __map_data_section 98 .2byte __init_bss_section 99