aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2010-03-26 15:16:48 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2010-03-26 15:16:48 +0000
commit63b88a2147d8cc9999c01abca346c8f0cb2641b0 (patch)
tree3c7f6bb858b05601ec0d73729c7345c3b1c66ccc
parenta6c627641ed547ca3ee968bceb2c366a2dfe263e (diff)
downloadChibiOS-63b88a2147d8cc9999c01abca346c8f0cb2641b0.tar.gz
ChibiOS-63b88a2147d8cc9999c01abca346c8f0cb2641b0.tar.bz2
ChibiOS-63b88a2147d8cc9999c01abca346c8f0cb2641b0.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1785 35acf78f-673a-0410-8e92-d51de3d6d3f4
-rw-r--r--os/ports/GCC/ARMCMx/crt0.s21
1 files changed, 16 insertions, 5 deletions
diff --git a/os/ports/GCC/ARMCMx/crt0.s b/os/ports/GCC/ARMCMx/crt0.s
index a431dd838..fa92b97ea 100644
--- a/os/ports/GCC/ARMCMx/crt0.s
+++ b/os/ports/GCC/ARMCMx/crt0.s
@@ -45,7 +45,9 @@
.global ResetHandler
.weak ResetHandler
ResetHandler:
- /* Interrupts globally masked. */
+ /*
+ * Interrupts are globally masked initially.
+ */
cpsid i
/*
* Stack pointers initialization.
@@ -53,9 +55,14 @@ ResetHandler:
ldr r0, =__ram_end__
ldr r1, =__main_stack_size__
subs r0, r0, r1
- /* { r0 = main stack low address } */
+ /*
+ * Note that r0 is the main stack low boundary address and process
+ * stack initial top address.
+ */
msr PSP, r0
- /* Early initialization. */
+ /*
+ * Early initialization phase, it is empty by default.
+ */
bl hwinit0
/*
* Data initialization.
@@ -100,11 +107,15 @@ endbloop:
strlo r0, [r1], #4
blo bloop
#endif
- /* Switches to the Process Stack. */
+ /*
+ * Switches to the Process Stack and uses a barrier just to be safe.
+ */
movs r0, #CONTROL_MODE_PRIVILEGED | CONTROL_USE_PSP
msr CONTROL, r0
isb
- /* Late initialization. */
+ /*
+ * Late initialization phase, it is empty by default.
+ */
bl hwinit1
movs r0, #0
mov r1, r0