Yahoo Groups archive

Lpc2000

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

Message

Re: [lpc2000] Inline assembly and C variables

2006-05-08 by Bryce Schober

Robert's point is a good one. Aviod inline assembler where possible. I've
often found that GCC's optimization was better than I would've come up with
anyway. I've only used inline assembly in a few cases where I needed the
absolute best performance, which involved using instructions that it was
hard to get GCC to emit. It seems that you're using a pseudo-opcode that
might not even be recognized by the GCC compiler. Regarding inline assembly
syntax in general, it seems that you're missing some syntax concepts that
can be found here:

http://www.ibiblio.org/gferg/ldp/GCC-Inline-Assembly-HOWTO.html#s2

Then, if you really need to get in deep you can check out your GCC version's
manual section entitled "Constraints for asm operands", which will also have
target-specific bits. But again, as recommended by Robert, stay away from
inline assembly, unless absolutely
necessary.<http://gcc.gnu.org/onlinedocs/gcc-4.0.1/gcc/Constraints.html#Constraints>

On 5/7/06, Robert Adsett <subscriptions@...> wrote:
>
> At 11:15 AM 5/6/2006 +0000, MB wrote:
> >I'm trying to use C variables inside inline assembly code, but can't
> >get it to work (the compiler is gcc).
> >
> >static const short g_psMyArray asm("g_psAsmMyArray:") =
> >{ 1, 2, 3, 4};
> >
> >void myfunc()
> >{
> >     asm("ADRL  r14, psAsmMyArray");
> >}
> >
> >This results with an error (something like "symbol is undefined in
> >current file").
>
> Why not just use C?  What's the advantage you are expecting that's
> compelling you to use assembly?
>
> If you can provide a little more detail maybe we can solve the problem in
> another way.
>
> 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/
>
>
>
>
>  SPONSORED LINKS
>   Microcontrollers<http://groups.yahoo.com/gads?t=ms&k=Microcontrollers&w1=Microcontrollers&w2=Microprocessor&w3=Intel+microprocessors&c=3&s=69&.sig=c-HXthtbZy4TZbI3ib0PMg>
> Microprocessor<http://groups.yahoo.com/gads?t=ms&k=Microprocessor&w1=Microcontrollers&w2=Microprocessor&w3=Intel+microprocessors&c=3&s=69&.sig=ijt0SspWtjogcHCuFD0lUQ>  Intel
> microprocessors<http://groups.yahoo.com/gads?t=ms&k=Intel+microprocessors&w1=Microcontrollers&w2=Microprocessor&w3=Intel+microprocessors&c=3&s=69&.sig=WOZdpklkgHbXR5quAgrl5w>
>  ------------------------------
> YAHOO! GROUPS LINKS
>
>
>    -  Visit your group "lpc2000 <http://groups.yahoo.com/group/lpc2000>"
>    on the web.
>
>    -  To unsubscribe from this group, send an email to:
>     lpc2000-unsubscribe@yahoogroups.com<lpc2000-unsubscribe@yahoogroups.com?subject=Unsubscribe>
>
>    -  Your use of Yahoo! Groups is subject to the Yahoo! Terms of
>    Service <http://docs.yahoo.com/info/terms/>.
>
>
>  ------------------------------
>



--
Bryce Schober


[Non-text portions of this message have been removed]

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.