Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Thread

Calling Convention (ATPCS or APCS ?)

Calling Convention (ATPCS or APCS ?)

2006-01-17 by Boris Estudiez

Hi All,

I'm programming some assembler functions (with arm-elf-as)
and I want to call it from C (arm-elf-gcc). 

My assembly functions follows the ATPCS (ARM Thumb Procedure 
Call Standard), but I don't sure if that is the best choice.

1. Should I use ATPCS or APCS (ARM Procedure Call Standard) ?.

2. Which is more efficient (from code size/speed point of view) ?.

3. Can I use APCS with Thumb code ?.

4. Which calling convention use by default arm-elf-gcc ?. 
   Should I use -matpcs option for ATPCS ?.

5. Inline assembly is independent of calling conventions ?.

Thanks in advance.

Regards,
Boris Estudiez.-

-- 

Contacteme en:
* Mail(1): stk@...
* Mail(2): 43824@...
* Mail(3): slicetex@...
* Website: http://stk.freeshell.org
EOF

Re: [lpc2000] Calling Convention (ATPCS or APCS ?)

2006-01-18 by 42Bastian Schick

Boris

> I'm programming some assembler functions (with arm-elf-as)
Let me suggest to use arm-elf-gcc to call the assembler, this allows
you to use the C pre-processor.

> and I want to call it from C (arm-elf-gcc).

>
> My assembly functions follows the ATPCS (ARM Thumb Procedure
> Call Standard), but I don't sure if that is the best choice.
>
> 1. Should I use ATPCS or APCS (ARM Procedure Call Standard) ?.

I am not aware of a difference. The RTOS I wrote just relies on the
things common: r0-r3 are argument/scratch registers. r12 is used
for linkage or can be used as scratch-register.

> 2. Which is more efficient (from code size/speed point of view) ?.

I see no difference other than the normal Thumb code limitations.

> 3. Can I use APCS with Thumb code ?.

The only difference I see is that you cannot easily use the r8..r12
in Thumb code.

> 4. Which calling convention use by default arm-elf-gcc ?.
>    Should I use -matpcs option for ATPCS ?.

I never used this switch, so I guess.

> 5. Inline assembly is independent of calling conventions ?.

Inline assembly does not depend on calling convention since the
compiler build the prologue and epilogue of a function.

-- 
42Bastian Schick

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.