[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Assembly Language Programming Question



I added back dev-etrax to the CC-line; please don't remove it.
It is usually the case that others are helped by seeing a
question with the answer, even if you think it's specific to
your needs.

> From: "Dan Pattison" <sirdan@xxxxxxx.net>
> Date: Sat, 22 Nov 2003 23:58:17 -0800

> Hello:
> Thank you for your reply. I am still having some problems with compiling
> my assembly language program. I have gone through all the steps in the
> tutorial for making a .c =93Hello World=94 program and making it work =
> with
> x86 and on our Dev82 board.
> I have taken the standard =93Hello World=94 .c source code and compiled =
> it
> with gcc-cris with the =96S option and have the following assembly
> language output:

If you compile with -O2, you'll see the optimized version.  Then
it's slightly easier to follow the assembly output.  I see you
also didn't use the required option "-mlinux".

> Now that I have a proper skeleton, I want to assemble it to a working
> program. I have tried using as-cris and ld-cris to assemble and link the
> program but I can=92t seem to make it work. I must be missing some =
> command
> line switch or something.

You can (really) assemble and link assembly code using
"gcc-cris -mlinux"; I *strongly* suggest not using the assembler
and linker separately.  If you really want to see the
command-lines passed to the assembler and linker, use "-v".

> I have tried to modify a make file so gcc-cris
> can pass the proper args to as-cris but that doesn=92t work either. I =
> have
> looked at the ABI subsection in Chapter 6, but it doesn=92t give an
> example of assembling a program and the steps needed.

That chapter just describes the layout of stack frames, which is
likely of interest when interfacing C and assembly code.

> I have searched
> the internet for examples of how to do this but found nothing.

I suggest you search the code in the apps directory in
devboard_82 instead.

> All I need is the
> command line examples for as-cris and ld-cris to assemble the converted
> .c file above. Can you help me?

I can help you better if you explain the need to write assembly
code.  Really.

brgds, H-P