diff options
Diffstat (limited to 'firmware/target/arm/crt0-pp502x-bl-usb.S')
-rw-r--r-- | firmware/target/arm/crt0-pp502x-bl-usb.S | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/firmware/target/arm/crt0-pp502x-bl-usb.S b/firmware/target/arm/crt0-pp502x-bl-usb.S index c8b7fb4ee8..7b0489b2a8 100644 --- a/firmware/target/arm/crt0-pp502x-bl-usb.S +++ b/firmware/target/arm/crt0-pp502x-bl-usb.S | |||
@@ -239,26 +239,28 @@ start_stub_end: | |||
239 | strhi r0, [r1], #4 | 239 | strhi r0, [r1], #4 |
240 | bhi 1b | 240 | bhi 1b |
241 | 241 | ||
242 | /* Set up some stack and munge it with 0xdeadbeef */ | ||
243 | ldr r0, =0xdeadbeef | ||
244 | ldr r1, =stackbegin | ||
245 | ldr sp, =stackend | ||
246 | 1: | ||
247 | cmp sp, r1 | ||
248 | strhi r0, [r1], #4 | ||
249 | bhi 1b | ||
250 | |||
251 | /* Set up stack for IRQ mode */ | 242 | /* Set up stack for IRQ mode */ |
252 | msr cpsr_c, #0xd2 /* IRQ/FIQ disabled */ | 243 | msr cpsr_c, #0xd2 /* IRQ/FIQ disabled */ |
253 | ldr sp, =irq_stack | 244 | ldr sp, =irq_stack |
254 | /* Let abort and undefined modes use IRQ stack */ | 245 | /* Let svc, abort and undefined modes use irq stack */ |
246 | msr cpsr_c, #0xd3 | ||
247 | ldr sp, =irq_stack | ||
255 | msr cpsr_c, #0xd7 /* IRQ/FIQ disabled */ | 248 | msr cpsr_c, #0xd7 /* IRQ/FIQ disabled */ |
256 | ldr sp, =irq_stack | 249 | ldr sp, =irq_stack |
257 | msr cpsr_c, #0xdb /* IRQ/FIQ disabled */ | 250 | msr cpsr_c, #0xdb /* IRQ/FIQ disabled */ |
258 | ldr sp, =irq_stack | 251 | ldr sp, =irq_stack |
259 | 252 | ||
260 | /* Switch back to supervisor mode */ | 253 | /* Switch back to sys mode */ |
261 | msr cpsr_c, #0xd3 | 254 | msr cpsr_c, #0xdf |
255 | |||
256 | /* Set up some stack and munge it with 0xdeadbeef */ | ||
257 | ldr r0, =0xdeadbeef | ||
258 | ldr r1, =stackbegin | ||
259 | ldr sp, =stackend | ||
260 | 1: | ||
261 | cmp sp, r1 | ||
262 | strhi r0, [r1], #4 | ||
263 | bhi 1b | ||
262 | 264 | ||
263 | /* execute the loader - this will load an image to 0x10000000 */ | 265 | /* execute the loader - this will load an image to 0x10000000 */ |
264 | ldr r0, =main | 266 | ldr r0, =main |
@@ -335,12 +337,15 @@ undef_instr_handler: | |||
335 | mov r1, #0 | 337 | mov r1, #0 |
336 | b UIE | 338 | b UIE |
337 | 339 | ||
338 | /* We run supervisor mode most of the time, and should never see a software | 340 | /* We run sys mode most of the time, and should never see a software |
339 | exception being thrown. Perhaps make it illegal and call UIE? | 341 | exception being thrown. Make it illegal and call UIE. |
340 | */ | 342 | */ |
341 | software_int_handler: | 343 | software_int_handler: |
342 | reserved_handler: | 344 | reserved_handler: |
343 | movs pc, lr | 345 | sub r0, lr, #4 |
346 | mov r1, #4 | ||
347 | b UIE | ||
348 | |||
344 | prefetch_abort_handler: | 349 | prefetch_abort_handler: |
345 | sub r0, lr, #4 | 350 | sub r0, lr, #4 |
346 | mov r1, #1 | 351 | mov r1, #1 |