diff options
Diffstat (limited to 'utils/hwstub/stub/stmp')
-rw-r--r-- | utils/hwstub/stub/stmp/crt0.S | 41 | ||||
-rw-r--r-- | utils/hwstub/stub/stmp/hwstub.lds | 73 |
2 files changed, 114 insertions, 0 deletions
diff --git a/utils/hwstub/stub/stmp/crt0.S b/utils/hwstub/stub/stmp/crt0.S new file mode 100644 index 0000000000..8b2197823e --- /dev/null +++ b/utils/hwstub/stub/stmp/crt0.S | |||
@@ -0,0 +1,41 @@ | |||
1 | .section .text,"ax",%progbits | ||
2 | .code 32 | ||
3 | .align 0x04 | ||
4 | .global start | ||
5 | start: | ||
6 | sub r7, pc, #8 /* Copy running address */ | ||
7 | msr cpsr_c, #0xd3 /* enter supervisor mode, disable IRQ/FIQ */ | ||
8 | #ifdef CONFIG_STMP | ||
9 | /* Disable MMU, disable caching and buffering; | ||
10 | * use low exception range address */ | ||
11 | mrc p15, 0, r0, c1, c0, 0 | ||
12 | ldr r1, =0x3005 | ||
13 | bic r0, r1 | ||
14 | mcr p15, 0, r0, c1, c0, 0 | ||
15 | #endif | ||
16 | ldr sp, =oc_stackend | ||
17 | /* Relocate to right address */ | ||
18 | mov r2, r7 | ||
19 | ldr r3, =_copystart | ||
20 | ldr r4, =_copyend | ||
21 | 1: | ||
22 | cmp r4, r3 | ||
23 | ldrhi r5, [r2], #4 | ||
24 | strhi r5, [r3], #4 | ||
25 | bhi 1b | ||
26 | |||
27 | mov r2, #0 | ||
28 | mcr p15, 0, r2, c7, c5, 0 @ Invalidate ICache | ||
29 | /* Jump to real location */ | ||
30 | ldr pc, =remap | ||
31 | remap: | ||
32 | /* clear bss */ | ||
33 | ldr r2, =bss_start | ||
34 | ldr r3, =bss_end | ||
35 | mov r4, #0 | ||
36 | 1: | ||
37 | cmp r3, r2 | ||
38 | strhi r4, [r2], #4 | ||
39 | bhi 1b | ||
40 | /* jump to C code */ | ||
41 | b main | ||
diff --git a/utils/hwstub/stub/stmp/hwstub.lds b/utils/hwstub/stub/stmp/hwstub.lds new file mode 100644 index 0000000000..8e3f4e68ba --- /dev/null +++ b/utils/hwstub/stub/stmp/hwstub.lds | |||
@@ -0,0 +1,73 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2012 by Amaury Pouly | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | #include "config.h" | ||
22 | |||
23 | ENTRY(start) | ||
24 | OUTPUT_FORMAT(elf32-littlearm) | ||
25 | OUTPUT_ARCH(arm) | ||
26 | STARTUP(stmp/crt0.o) | ||
27 | |||
28 | #define IRAM_END_ADDR (IRAM_ORIG + IRAM_SIZE) | ||
29 | |||
30 | MEMORY | ||
31 | { | ||
32 | OCRAM : ORIGIN = IRAM_ORIG, LENGTH = IRAM_SIZE | ||
33 | } | ||
34 | |||
35 | SECTIONS | ||
36 | { | ||
37 | .octext : | ||
38 | { | ||
39 | _copystart = .; | ||
40 | oc_codestart = .; | ||
41 | *(.text*) | ||
42 | *(.icode*) | ||
43 | *(.data*) | ||
44 | *(.rodata*) | ||
45 | _copyend = .; | ||
46 | } > OCRAM | ||
47 | |||
48 | .bss (NOLOAD) : | ||
49 | { | ||
50 | bss_start = .; | ||
51 | *(.bss) | ||
52 | bss_end = .; | ||
53 | } > OCRAM | ||
54 | |||
55 | .stack (NOLOAD) : | ||
56 | { | ||
57 | oc_codeend = .; | ||
58 | oc_stackstart = .; | ||
59 | . += STACK_SIZE; | ||
60 | oc_stackend = .; | ||
61 | oc_bufferstart = .; | ||
62 | } > OCRAM | ||
63 | |||
64 | .ocend IRAM_END_ADDR (NOLOAD) : | ||
65 | { | ||
66 | oc_bufferend = .; | ||
67 | } > OCRAM | ||
68 | |||
69 | /DISCARD/ : | ||
70 | { | ||
71 | *(.eh_frame) | ||
72 | } | ||
73 | } | ||