EmbDev.net

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


Author: Vinit Bidkar (vinitbidkar)
Posted on:

Rate this post
0 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

Author: Vinit Bidkar (vinitbidkar)
Posted on:

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

Author: Vinit Bidkar (vinitbidkar)
Posted on:
Attached files:

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

Author: Clifford Slocombe (clifford)
Posted on:

Rate this post
0 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

Author: Vinit Bidkar (vinitbidkar)
Posted on:

Rate this post
0 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.

Author: Clifford Slocombe (clifford)
Posted on:

Rate this post
0 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

Author: Vinit Bidkar (vinitbidkar)
Posted on:

Rate this post
0 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

Reply

Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]




Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.