OSDN Git Service

2001-02-20 Joel Sherrill <joel@OARcorp.com>
[pf3gnuchains/gcc-fork.git] / gcc / config / m68hc11 / m68hc11-crt0.S
1 /* Startup code for M68HC11.
2    Copyright (C) 1999, 2000 Free Software Foundation, Inc.
3
4 This file is free software; you can redistribute it and/or modify it
5 under the terms of the GNU General Public License as published by the
6 Free Software Foundation; either version 2, or (at your option) any
7 later version.
8
9 In addition to the permissions in the GNU General Public License, the
10 Free Software Foundation gives you unlimited permission to link the
11 compiled version of this file with other programs, and to distribute
12 those programs without any restriction coming from the use of this
13 file.  (The General Public License restrictions do apply in other
14 respects; for example, they cover modification of the file, and
15 distribution when not linked into another program.)
16
17 This file is distributed in the hope that it will be useful, but
18 WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
20 General Public License for more details.
21
22 You should have received a copy of the GNU General Public License
23 along with this program; see the file COPYING.  If not, write to
24 the Free Software Foundation, 59 Temple Place - Suite 330,
25 Boston, 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 ;; 
40 ;; 
41 ;; The linker concatenate the .install* sections in the following order:
42 ;; 
43 ;; .install0    Setup the stack pointer
44 ;; .install1    Place holder for applications
45 ;; .install2    Optional installation of data section in memory
46 ;; .install3    Place holder for applications
47 ;; .install4    Invokes the main
48 ;; 
49         .sect   .install0,"ax",@progbits
50         .globl _start
51
52 _start:
53 ;;
54 ;; At this step, the stack is not initialized and interrupts are masked.
55 ;; Applications only have 64 cycles to initialize some registers.
56 ;;
57 ;; To have a generic/configurable startup, initialize the stack to
58 ;; the end of some memory region.  The _stack symbol is defined by
59 ;; the linker.
60 ;;
61         lds     #_stack
62         
63         .sect   .install2,"ax",@progbits
64 ;;
65 ;; Call a specific initialization operation.  The default is empty.
66 ;; It can be overriden by applications.  It is intended to initialize
67 ;; the 68hc11 registers.  Function prototype is:
68 ;; 
69 ;;      int __premain(void);
70 ;; 
71         jsr     __premain
72         
73 ;;
74 ;; 
75 ;;
76         .sect   .install4,"ax",@progbits
77         jsr     main
78 fatal:
79         jsr     exit
80         bra fatal
81
82 ;-----------------------------------------
83 ; end startup code
84 ;-----------------------------------------
85 ;; Force loading of data section mapping and bss clear
86         .2byte  __map_data_section
87         .2byte  __init_bss_section