ARM Initialization Question

Joel Sherrill joel.sherrill at
Fri Sep 12 19:33:46 UTC 2008

Sebastian Huber wrote:
> Hi,
> I am quite new to the ARM architecture and try to develop a BSP for the
> LPC2478.  I have a question to the initialization code (random start.S):
Just firing a warning shot .. I am starting to refactor out
more common code from the BSPs.  Please try to help out
by moving with me to the better place. :)

+ You know about bsp_get_work_area.  I am starting to
    put it in "startup/bspgetworkarea.c" not bspstart.c
    and reworking all BSPs to have one.

+ Once you have bsp_get_work_area, many BSPs no
    longer need a bsp_pretasking_hook and can use
    the common one.

+ I also want to review and consolidate bsp_cleanup
    implementations.  There are a lot of them that are
    the same.

+ Eventually I want the bsp_pretasking_hooks to be in
    their own file. 

+ When all this much settles out, I can see the possibility
    of some of the bsp_cleanup implementations referencing
    bsp_reset().  I am also seeing how having bsp_spurious_initialize()
    as a standard entry could simplify things.

I'm not picking on you personally just hoping that as new
BSPs get written and old ones updated, the authors help
out by using shared code from the framework where possible
and avoid duplicating more code.
> [...]
> /* Set up the SVC stack pointer last and stay in SVC mode */
> mov     r0, #(PSR_MODE_SVC | PSR_I | PSR_F)     /* No interrupts */
> msr     cpsr, r0
> ldr     r1, =_svc_stack_size
> ldr     sp, =_svc_stack
> add     sp, sp, r1
> sub     sp, sp, #0x64
> [...]
> Why is 0x64 subtracted from the stack pointer?
> --
> Sebastian Huber, Embedded Brains GmbH
> Address : Obere Lagerstr. 30, D-82178 Puchheim, Germany
> Phone   : +49 89 18 90 80 79-6
> Fax     : +49 89 18 90 80 79-9
> E-Mail  : sebastian.huber at
> PGP     : Public key available on request
> Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
> _______________________________________________
> rtems-users mailing list
> rtems-users at

Joel Sherrill, Ph.D.             Director of Research & Development
joel.sherrill at        On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
   Support Available             (256) 722-9985

More information about the users mailing list