EmbDev.net

Forum: ARM programming with GCC/GNU tools Line comment character for arm-elf-as?


Author: Bill Burgess (auldreekie)
Posted on:

Rate this post
0 useful
not useful
First, my UNDYING GRATITUDE for porting a recent version of the GNU ARM
toolchain to OS X.  The holy grail of being able to compile on my
primary machine without emulating anything or running a remote desktop
is finally within reach!

Second, my apologies for asking what must be a stupid question, but I
cannot figure out what the line-comment character is in arm-elf-as.  The
assembler respects # if it occurs BEFORE any source text on a line.  It
also respects anything enclosed in /* */.  But the other typical
line-comment characters -- !, ;, |, // -- trigger errors, and even #
doesn't work if it occurs after the source content has begin on that
line.

Not a showstopper of course, but mighty peculiar...?  I'm using the
toolchain under OS X 10.4.5.

Sorry if it's obvious -- I tried changing line-endings to DOS/CRLF &
back to UNIX/LF with no difference.  Are line comments no longer
considered good things?

Thanks, --Bill

Author: Bill Burgess (auldreekie)
Posted on:

Rate this post
0 useful
not useful
Found it -- it's the @ character.

Though I'm new to the GNU assembler I've used a few others, as well as
several macro and scripting languages, and this is the first time I can
remember seeing @ used as a line-comment char.  I'm curious if there was
any rationale for choosing @ over !, #, ;, or //.  But not THAT curious.

Thanks for reading!

Author: Bill Burgess (auldreekie)
Posted on:

Rate this post
0 useful
not useful
Doh!  # is used for immediate operands.  Maybe it's time for a vacation.

Author: Clifford Slocombe (clifford)
Posted on:

Rate this post
0 useful
not useful
Bill Burgess wrote:
> Found it -- it's the @ character.
>
> Though I'm new to the GNU assembler I've used a few others, as well as
> several macro and scripting languages, and this is the first time I can
> remember seeing @ used as a line-comment char.  I'm curious if there was
> any rationale for choosing @ over !, #, ;, or //.  But not THAT curious.
>

It seems that the delimiter is target specific, presumably in order to
conform to the chip manufacturers syntax. However @ is not specified in
the manual!

