FreeCalypso > hg > freecalypso-tools
annotate target-utils/compalstage/compalstage.S @ 132:5380872923a6
fc-tmsh: beginning of l1tm response handling
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 19 Feb 2017 20:53:41 +0000 |
parents | 21eec7569eb8 |
children |
rev | line source |
---|---|
0
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 .text |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 .org 0 |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 #if THUMB_ENTRY |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 .code 16 |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 bx pc |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 nop |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 #endif |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 .code 32 |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 /* delay loop like OsmocomBB does */ |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 mov r1, #0xa0000 |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 1: subs r1, r1, #1 |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 bne 1b |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 /* enable the Calypso boot ROM */ |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 ldr r1, reg_addr |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 mov r2, #0x0100 |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 strh r2, [r1] |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 /* jump to it! */ |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 mov pc, #0 |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 reg_addr: |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 .word 0xFFFFFB10 |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 #if PAD_TO_1003 |
11
21eec7569eb8
loadtools support for C139/140 target: -c 1004 compalstage variant
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
25 /* |
21eec7569eb8
loadtools support for C139/140 target: -c 1004 compalstage variant
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
26 * The older and most familiar versions of C139/140 boot code expect the |
21eec7569eb8
loadtools support for C139/140 target: -c 1004 compalstage variant
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
27 * signature bytes to be "1003" or greater, but a recently encountered |
21eec7569eb8
loadtools support for C139/140 target: -c 1004 compalstage variant
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
28 * newer version expects them to be "1004" or greater instead. As the |
21eec7569eb8
loadtools support for C139/140 target: -c 1004 compalstage variant
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
29 * actual comparison check in all currently known boot code versions is |
21eec7569eb8
loadtools support for C139/140 target: -c 1004 compalstage variant
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
30 * an inequality (the signature bytes in the downloaded image need to be |
21eec7569eb8
loadtools support for C139/140 target: -c 1004 compalstage variant
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
31 * greater than or equal to the hard-coded reference values), always |
21eec7569eb8
loadtools support for C139/140 target: -c 1004 compalstage variant
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
32 * putting "1004" in our compalstage image instead of "1003" should satisfy |
21eec7569eb8
loadtools support for C139/140 target: -c 1004 compalstage variant
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
33 * all existing C1xx boot code versions, or at least all currently known |
21eec7569eb8
loadtools support for C139/140 target: -c 1004 compalstage variant
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
34 * ones. However, having an image named compalstage-1003.bin with the |
21eec7569eb8
loadtools support for C139/140 target: -c 1004 compalstage variant
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
35 * corresponding -c 1003 loadtools option that is actually "1004" inside |
21eec7569eb8
loadtools support for C139/140 target: -c 1004 compalstage variant
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
36 * feels a little "wrong" in some sense, while getting rid of the -c 1003 |
21eec7569eb8
loadtools support for C139/140 target: -c 1004 compalstage variant
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
37 * option would break old user instructions, hence let's go ahead and do the |
21eec7569eb8
loadtools support for C139/140 target: -c 1004 compalstage variant
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
38 * silly exercise of building both "1003" and "1004" versions. |
21eec7569eb8
loadtools support for C139/140 target: -c 1004 compalstage variant
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
39 */ |
0
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
40 .org 0x3be0 |
11
21eec7569eb8
loadtools support for C139/140 target: -c 1004 compalstage variant
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
41 #if MAGIC_1004 |
21eec7569eb8
loadtools support for C139/140 target: -c 1004 compalstage variant
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
42 .ascii "1004" |
21eec7569eb8
loadtools support for C139/140 target: -c 1004 compalstage variant
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
43 #else |
0
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
44 .ascii "1003" |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
45 #endif |
11
21eec7569eb8
loadtools support for C139/140 target: -c 1004 compalstage variant
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
46 #endif |