This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more infromation.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Using GAS, any tutorials


> > The tools I have used before always tell you how to begin your
> > program, what directives need to be there and why, and additional
> > "configuration" info to embed into the program that really has nothing
> > to do with the actual code itself.
> 
> this varies from target to target...  gas was meant to be a drop-in
> replacement for many system assemblers, and as such it accepts a wide
> variety of syntaxes.  if you can find a manual for one of them, it'll
> probably be applicable to gas.  (of course nobody seems to know where to
> find one...)

So I can only conclude that there is no other way for me to begin but to
get a basic example (my target is going to be a Hitachi SH7032), pick it
apart, attempt to copy the basics for my own chip but create a very
simple program such as send characters out the serial port, and see if
it works.  I just find it amazing how anyone ever gets anything done, or
maybe that is why so many software projects take three times longer than
management schedules for. ;-)

I am not sure I understand your statement "if you can find a manual for
one of them, it'll probably be applicable to gas."  GNU AS I thought
must have consistent placement of directives and would not vary
according to the target since it is an assembler with its own oddities. 
I just don't find all the "rules" for GNU AS laid out clearly anywhere. 
It just appears to be the school of hard knocks all the way.  I guess I
am spoiled by all the commercial assemblers for motorola, intel I have
bought in the past.

R.Floyd


"Aaron J. Grier" wrote:
> 
> On Thu, Oct 19, 2000 at 10:27:58AM -0500, Robert Floyd wrote:
> > I understand the difference in assembly mnemonic and I have written
> > numerous assembly language programs for consumer products.  I am lost
> > however with GNU in that there is no documentation available which
> > tells one how to set up directives for the assembler.
> 
> section 7 of the as infopages / manual is full of assembler directives.
> almost all of them are available on every target.
> 
> > The tools I have used before always tell you how to begin your
> > program, what directives need to be there and why, and additional
> > "configuration" info to embed into the program that really has nothing
> > to do with the actual code itself.
> 
> this varies from target to target...  gas was meant to be a drop-in
> replacement for many system assemblers, and as such it accepts a wide
> variety of syntaxes.  if you can find a manual for one of them, it'll
> probably be applicable to gas.  (of course nobody seems to know where to
> find one...)
> 
> > Such as all *.s files begin with .file "filename", (do they? The
> > examples I see do..),
> 
> not necessary.
> 
> > immediately after file you put .align "some number", (do you have to
> > put it there? can I put it later in the program?),
> 
> not necessary unless your target requires it.  usually the linker
> handles it.
> 
> > every file ends with .end (does it?  the example I have does and what
> > is this .end anyway, GAS does not list .end)
> 
> not necessary.
> 
> > These are the types of questions that I have and I don't find
> > any info available for these types of questions.  Do I need to write
> > one after basically 6 months of trial and error.
> 
> something as simple as the following compiles:
> 
> .text
> mysubroutine:
>         addil   #1, somesillyvariable
>         rts
> 
> .data
> somesillyvariable:
>         .long   0
> 
> you can get as contorted or keep it as minimal as you like.  relocations
> and subroutine alignments are handled by the linker.
> 
> > I understand the principle that "unless it's hard, it can't be good"
> > Unix mentality, but geezzz!  We can do better in my own humble
> > opinion.
> 
> you volunteering to write some docs?  ;)
> 
> --
>   Aaron J. Grier   |    Frye Electronics, Tigard, OR   |   aaron@frye.com
>   "Add [Windows] ME to an old PC with a `mere' 32 MB of memory, and your
>    hard disk will be busier than a one-armed man juggling knives."
>     --  Winn L. Rosch

------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]