From: Nick Clifton <nickc@xxxxxxxxxx>
To: Kurt Kennett <kurt_kennett@xxxxxxxxxxx>
CC: manningc2@xxxxxxxxxxxxx, arm-gnu@xxxxxxxxxxxxxxxx
Subject: Re: [arm-gnu] load constructed constant in arm inline assembly -
how?
Date: Fri, 02 Sep 2005 09:02:29 +0100
Hi Kurt,
I don't want to duplicate my important definitions accross assembler
format and C format of defines.
You can have the C pre-processor run on your assembler source file before
it is handed to assembler itself. Thus you can use C header files in your
assembler source programs. eg:
#include "foo.h"
.text
ldr r0,=FOO
If you give your source file a .S extension (note the capital letter) then
gcc will know to pass the source file through cpp first before giving it to
gas. If you are running on a case-insensitive file system then you can use
the "-x assembler-with-cpp" gcc command line switch instead.
Also, I can use the offsetof() macro to get structure member offsets,
rather than making offsets for each member of a struct in assembler:
This is more difficult. Do you really need assembler instructions to
access these structure fields ? Can't you make use of C instead ? Maybe an
inline function ?
Cheers
Nick