comparison gcc/config/m68hc11/m68hc11-crt0.S @ 0:a06113de4d67

first commit
author kent <kent@cr.ie.u-ryukyu.ac.jp>
date Fri, 17 Jul 2009 14:47:48 +0900
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:a06113de4d67
1 /* Startup code for M68HC11.
2 Copyright (C) 1999, 2000, 2002, 2008, 2009 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 3, or (at your option) any
7 later version.
8
9 This file is distributed in the hope that it will be useful, but
10 WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 General Public License for more details.
13
14 Under Section 7 of GPL version 3, you are granted additional
15 permissions described in the GCC Runtime Library Exception, version
16 3.1, as published by the Free Software Foundation.
17
18 You should have received a copy of the GNU General Public License and
19 a copy of the GCC Runtime Library Exception along with this program;
20 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
21 <http://www.gnu.org/licenses/>. */
22
23 ;-----------------------------------------
24 ; startup code
25 ;-----------------------------------------
26
27 #ifdef __HAVE_SHORT_INT__
28 .mode mshort
29 #else
30 .mode mlong
31 #endif
32
33 #if defined(__USE_RTC__) && defined(mc68hc12)
34 .macro jsr name
35 call \name
36 .endm
37 #endif
38 ;;
39 ;;
40 ;; The linker concatenate the .install* sections in the following order:
41 ;;
42 ;; .install0 Setup the stack pointer
43 ;; .install1 Place holder for applications
44 ;; .install2 Optional installation of data section in memory
45 ;; .install3 Place holder for applications
46 ;; .install4 Invokes the main
47 ;;
48 .sect .install0,"ax",@progbits
49 .globl _start
50
51 _start:
52 ;;
53 ;; At this step, the stack is not initialized and interrupts are masked.
54 ;; Applications only have 64 cycles to initialize some registers.
55 ;;
56 ;; To have a generic/configurable startup, initialize the stack to
57 ;; the end of some memory region. The _stack symbol is defined by
58 ;; the linker.
59 ;;
60 lds #_stack
61
62 .sect .install2,"ax",@progbits
63 ;;
64 ;; Call a specific initialization operation. The default is empty.
65 ;; It can be overridden by applications. It is intended to initialize
66 ;; the 68hc11 registers. Function prototype is:
67 ;;
68 ;; int __premain(void);
69 ;;
70 jsr __premain
71
72 ;;
73 ;;
74 ;;
75 .sect .install4,"ax",@progbits
76 jsr main
77 fatal:
78 jsr exit
79 bra fatal
80
81 ;-----------------------------------------
82 ; end startup code
83 ;-----------------------------------------
84 ;; Force loading of data section mapping and bss clear
85 .2byte __map_data_section
86 .2byte __init_bss_section