diff options
Diffstat (limited to 'firmware/target/arm/tms320dm320/crt0.S')
-rw-r--r-- | firmware/target/arm/tms320dm320/crt0.S | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/firmware/target/arm/tms320dm320/crt0.S b/firmware/target/arm/tms320dm320/crt0.S index 0119ade3c7..d53cff2b63 100644 --- a/firmware/target/arm/tms320dm320/crt0.S +++ b/firmware/target/arm/tms320dm320/crt0.S | |||
@@ -169,23 +169,25 @@ _start: | |||
169 | msr cpsr_c, #0xd2 /* Go into irq state */ | 169 | msr cpsr_c, #0xd2 /* Go into irq state */ |
170 | ldr sp, =_irq_stack_start /* set the irq stack pointer */ | 170 | ldr sp, =_irq_stack_start /* set the irq stack pointer */ |
171 | 171 | ||
172 | /* This should not be needed, but set the stack location for abort and | 172 | /* SVC, ABT, UNDEF share irq stack */ |
173 | * undefined to at least a known stack location (IRQ) | 173 | msr cpsr_c, #0xd3 /* Go into svc state */ |
174 | */ | 174 | ldr sp, =_irq_stack_start /* set svc stack pointer */ |
175 | msr cpsr_c, #0xd7 /* Go into abort state */ | 175 | |
176 | msr cpsr_c, #0xd7 /* Go into abort state */ | ||
176 | ldr sp, =_irq_stack_start /* set the stack pointer */ | 177 | ldr sp, =_irq_stack_start /* set the stack pointer */ |
177 | 178 | ||
178 | msr cpsr_c, #0xdb /* Go into undefined state */ | 179 | msr cpsr_c, #0xdb /* Go into undefined state */ |
179 | ldr sp, =_irq_stack_start /* set the stack pointer */ | 180 | ldr sp, =_irq_stack_start /* set the stack pointer */ |
180 | 181 | ||
181 | /* Initialize program stack */ | 182 | /* Initialize program stack */ |
182 | msr cpsr_c, #0xd3 /* Go into supervisor state */ | 183 | msr cpsr_c, #0xdf /* Go into sys state */ |
184 | |||
183 | ldr r0, =0xDEADBEEF /* Can be taken out; left for clarity */ | 185 | ldr r0, =0xDEADBEEF /* Can be taken out; left for clarity */ |
184 | ldr r1, =_pro_stack_end /* Stack counts backwards, so end is first*/ | 186 | ldr r1, =_pro_stack_end /* Stack counts backwards, so end is first*/ |
185 | ldr r2, =_pro_stack_start | 187 | ldr r2, =_pro_stack_start |
186 | bl _init_section | 188 | bl _init_section |
187 | 189 | ||
188 | ldr sp, =_pro_stack_start /* set the supervisor stack pointer */ | 190 | ldr sp, =_pro_stack_start /* set the sys stack pointer */ |
189 | 191 | ||
190 | /* MMU initialization */ | 192 | /* MMU initialization */ |
191 | bl ttb_init | 193 | bl ttb_init |
@@ -298,6 +300,8 @@ _delay_cycles: | |||
298 | * 0: Undefined Instruction * | 300 | * 0: Undefined Instruction * |
299 | * 1: Prefetch Abort * | 301 | * 1: Prefetch Abort * |
300 | * 2: Data Abort * | 302 | * 2: Data Abort * |
303 | * 3: DIV0 * | ||
304 | * 4: SWI * | ||
301 | * The exceptions return operations are documented in section A2.6 of the * | 305 | * The exceptions return operations are documented in section A2.6 of the * |
302 | * ARM Architecture Reference Manual. * | 306 | * ARM Architecture Reference Manual. * |
303 | ******************************************************************************/ | 307 | ******************************************************************************/ |
@@ -309,11 +313,12 @@ _undefined_instruction: | |||
309 | bl UIE | 313 | bl UIE |
310 | 314 | ||
311 | /* A2.6.4: Software Interrupt exception - These should not happen in Rockbox, | 315 | /* A2.6.4: Software Interrupt exception - These should not happen in Rockbox, |
312 | * but for now leave this as a placeholder and continue with the program. | 316 | * make it illegal |
313 | * LR=PC of next instruction. | ||
314 | */ | 317 | */ |
315 | _software_interrupt: | 318 | _software_interrupt: |
316 | mov pc, lr | 319 | sub r0, lr, #4 |
320 | mov r1, #4 | ||
321 | bl UIE | ||
317 | 322 | ||
318 | /* A2.6.5 Prefetch Abort - This is also the BKPT instruction since this is a | 323 | /* A2.6.5 Prefetch Abort - This is also the BKPT instruction since this is a |
319 | * v5 target. Pass it on to UIE since it is not currently used. | 324 | * v5 target. Pass it on to UIE since it is not currently used. |