From 63b88a2147d8cc9999c01abca346c8f0cb2641b0 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 26 Mar 2010 15:16:48 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1785 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/ports/GCC/ARMCMx/crt0.s | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'os') 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 -- cgit v1.2.3