diff options
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/SOURCES | 4 | ||||
-rw-r--r-- | firmware/boot.lds | 24 | ||||
-rw-r--r-- | firmware/target/arm/crt0.S | 29 | ||||
-rw-r--r-- | firmware/target/arm/olympus/mrobe-500/adc-mr500.c | 2 | ||||
-rwxr-xr-x | firmware/target/arm/olympus/mrobe-500/crt0.S | 196 | ||||
-rw-r--r-- | firmware/target/arm/olympus/mrobe-500/system-mr500.c | 22 |
6 files changed, 239 insertions, 38 deletions
diff --git a/firmware/SOURCES b/firmware/SOURCES index 9dd617b5d5..454f9e1fe2 100644 --- a/firmware/SOURCES +++ b/firmware/SOURCES | |||
@@ -327,6 +327,8 @@ target/arm/crt0-pp.S | |||
327 | #endif | 327 | #endif |
328 | #elif CONFIG_CPU == PNX0101 | 328 | #elif CONFIG_CPU == PNX0101 |
329 | target/arm/pnx0101/crt0-pnx0101.S | 329 | target/arm/pnx0101/crt0-pnx0101.S |
330 | #elif defined(OLYMPUS_MROBE_500) | ||
331 | target/arm/olympus/mrobe-500/crt0.S | ||
330 | #elif defined(CPU_ARM) | 332 | #elif defined(CPU_ARM) |
331 | target/arm/crt0.S | 333 | target/arm/crt0.S |
332 | #endif /* defined(CPU_*) */ | 334 | #endif /* defined(CPU_*) */ |
@@ -790,7 +792,7 @@ target/arm/pnx0101/iriver-ifp7xx/button-ifp7xx.c | |||
790 | target/arm/pnx0101/iriver-ifp7xx/lcd-ifp7xx.c | 792 | target/arm/pnx0101/iriver-ifp7xx/lcd-ifp7xx.c |
791 | target/arm/pnx0101/iriver-ifp7xx/power-ifp7xx.c | 793 | target/arm/pnx0101/iriver-ifp7xx/power-ifp7xx.c |
792 | target/arm/pnx0101/iriver-ifp7xx/powermgmt-ifp7xx.c | 794 | target/arm/pnx0101/iriver-ifp7xx/powermgmt-ifp7xx.c |
793 | target/arm/pnx0101/iriver-ifp7xx/usb-ifp7xx.c | 795 | target/arm/pnx0101/iriver-ifp7xx/usb-ifp7xx.c |
794 | #ifndef BOOTLOADER | 796 | #ifndef BOOTLOADER |
795 | target/arm/pnx0101/pcm-pnx0101.c | 797 | target/arm/pnx0101/pcm-pnx0101.c |
796 | #endif | 798 | #endif |
diff --git a/firmware/boot.lds b/firmware/boot.lds index 999e1b0f26..e3dbb49a8c 100644 --- a/firmware/boot.lds +++ b/firmware/boot.lds | |||
@@ -9,6 +9,8 @@ OUTPUT_FORMAT(elf32-littlearm) | |||
9 | OUTPUT_ARCH(arm) | 9 | OUTPUT_ARCH(arm) |
10 | #ifdef CPU_PP | 10 | #ifdef CPU_PP |
11 | INPUT(target/arm/crt0-pp-bl.o) | 11 | INPUT(target/arm/crt0-pp-bl.o) |
12 | #elif defined(OLYMPUS_MROBE_500) | ||
13 | INPUT(target/arm/olympus/mrobe-500/crt0.o) | ||
12 | #else | 14 | #else |
13 | INPUT(target/arm/crt0.o) | 15 | INPUT(target/arm/crt0.o) |
14 | #endif | 16 | #endif |
@@ -169,14 +171,6 @@ SECTIONS | |||
169 | { | 171 | { |
170 | . = DRAMORIG + 0x1000000; | 172 | . = DRAMORIG + 0x1000000; |
171 | 173 | ||
172 | .vectors 0x0 : | ||
173 | { | ||
174 | _vectorsstart = .; | ||
175 | *(.vectors); | ||
176 | _vectorsend = .; | ||
177 | } AT> DRAM | ||
178 | _vectorscopy = LOADADDR(.vectors); | ||
179 | |||
180 | .text : { | 174 | .text : { |
181 | *(.init.text) | 175 | *(.init.text) |
182 | *(.text*) | 176 | *(.text*) |
@@ -215,12 +209,26 @@ SECTIONS | |||
215 | _stackend = .; | 209 | _stackend = .; |
216 | stackend = .; | 210 | stackend = .; |
217 | } >DRAM | 211 | } >DRAM |
212 | |||
218 | .bss : { | 213 | .bss : { |
219 | _edata = .; | 214 | _edata = .; |
220 | *(.bss*); | 215 | *(.bss*); |
221 | *(.ibss); | 216 | *(.ibss); |
222 | _end = .; | 217 | _end = .; |
223 | }>DRAM | 218 | }>DRAM |
219 | |||
220 | .vectors 0x0 : | ||
221 | { | ||
222 | loadaddress = .; | ||
223 | _loadaddress = .; | ||
224 | _vectorsstart = .; | ||
225 | KEEP(*(.resetvectors)); | ||
226 | *(.resetvectors); | ||
227 | KEEP(*(.vectors)); | ||
228 | *(.vectors); | ||
229 | _vectorsend = .; | ||
230 | } AT> DRAM | ||
231 | _vectorscopy = LOADADDR(.vectors); | ||
224 | } | 232 | } |
225 | #elif (CONFIG_CPU==IMX31L) | 233 | #elif (CONFIG_CPU==IMX31L) |
226 | { | 234 | { |
diff --git a/firmware/target/arm/crt0.S b/firmware/target/arm/crt0.S index d734f82df8..c01a4feb76 100644 --- a/firmware/target/arm/crt0.S +++ b/firmware/target/arm/crt0.S | |||
@@ -428,36 +428,11 @@ irq_stack: | |||
428 | .space 256*4 | 428 | .space 256*4 |
429 | fiq_stack: | 429 | fiq_stack: |
430 | 430 | ||
431 | #else | ||
432 | /* get the high part of our execute address */ | ||
433 | ldr r2, =0xffffff00 | ||
434 | and r4, pc, r2 | ||
435 | |||
436 | /* Copy bootloader to safe area - 0x01900000 */ | ||
437 | mov r5, #0x00900000 | ||
438 | add r5, r5, #0x01000000 | ||
439 | ldr r6, = _dataend | ||
440 | sub r0, r6, r5 /* length of loader */ | ||
441 | add r0, r4, r0 /* r0 points to start of loader */ | ||
442 | 1: | ||
443 | cmp r5, r6 | ||
444 | ldrcc r2, [r4], #4 | ||
445 | strcc r2, [r5], #4 | ||
446 | bcc 1b | ||
447 | |||
448 | ldr pc, =start_loc /* jump to the relocated start_loc: */ | ||
449 | |||
450 | start_loc: | ||
451 | bl main | ||
452 | |||
453 | #endif | 431 | #endif |
454 | 432 | ||
455 | #else /* BOOTLOADER */ | 433 | #else /* BOOTLOADER */ |
456 | |||
457 | |||
458 | |||
459 | 434 | ||
460 | /* Set up stack for IRQ mode */ | 435 | /* Set up stack for IRQ mode */ |
461 | msr cpsr_c, #0xd2 | 436 | msr cpsr_c, #0xd2 |
462 | ldr sp, =irq_stack | 437 | ldr sp, =irq_stack |
463 | /* Set up stack for FIQ mode */ | 438 | /* Set up stack for FIQ mode */ |
@@ -549,4 +524,4 @@ irq_stack: | |||
549 | .space 256*4 | 524 | .space 256*4 |
550 | fiq_stack: | 525 | fiq_stack: |
551 | 526 | ||
552 | #endif /* BOOTLOADER */ | 527 | #endif /* BOOTLOADER */ |
diff --git a/firmware/target/arm/olympus/mrobe-500/adc-mr500.c b/firmware/target/arm/olympus/mrobe-500/adc-mr500.c index 4fb2aa3677..39d92d67b0 100644 --- a/firmware/target/arm/olympus/mrobe-500/adc-mr500.c +++ b/firmware/target/arm/olympus/mrobe-500/adc-mr500.c | |||
@@ -5,7 +5,7 @@ | |||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | 5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < |
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | 6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ |
7 | * \/ \/ \/ \/ \/ | 7 | * \/ \/ \/ \/ \/ |
8 | * $Id: $ | 8 | * $Id$ |
9 | * | 9 | * |
10 | * Copyright (C) 2007 by Karl Kurbjun | 10 | * Copyright (C) 2007 by Karl Kurbjun |
11 | * | 11 | * |
diff --git a/firmware/target/arm/olympus/mrobe-500/crt0.S b/firmware/target/arm/olympus/mrobe-500/crt0.S new file mode 100755 index 0000000000..cf6d02a99c --- /dev/null +++ b/firmware/target/arm/olympus/mrobe-500/crt0.S | |||
@@ -0,0 +1,196 @@ | |||
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 | #include "config.h" | ||
20 | #include "cpu.h" | ||
21 | |||
22 | .section .init.text,"ax",%progbits | ||
23 | |||
24 | .global start | ||
25 | start: | ||
26 | msr cpsr, #0xd3 /* enter supervisor mode, disable IRQ */ | ||
27 | |||
28 | #if !defined(DEBUG) | ||
29 | /* Copy exception handler code to address 0 */ | ||
30 | ldr r2, =_vectorsstart | ||
31 | ldr r3, =_vectorsend | ||
32 | ldr r4, =_vectorscopy | ||
33 | 1: | ||
34 | cmp r3, r2 | ||
35 | ldrhi r5, [r4], #4 | ||
36 | strhi r5, [r2], #4 | ||
37 | bhi 1b | ||
38 | #else | ||
39 | ldr r1, =vectors | ||
40 | ldr r0, =irq_handler | ||
41 | str r0, [r1, #24] | ||
42 | ldr r0, =fiq_handler | ||
43 | str r0, [r1, #28] | ||
44 | #endif | ||
45 | |||
46 | #if !defined(BOOTLOADER) | ||
47 | |||
48 | #if !defined(STUB) | ||
49 | /* Zero out IBSS */ | ||
50 | ldr r2, =_iedata | ||
51 | ldr r3, =_iend | ||
52 | mov r4, #0 | ||
53 | 1: | ||
54 | cmp r3, r2 | ||
55 | strhi r4, [r2], #4 | ||
56 | bhi 1b | ||
57 | |||
58 | /* Copy the IRAM */ | ||
59 | ldr r2, =_iramcopy | ||
60 | ldr r3, =_iramstart | ||
61 | ldr r4, =_iramend | ||
62 | 1: | ||
63 | cmp r4, r3 | ||
64 | ldrhi r5, [r2], #4 | ||
65 | strhi r5, [r3], #4 | ||
66 | bhi 1b | ||
67 | #endif /* !STUB */ | ||
68 | #endif /* !BOOTLOADER */ | ||
69 | |||
70 | /* Initialise bss section to zero */ | ||
71 | ldr r2, =_edata | ||
72 | ldr r3, =_end | ||
73 | mov r4, #0 | ||
74 | 1: | ||
75 | cmp r3, r2 | ||
76 | strhi r4, [r2], #4 | ||
77 | bhi 1b | ||
78 | |||
79 | /* Set up some stack and munge it with 0xdeadbeef */ | ||
80 | ldr r3, =stackend | ||
81 | ldr r2, =stackbegin | ||
82 | ldr r4, =0xdeadbeef | ||
83 | 1: | ||
84 | cmp r3, r2 | ||
85 | strhi r4, [r2], #4 | ||
86 | bhi 1b | ||
87 | |||
88 | /* Set up stack for IRQ mode */ | ||
89 | msr cpsr_c, #0xd2 | ||
90 | ldr sp, =irq_stack | ||
91 | /* Set up stack for FIQ mode */ | ||
92 | msr cpsr_c, #0xd1 | ||
93 | ldr sp, =fiq_stack | ||
94 | |||
95 | /* Let abort and undefined modes use IRQ stack */ | ||
96 | msr cpsr_c, #0xd7 | ||
97 | ldr sp, =irq_stack | ||
98 | msr cpsr_c, #0xdb | ||
99 | ldr sp, =irq_stack | ||
100 | /* Switch to supervisor mode */ | ||
101 | msr cpsr_c, #0xd3 | ||
102 | ldr sp, =stackend | ||
103 | |||
104 | #ifdef BOOTLOADER | ||
105 | /* get the high part of our execute address */ | ||
106 | ldr r2, =0xffffff00 | ||
107 | and r4, pc, r2 | ||
108 | |||
109 | /* Copy bootloader to safe area - 0x01900000 */ | ||
110 | mov r5, #0x00900000 | ||
111 | add r5, r5, #0x01000000 | ||
112 | ldr r6, = _dataend | ||
113 | sub r0, r6, r5 /* length of loader */ | ||
114 | add r0, r4, r0 /* r0 points to start of loader */ | ||
115 | 1: | ||
116 | cmp r5, r6 | ||
117 | ldrcc r2, [r4], #4 | ||
118 | strcc r2, [r5], #4 | ||
119 | bcc 1b | ||
120 | |||
121 | ldr pc, =start_loc /* jump to the relocated start_loc: */ | ||
122 | |||
123 | #endif | ||
124 | |||
125 | start_loc: | ||
126 | bl main | ||
127 | /* main() should never return */ | ||
128 | |||
129 | /* Exception handlers. Will be copied to address 0 after memory remapping */ | ||
130 | .section .vectors,"aw" | ||
131 | ldr pc, [pc, #24] | ||
132 | ldr pc, [pc, #24] | ||
133 | ldr pc, [pc, #24] | ||
134 | ldr pc, [pc, #24] | ||
135 | ldr pc, [pc, #24] | ||
136 | ldr pc, [pc, #24] | ||
137 | ldr pc, [pc, #24] | ||
138 | ldr pc, [pc, #24] | ||
139 | |||
140 | /* Exception vectors */ | ||
141 | .global vectors | ||
142 | vectors: | ||
143 | .word start | ||
144 | .word undef_instr_handler | ||
145 | .word software_int_handler | ||
146 | .word prefetch_abort_handler | ||
147 | .word data_abort_handler | ||
148 | .word reserved_handler | ||
149 | .word irq_handler | ||
150 | .word fiq_handler | ||
151 | |||
152 | .text | ||
153 | |||
154 | #if !defined(STUB) | ||
155 | .global irq | ||
156 | .global fiq | ||
157 | .global UIE | ||
158 | #endif | ||
159 | |||
160 | /* All illegal exceptions call into UIE with exception address as first | ||
161 | parameter. This is calculated differently depending on which exception | ||
162 | we're in. Second parameter is exception number, used for a string lookup | ||
163 | in UIE. | ||
164 | */ | ||
165 | undef_instr_handler: | ||
166 | mov r0, lr | ||
167 | mov r1, #0 | ||
168 | b UIE | ||
169 | |||
170 | /* We run supervisor mode most of the time, and should never see a software | ||
171 | exception being thrown. Perhaps make it illegal and call UIE? | ||
172 | */ | ||
173 | software_int_handler: | ||
174 | reserved_handler: | ||
175 | movs pc, lr | ||
176 | |||
177 | prefetch_abort_handler: | ||
178 | sub r0, lr, #4 | ||
179 | mov r1, #1 | ||
180 | b UIE | ||
181 | |||
182 | data_abort_handler: | ||
183 | sub r0, lr, #8 | ||
184 | mov r1, #2 | ||
185 | b UIE | ||
186 | |||
187 | UIE: | ||
188 | b UIE | ||
189 | |||
190 | /* 256 words of IRQ stack */ | ||
191 | .space 256*4 | ||
192 | irq_stack: | ||
193 | |||
194 | /* 256 words of FIQ stack */ | ||
195 | .space 256*4 | ||
196 | fiq_stack: | ||
diff --git a/firmware/target/arm/olympus/mrobe-500/system-mr500.c b/firmware/target/arm/olympus/mrobe-500/system-mr500.c index c93c9f6260..1163104ad2 100644 --- a/firmware/target/arm/olympus/mrobe-500/system-mr500.c +++ b/firmware/target/arm/olympus/mrobe-500/system-mr500.c | |||
@@ -5,7 +5,7 @@ | |||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | 5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < |
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | 6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ |
7 | * \/ \/ \/ \/ \/ | 7 | * \/ \/ \/ \/ \/ |
8 | * $Id: $ | 8 | * $Id$ |
9 | * | 9 | * |
10 | * Copyright (C) 2007 by Karl Kurbjun | 10 | * Copyright (C) 2007 by Karl Kurbjun |
11 | * | 11 | * |
@@ -119,6 +119,26 @@ void irq_handler(void) | |||
119 | ); | 119 | ); |
120 | } | 120 | } |
121 | 121 | ||
122 | void fiq_handler(void) __attribute__((interrupt ("FIQ"), naked)); | ||
123 | void fiq_handler(void) | ||
124 | { | ||
125 | /* | ||
126 | * Based on: linux/arch/arm/kernel/entry-armv.S and system-meg-fx.c | ||
127 | */ | ||
128 | |||
129 | asm volatile ( | ||
130 | "sub lr, lr, #4 \r\n" | ||
131 | "stmfd sp!, {r0-r3, ip, lr} \r\n" | ||
132 | "mov r0, #0x00030000 \r\n" | ||
133 | "ldr r0, [r0, #0x518] \r\n" | ||
134 | "ldr r1, =irqvector \r\n" | ||
135 | "ldr r1, [r1, r0, lsl #2] \r\n" | ||
136 | "mov lr, pc \r\n" | ||
137 | "bx r1 \r\n" | ||
138 | "ldmfd sp!, {r0-r3, ip, pc}^ \r\n" | ||
139 | ); | ||
140 | } | ||
141 | |||
122 | void system_reboot(void) | 142 | void system_reboot(void) |
123 | { | 143 | { |
124 | 144 | ||