EmbDev.net

Forum: ARM programming with GCC/GNU tools Preprocessing before assembling


von Vinit B. (vinitbidkar)


Rate this post
useful
not useful
Environment details:

make:                3.18
binutils:            2.18
arm-elf-gcc:    4.2.2
newlib:              1.16.0
gdb:                  6.8.50-20080308-cvs

I am trying to compile a assembly file which is 'board_startup.S'
received as a part of the 'at91lib' package.

the file is provided in the attachment.

Questions:
1) How to make the assembler pre process the .s file before assembling?
2) What are the most essential options with which the assembler should
be invoked to generate the object file out of the assembly file (arm
architecture specific options are being taken care of)

Thanks
Vinit

von Vinit B. (vinitbidkar)


Rate this post
useful
not useful
Please find the assembly file in the attachment.

von Vinit B. (vinitbidkar)


Attached files:

Rate this post
useful
not useful
Vinit Bidkar wrote:
>  Please find the assembly file in the attachment.

von Clifford S. (clifford)


Rate this post
useful
not useful
> 1) How to make the assembler pre process the .s file before assembling?

You can run teh C pre-processor independently of the compiler. It is
called cpp (for an arm-elf cross-toolchain arm-elf-cpp [.exe extension
under Windows]). You can pass it any GCC options, only those that
control the pre-processor will have any affect. So you would pass the
-I<include-path> options for example, and any -D<macro>[=<value>]
options for example. Often it is just as easy to pass all CFLAGS or
AFLAGS.

> 2) What are the most essential options with which the assembler should
> be invoked to generate the object file out of the assembly file (arm
> architecture specific options are being taken care of)

Its your project, that's up to you. Assembler code has no options that
affect code generation since you generate the code manually. The
architecture options simply determine the instruction set and endianness
to validate against.


Clifford

von Vinit B. (vinitbidkar)


Rate this post
useful
not useful
Clifford Slocombe wrote:

> Its your project, that's up to you. Assembler code has no options that
> affect code generation since you generate the code manually. The
> architecture options simply determine the instruction set and endianness
> to validate against.
>
>
> Clifford

Ok. got it.

von Clifford S. (clifford)


Rate this post
useful
not useful
In case it is useful, my make file invokes the following commands for
assembler file builds:

  cpp $(INCLUDES) $< $(patsubst %.s, %_temp.s, $<)
  $(AS) $(AFLAGS) $(patsubst %.s, %_temp.s, $<) -o $@
  rm $(patsubst %.s, %_temp.s, $<)

The first executes the pre-processor on xxxx.s to produce xxxx_temp.s.
The second takes xxxx_temp.s to produce xxxx.o
The third deletes xxxx_temp.s

INCLUDES is the macro defining the project include paths. AFLAGS is
defined thus:

AFLAGS   = -gdwarf2 -marmv4t --defsym THUMB_ONLY=0

This specifies the symbolic debugger format THUMB_ONLY is a macro used
in ny C runtime startup to produce THUMB specific code, when set to non
zero.

Clifford

von Vinit B. (vinitbidkar)


Rate this post
useful
not useful
Clifford Slocombe wrote:
> In case it is useful, my make file invokes the following commands for
> assembler file builds:
>
>   cpp $(INCLUDES) $< $(patsubst %.s, %_temp.s, $<)
>   $(AS) $(AFLAGS) $(patsubst %.s, %_temp.s, $<) -o $@
>   rm $(patsubst %.s, %_temp.s, $<)
>
> Clifford

Thanks very much Clifford.

I will try this on my code.

Regards
Vinit

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.