summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2002-04-24 21:46:01 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2002-04-24 21:46:01 +0000
commitd6779f8ca4430566141c30b9459015805ef0b349 (patch)
treec4294035a8ba218fbd5909dbd4eaf4e88e7bdc77
parent466d29a890f2a2a6e20e854b69d57bb48cdbd6c6 (diff)
downloadrockbox-d6779f8ca4430566141c30b9459015805ef0b349.tar.gz
rockbox-d6779f8ca4430566141c30b9459015805ef0b349.zip
First version
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@214 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/crt0.S98
1 files changed, 98 insertions, 0 deletions
diff --git a/firmware/crt0.S b/firmware/crt0.S
new file mode 100644
index 0000000000..785f405721
--- /dev/null
+++ b/firmware/crt0.S
@@ -0,0 +1,98 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2002 by Linus Nielsen Feltzing
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19 .section .text
20 .global start
21start:
22 /* We begin with some tricks. If we have built our code to be loaded
23 * via the standalone GDB stub, we will have out VBR at some other
24 * location than 0x9000000. We must copy the trap vectors for the
25 * GDB stub to our vector table.
26 * If, on the other hand, we are running standalone we will have
27 * the VBR at 0x9000000, and the copy will not do any harm.
28 */
29 mov.l vbr_k,r1
30 mov.l orig_vbr_k,r2
31
32 /* Move the serial Rx interrupt vector */
33 mov #0x69,r0
34 shll2 r0
35 mov.l @(r0,r2),r3
36 mov.l r3,@(r0,r1)
37
38 /* Move the breakpoint trap vector as well (32) */
39 mov #0x20,r0
40 shll2 r0
41 mov.l @(r0,r2),r3
42 mov.l r3,@(r0,r1)
43
44 /* Move the single step trap vector as well (127) */
45 mov #0x7f,r0
46 shll2 r0
47 mov.l @(r0,r2),r3
48 mov.l r3,@(r0,r1)
49
50 ldc r1,vbr
51
52 /* Now let's get on with the normal business */
53 mov.l stack_k,r15
54
55 /* zero out bss */
56 mov.l edata_k,r0
57 mov.l end_k,r1
58 mov #0,r2
59start_l:
60 mov.l r2,@r0
61 add #4,r0
62 cmp/ge r0,r1
63 bt start_l
64 nop
65
66 ! call the mainline
67 mov.l main_k,r0
68 jsr @r0
69 nop
70.hoo:
71 bra .hoo
72
73 .align 2
74stack_k:
75 .long _stack
76edata_k:
77 .long _edata
78end_k:
79 .long _end
80main_k:
81 .long _main
82vbr_k:
83 .long vectors
84orig_vbr_k:
85 .long 0x9000000
86
87#ifdef __ELF__
88 .section .stack,"aw"
89#else
90 .section .stack
91#endif
92
93 .section .vectors
94vectors:
95 .long start
96 .long _stack
97 .long start
98 .long _stack