diff options
Diffstat (limited to 'firmware/target/arm/at91sam/lyre_proto1/crt0.S')
-rw-r--r-- | firmware/target/arm/at91sam/lyre_proto1/crt0.S | 36 |
1 files changed, 24 insertions, 12 deletions
diff --git a/firmware/target/arm/at91sam/lyre_proto1/crt0.S b/firmware/target/arm/at91sam/lyre_proto1/crt0.S index 0146a8409c..029c1b7aec 100644 --- a/firmware/target/arm/at91sam/lyre_proto1/crt0.S +++ b/firmware/target/arm/at91sam/lyre_proto1/crt0.S | |||
@@ -33,6 +33,8 @@ | |||
33 | #define ARM_MODE_FIQ 0x11 | 33 | #define ARM_MODE_FIQ 0x11 |
34 | #define ARM_MODE_IRQ 0x12 | 34 | #define ARM_MODE_IRQ 0x12 |
35 | #define ARM_MODE_SVC 0x13 | 35 | #define ARM_MODE_SVC 0x13 |
36 | #define ARM_MODE_UND 0x1b | ||
37 | #define ARM_MODE_SYS 0x1f | ||
36 | 38 | ||
37 | #define I_BIT 0x80 | 39 | #define I_BIT 0x80 |
38 | #define F_BIT 0x40 | 40 | #define F_BIT 0x40 |
@@ -163,6 +165,15 @@ _stack_init: | |||
163 | * r2 = IRQ_STACK_SIZE | 165 | * r2 = IRQ_STACK_SIZE |
164 | */ | 166 | */ |
165 | 167 | ||
168 | /*- Set up Interrupt Mode and set IRQ Mode Stack */ | ||
169 | msr CPSR_c, #ARM_MODE_IRQ | I_BIT | F_BIT /* Enter in Mode Interrupt | ||
170 | * and disable IRQ (Interrupt) and FIQ (Fast Interrupt) | ||
171 | */ | ||
172 | |||
173 | mov sp, r0 /* sp (Interrupt Mode Stack Pointer) = | ||
174 | * TOP_OF_MEMORY (end of IRAM 1) | ||
175 | */ | ||
176 | |||
166 | /*- Set up Abort Mode and set ABT Mode Stack */ | 177 | /*- Set up Abort Mode and set ABT Mode Stack */ |
167 | msr CPSR_c, #ARM_MODE_ABT | I_BIT | F_BIT /* Enter in Mode Abort | 178 | msr CPSR_c, #ARM_MODE_ABT | I_BIT | F_BIT /* Enter in Mode Abort |
168 | * and disable IRQ (Interrupt) and FIQ (Fast Interrupt) | 179 | * and disable IRQ (Interrupt) and FIQ (Fast Interrupt) |
@@ -172,26 +183,27 @@ _stack_init: | |||
172 | * (end of IRAM 1) | 183 | * (end of IRAM 1) |
173 | */ | 184 | */ |
174 | 185 | ||
175 | /* put r0 with value of the new address for next Stack */ | 186 | /*- Set up Abort Mode and set ABT Mode Stack */ |
176 | sub r0, r0, r1 /* r0 = r0 - r1 --> r0 = (end of IRAM 1) - | 187 | msr CPSR_c, #ARM_MODE_UND | I_BIT | F_BIT /* Enter in Mode Undefined |
177 | * (ABT_STACK_SIZE) | ||
178 | */ | ||
179 | |||
180 | /*- Set up Interrupt Mode and set IRQ Mode Stack */ | ||
181 | msr CPSR_c, #ARM_MODE_IRQ | I_BIT | F_BIT /* Enter in Mode Interrupt | ||
182 | * and disable IRQ (Interrupt) and FIQ (Fast Interrupt) | 188 | * and disable IRQ (Interrupt) and FIQ (Fast Interrupt) |
183 | */ | 189 | */ |
184 | 190 | ||
185 | mov sp, r0 /* sp (Interrupt Mode Stack Pointer) = | 191 | mov sp, r0 /* sp (ABT Mode Stack Pointer) = TOP_OF_MEMORY |
186 | * TOP_OF_MEMORY (end of IRAM 1) - (ABT_STACK_SIZE) | 192 | * (end of IRAM 1) |
187 | */ | 193 | */ |
188 | 194 | ||
195 | /*- Set up Supervisor Mode and set Supervisor Mode Stack */ | ||
196 | msr CPSR_c, #ARM_MODE_SVC | I_BIT | F_BIT | ||
197 | mov sp, r0 | ||
198 | |||
189 | sub r0, r0, r2 /* Put on r0 the new address for next | 199 | sub r0, r0, r2 /* Put on r0 the new address for next |
190 | * Stack (Supervisor Mode) | 200 | * Stack (Sys Mode) |
191 | */ | 201 | */ |
192 | 202 | ||
193 | /*- Enable interrupt & Set up Supervisor Mode and set Supervisor Mode Stack */ | 203 | /*- Set up Sys Mode and set Sys Mode Stack */ |
194 | msr CPSR_c, #ARM_MODE_SVC | F_BIT | 204 | msr CPSR_c, #ARM_MODE_SYS | F_BIT /* Enter in Sys Mode |
205 | * and enable IRQ (Interrupt) and disable FIQ (Fast Interrupt) | ||
206 | */ | ||
195 | mov sp, r0 | 207 | mov sp, r0 |
196 | 208 | ||
197 | /*----------------------------------------------------------------------------- | 209 | /*----------------------------------------------------------------------------- |