[ECOS] Initialization of an ARM - File "vector.S"

Marc Pignat marc.pignat@hevs.ch
Tue May 28 14:46:00 GMT 2002


>>> "Tristan CORCELLE" <tco@teamlog.com> 05/27/02 >14:29 PM >>>
> Hi all,

> I'm working on a processor based on an ARM7TDMI. To initialize my board, I
> have to write the file "hal_board_setup.h".
> So, I'm trying to understand the file "vector.S" included in
> "hal/arm/arch/src/" but I have problems.

> 1) What does mean :

> #define PTR(name)               \
> .##name: .word  name

> What is the result when I write PTR(undefined_instruction) ?

After assembly, this will be a constant, containing the absolute address of undefined_instruction

> 2) The exception handlers are put at 0x00000000 but I don't understand what
> are the "vectors" next to them (at 0x20). What is the idea?

The addresses 0x0 -> 0x1c contains ARM (32 bits) instructions, one for each exception. These instructions are used to jump to the exception handler.

So ARM instructions are coded in 32 bits, where 12 (not sure how many) are used to code the destination address. the address is smaller than the addressable memory, we can't jump anywhere.

the addresses 0x20 -> 0x3c are used to store a 32bits address, pointing on the exception handler (PTR(...)).
address 0x0 -> 0x1c, whe simply load into the pc, the complete (32bits) address of the exception handler, and now we can jump anywhere in the memory !!!

> 3) When there is :

>         .global __exception_handlers
> __exception_handlers:
>                ......
! here is the exception_handler code !

>  What is the difference between these three lines?

>     ldr     r1,__exception_handlers
>     ldr     r1,.__exception_handlers
>     ldr     r1,=__exception_handlers

> (I didn't find anything like that in the ARM web site)
Not sure this is ARM "dialect",try to search in the GNU documentation (perhaps assembler or binutils for ARM)

 >     Thanks in advance
 >       Regards
 >           Tristan

Marc

--
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss



More information about the Ecos-discuss mailing list