EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

Statup code - CSTARTUP.S

Started by Mircea Stanciu July 23, 2008
Hi,

I have a problem with LPC 2148 (try to enable interrupts) and I don't
understand something in the startup code.

Here is header of cstartup.s (IAR)

I don't understand how 0x18 from ldr pc,[pc,#0x18] is obtained.

I another example for lpc2378 I've found:
__irq_handler:
ldr pc,[pc, #-0x0120]
And what dc32 __iar_program_start lines stands for?

If someone could explain the code below would be very nice. Tnx

MODULE ?cstartup

SECTION CSTACK:DATA:NOROOT(3)
SECTION SVC_STACK:DATA:NOROOT(3)
SECTION IRQ_STACK:DATA:NOROOT(3)
SECTION FIQ_STACK:DATA:NOROOT(3)
SECTION UND_STACK:DATA:NOROOT(3)
SECTION ABT_STACK:DATA:NOROOT(3)

SECTION .intvec:CODE:NOROOT(2)

PUBLIC __vector
PUBLIC __iar_program_start
PUBLIC __vector_0x14
PUBLIC __undef_handler
PUBLIC __swi_handler
PUBLIC __prefetch_handler
PUBLIC __data_handler
PUBLIC __irq_handler
PUBLIC __fiq_handler

ARM

__vector:
ldr pc,[pc,#0x18]
__undef_handler:
ldr pc,[pc,#0x18]
__swi_handler:
ldr pc,[pc,#0x18]
__prefetch_handler:
ldr pc,[pc,#0x18]
__data_handler:
ldr pc,[pc,#0x18]
__vector_0x14:
dc32 0xFFFFFFFF
__irq_handler:
ldr pc,[pc, #0x18]
__fiq_handler:
ldr pc,[pc,#0x18]

dc32 __iar_program_start
dc32 __undef_handler
dc32 __swi_handler
dc32 __prefetch_handler
dc32 __data_handler
dc32 0xFFFFFFFF
dc32 0xFFFFFFFF
dc32 __fiq_handler

An Engineer's Guide to the LPC2100 Series

Hi Mircea

> I don't understand how 0x18 from ldr pc,[pc,#0x18] is obtained.

I suggest to read:

a) The ARM Architecure Reference Manual (aka ARM ARM) (PDF)
b) ARM System Developers Guide (Hardcover)

>
> I another example for lpc2378 I've found:
> __irq_handler:
> ldr pc,[pc, #-0x0120]

c) The LPC2378 manual

> And what dc32 __iar_program_start lines stands for?

d) The IAR manuals

If still don't know what about this after reading those, feel free to
ask again.

--
42Bastian

Note: SPAM-only account, direct mail to bs42@...

--- In l..., 42Bastian wrote:
>
> Hi Mircea
>
> > I don't understand how 0x18 from ldr pc,[pc,#0x18] is obtained.
>
> I suggest to read:
>
> a) The ARM Architecure Reference Manual (aka ARM ARM) (PDF)
> b) ARM System Developers Guide (Hardcover)
>

In addition to those mentioned above, go to Hitex website
www.hitex.com, go to Download section, Insider's Guide subsection and
you can download several useful books from there (non-printable)

The 2024 Embedded Online Conference