The as manual has this to say:
http://www.gnu.org/software/binutils/manual/gas-2....,
it mentions nothing about ARM or @, but under Machine Dependencies,
(http://www.gnu.org/software/binutils/manual/gas-2....),
says that ; is the comment delimiter.

Confused?

Clifford

Author: Bill Burgess (auldreekie)
Posted on:

Rate this post
0 useful
not useful
Clifford Slocombe wrote:
> ...However @ is not specified in the manual! ... Confused?

Even more confused than that.  The "@" comment delimiter is indeed
specified for the ARM architecture in a GNU assembler manual -- but in a
version of the manual on Red Hat's web site, not FSF's.  From the link,
scroll down to section 8.3.2.1 "Special Characters":

http://sources.redhat.com/binutils/docs-2.10/as_8....

The Red Hat-hosted manual also lists -marm arguments going up to the
920, while the GNU site's manual only goes up to 8.  Evidently the gas
manual forked while FSF wasn't looking...?

Author: Bill Burgess (auldreekie)
Posted on:

Rate this post
0 useful
not useful
More time tracking this down...the most recent version of the binutils
documentation, last updated in May 2005, appears to be at

http://sourceware.org/binutils/docs-2.16/

How do we tell the folks at FSF to quit hosting their obsolete 1994
literature?  It's causing more harm than good.

Author: Clifford Slocombe (clifford)
Posted on:

Rate this post
0 useful
not useful
Bill Burgess wrote:
> More time tracking this down...the most recent version of the binutils
> documentation, last updated in May 2005, appears to be at
>
> http://sourceware.org/binutils/docs-2.16/
>
> How do we tell the folks at FSF to quit hosting their obsolete 1994
> literature?  It's causing more harm than good.

Thanks for that. I'll update by documentation immediately.

Clifford

Author: Clifford Slocombe (clifford)
Posted on:

Rate this post
0 useful
not useful
Bill Burgess wrote:
> http://sourceware.org/binutils/docs-2.16/

Is there a postscript or PDF of this version (or even an HTML tar-ball)
I wonder? - I'd like to have the documentation locally or printable.

Clifford

Author: Bill Burgess (auldreekie)
Posted on:

Rate this post
0 useful
not useful
Clifford Slocombe wrote:
> Is there a postscript or PDF of this version ... ?

A quick Google for binutils 2.16 texinfo pdf led me here:

http://www.delorie.com/djgpp/dl/ofc/current/v2gnu/...

A nice collection of up-to-date PDF, HTML, DVI, and PS-formatted
documentation.

--Bill

Author: Varuzhan (Guest)
Posted on:

Rate this post
0 useful
not useful
In the WinARM20070505 examples for LPS2378 (maybe others too), Martin
Thomas refers
to GNU-as manual from binutils V 2.17 (in file crt0.s) for the character
@ for the
assembler line comments.
The same time his old files still use the more common C++ like comments
// and it
really works with the last version of the Gnu.
For me and, maybe many others, the // looks much usual and preferred,
than @. Does
anybody know why in the referenced manual the // is not mentioned and is
it reliable from the future upgrading point of view to use // ?

Great thanks in advance,
Varuzhan

Author: Martin Thomas (mthomas) (Moderator)
Posted on:

Rate this post
0 useful
not useful
Varuzhan wrote:
> In the WinARM20070505 examples for LPS2378 (maybe others too), Martin
> Thomas refers
> to GNU-as manual from binutils V 2.17 (in file crt0.s) for the character
> @ for the
> assembler line comments.
> The same time his old files still use the more common C++ like comments
> // and it
> really works with the last version of the Gnu.
> For me and, maybe many others, the // looks much usual and preferred,
> than @. Does
> anybody know why in the referenced manual the // is not mentioned and is
> it reliable from the future upgrading point of view to use // ?

The @ is the comment character for the arm-elf-as assembler as already
pointed you in the previous messages in this forum-thread. If you'd like
to use // and /* */ the C-preprocessor has to parse the source first.
Using the preprocessor also offers a lot more options
(#if/#ifdef/#include etc.). An assembler source-code gets automatically
parsed by the preprocessor if it has the files-extension .S (uppercase
S) instead of .s (lowercase s). Also see the documentation on the option
-x assembler-with-cpp.

There is not special reason why I used the "@-comment" in the LPC2378
examples. As you can see the file extension for the assembler-sources is
an uppercase S so // and /* */ can be used too. I just did a "search in
replace" to replace the comment-character used in the original NXP
example-code with @ (replace by // could have been done too).

I don't think there will be any problems with future versions of the
toolchain in this field. If you prefer the C-style comments just use
them and make sure the preprocessor parses the assembler-source first.

Hope this helps,
Martin Thomas

Author: Varuzhan (Guest)
Posted on:

Rate this post
0 useful
not useful
Martin Thomas wrote:
> Varuzhan wrote:
>> In the WinARM20070505 examples for LPS2378 (maybe others too), Martin
>> Thomas refers
>> to GNU-as manual from binutils V 2.17 (in file crt0.s) for the character
>> @ for the
>> assembler line comments.
>> The same time his old files still use the more common C++ like comments
>> // and it
>> really works with the last version of the Gnu.
>> For me and, maybe many others, the // looks much usual and preferred,
>> than @. Does
>> anybody know why in the referenced manual the // is not mentioned and is
>> it reliable from the future upgrading point of view to use // ?
>
> The @ is the comment character for the arm-elf-as assembler as already
> pointed you in the previous messages in this forum-thread. If you'd like
> to use // and /* */ the C-preprocessor has to parse the source first.
> Using the preprocessor also offers a lot more options
> (#if/#ifdef/#include etc.). An assembler source-code gets automatically
> parsed by the preprocessor if it has the files-extension .S (uppercase
> S) instead of .s (lowercase s). Also see the documentation on the option
> -x assembler-with-cpp.
>
> There is not special reason why I used the "@-comment" in the LPC2378
> examples. As you can see the file extension for the assembler-sources is
> an uppercase S so // and /* */ can be used too. I just did a "search in
> replace" to replace the comment-character used in the original NXP
> example-code with @ (replace by // could have been done too).
>
> I don't think there will be any problems with future versions of the
> toolchain in this field. If you prefer the C-style comments just use
> them and make sure the preprocessor parses the assembler-source first.
>
> Hope this helps,
> Martin Thomas

Dear Thomas,

Thank you very much, you make a really great work with the WinARM and
great support, much better than commercial.

Varuzhan

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.