Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Message

Re: Example of C and inline ASM in a file?

2006-04-12 by jayasooriah

--- In lpc2000@yahoogroups.com, Robert Adsett <subscriptions@...> wrote:

> >The ARM GCC Inline Assembler Cookbook is one that comes to mind
> Where would I find that BTW?  The one gripe I have against GCC is
> that the documentation seems to be well hidden.

I was referring to:

  http://www.ethernut.de/en/documents/arm-inline-asm.html

I do not like GCC by and large for the same reasons.  Having dwelled
in it to the extent I have, I appreciate the its evolution to the
extent I can sort of "guess" how something works in GCC long before I
dive into the code to confirm.

Open source has its disadvantages.  There are so many variants, many
of which are unfortunately just hacks for particular purposes. These
tend to break the core philosophy and implementation in unexpected ways.

Builds for the popular platforms tend to suffer from this problem more
than core platforms. I run from one such popular platform and I always
work with my own builds from FSF releases which is better controlled.

> Surely volatile is not 
> used universally to signal this?

The creators of C had a phobia about introducing new tokens.  So they
tended to overload the meaning of the same token in different
contexts.  The "static" qualifier is a good example.

From memory, volatile applied to a variable tells the compiler not to
assume that it is normal memory because it may not retain its value
until over written, or that reading it repeatedly may not yield the
same value.

The same qualifier applied to ASM statement tells the compiler not to
assume that optimisation techniques applied to memory will work in the
context of this code sequence involved.

> That presupposes that it is possible to tell the compiler what
registers 
> are being used.

Yes, GCC lets you do this.

> I don't expect we are likely to change each others minds, but
knowing why 
> we reach the decision we do is useful I think.  Now if someone could
come 
> up with a credible way of measuring some of this we might be further 
> along.  On the other hand that might just destroy the fun of debate ;)

The root cause of wars IMO is when one side tries to change the others
mind!

Okay, seriously, I think the truth is somewhere in between.  I like
knowing both so that I can interwork (to borrow the term) and take
advantage of the side that best suits by needs.

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.