Yahoo Groups archive

Lpc2000

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

Message

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

2006-04-09 by Robert Adsett

At 11:50 PM 4/8/06 -0300, Boris Estudiez wrote:
>On 07/04/2006 at 21:29:55 -0400 Robert Adsett Wrote:
> > At 10:31 PM 4/7/2006 +0000, rtstofer wrote:
> >
> > >OK, I'll bite!  I have used inline assembly in cc5x (sort of C for the
> > >PIC) to control exactly the number of cycles in a delay routine.  No
> > >active interrupts in this code.  I suppose it could be done in C but
> > >that would change with compilers and optimization.
> >
> > An argument for assembly yes, but I don't see it as an argument for inline
> > assembly.
> >
> > Robert
> >
>
>One advantage of inline assembly is that you don't have to worry
>about of the calling convention used by the compiler (such as ATPCS
>or APCS).

An argument yes, but I don't think  a good one.  In the same time, or less, 
that it takes to figure all the peculiarities of how inline interacts with 
the main code (if indeed it's documented even close to properly) you can 
learn the calling conventions of the compiler and do a 'proper' assembly 
routine.  And the resulting code is a whole lot less fragile.

If you are serious about embedded work then at some point you have to learn 
the calling conventions anyway so you've not saved any effort.

Robert

" 'Freedom' has no meaning of itself.  There are always restrictions,   be 
they legal, genetic, or physical.  If you don't believe me, try to chew a 
radio signal. "  -- Kelvin Throop, III
http://www.aeolusdevelopment.com/

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.