Re: [arm-gnu] load constructed constant in arm inline assembly - how?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [arm-gnu] load constructed constant in arm inline assembly - how?



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