[444] | 1 | /* Startup code for M68HC11/M68HC12. |
---|
| 2 | * Copyright (C) 1999, 2000, 2001, 2002 Stephane Carrez (stcarrez@nerim.fr) |
---|
| 3 | * |
---|
| 4 | * The authors hereby grant permission to use, copy, modify, distribute, |
---|
| 5 | * and license this software and its documentation for any purpose, provided |
---|
| 6 | * that existing copyright notices are retained in all copies and that this |
---|
| 7 | * notice is included verbatim in any distributions. No written agreement, |
---|
| 8 | * license, or royalty fee is required for any of the authorized uses. |
---|
| 9 | * Modifications to this software may be copyrighted by their authors |
---|
| 10 | * and need not follow the licensing terms described here, provided that |
---|
| 11 | * the new terms are clearly indicated on the first page of each file where |
---|
| 12 | * they apply. |
---|
| 13 | */ |
---|
| 14 | |
---|
| 15 | ;----------------------------------------- |
---|
| 16 | ; startup code |
---|
| 17 | ;----------------------------------------- |
---|
| 18 | .file "crt0.s" |
---|
| 19 | |
---|
| 20 | ;; |
---|
| 21 | ;; |
---|
| 22 | ;; The linker concatenate the .install* sections in the following order: |
---|
| 23 | ;; |
---|
| 24 | ;; .install0 Setup the stack pointer |
---|
| 25 | ;; .install1 Place holder for applications |
---|
| 26 | ;; .install2 Optional installation of data section in memory |
---|
| 27 | ;; .install3 Place holder for applications |
---|
| 28 | ;; .install4 Invokes the main |
---|
| 29 | ;; |
---|
| 30 | .sect .install0,"ax",@progbits |
---|
| 31 | .globl _start |
---|
| 32 | |
---|
| 33 | _start: |
---|
| 34 | ;; |
---|
| 35 | ;; At this step, the stack is not initialized and interrupts are masked. |
---|
| 36 | ;; Applications only have 64 cycles to initialize some registers. |
---|
| 37 | ;; |
---|
| 38 | ;; To have a generic/configurable startup, initialize the stack to |
---|
| 39 | ;; the end of some memory region. The _stack symbol is defined by |
---|
| 40 | ;; the linker. |
---|
| 41 | ;; |
---|
| 42 | lds #_stack |
---|
| 43 | |
---|
| 44 | .sect .install2,"ax",@progbits |
---|
| 45 | ;; |
---|
| 46 | ;; Call a specific initialization operation. The default is empty. |
---|
| 47 | ;; It can be overriden by applications. It is intended to initialize |
---|
| 48 | ;; the 68hc11 registers. Function prototype is: |
---|
| 49 | ;; |
---|
| 50 | ;; int __premain(void); |
---|
| 51 | ;; |
---|
| 52 | jsr __premain |
---|
| 53 | |
---|
| 54 | ;; |
---|
| 55 | ;; |
---|
| 56 | ;; |
---|
| 57 | .sect .install4,"ax",@progbits |
---|
| 58 | jsr main |
---|
| 59 | fatal: |
---|
| 60 | jsr exit |
---|
| 61 | bra fatal |
---|
| 62 | |
---|
| 63 | ;----------------------------------------- |
---|
| 64 | ; end startup code |
---|
| 65 | ;----------------------------------------- |
---|
| 66 | ;; Force loading of data section mapping and bss clear |
---|
| 67 | .globl __map_data_section |
---|
| 68 | .globl __init_bss_section |
---|
| 69 | |
---|